diff --git a/build_windows.bat b/build_windows.bat new file mode 100644 index 0000000..f4edcec --- /dev/null +++ b/build_windows.bat @@ -0,0 +1,6 @@ +@echo off +set GOOS=windows +set GOARCH=amd64 +set CC=x86_64-w64-mingw32-gcc +set CGO_ENABLED=1 +go build -trimpath -tags with_gvisor,with_quic,with_wireguard,with_ech,with_utls,with_clash_api,with_grpc -ldflags="-w -s" -buildmode=c-shared -o bin/libcore.dll ./custom diff --git a/config/config.go b/config/config.go index 07e6fa6..cfdede4 100644 --- a/config/config.go +++ b/config/config.go @@ -80,7 +80,7 @@ func BuildConfig(configOpt ConfigOptions, input option.Options) (*option.Options Address: configOpt.RemoteDnsAddress, AddressResolver: "dns-direct", Strategy: configOpt.RemoteDnsDomainStrategy, - Detour: "proxy", + Detour: "select", }, { Tag: "dns-direct", @@ -175,7 +175,7 @@ func BuildConfig(configOpt ConfigOptions, input option.Options) (*option.Options Listen: option.NewListenAddress(netip.MustParseAddr(bind)), ListenPort: configOpt.LocalDnsPort, }, - OverrideAddress: "8.8.8.8", + OverrideAddress: "1.1.1.1", OverridePort: 53, }, }, @@ -261,6 +261,20 @@ func BuildConfig(configOpt ConfigOptions, input option.Options) (*option.Options }, }, ) + var dnsCPttl uint32 = 300000 + + options.DNS.Rules = append( + options.DNS.Rules, + option.DNSRule{ + Type: C.RuleTypeDefault, + DefaultOptions: option.DefaultDNSRule{ + Domain: []string{"cp.cloudflare.com"}, + Server: "dns-remote", + RewriteTTL: &dnsCPttl, + DisableCache: false, + }, + }, + ) } for _, rule := range configOpt.Rules { diff --git a/config/option.go b/config/option.go index e68f90c..5826c66 100644 --- a/config/option.go +++ b/config/option.go @@ -71,7 +71,7 @@ func DefaultConfigOptions() *ConfigOptions { MTU: 9000, StrictRoute: true, TUNStack: "mixed", - ConnectionTestUrl: "https://cp.cloudflare.com/", + ConnectionTestUrl: "http://cp.cloudflare.com/", URLTestInterval: option.Duration(10 * time.Minute), URLTestIdleTimeout: option.Duration(100 * time.Minute), EnableClashApi: true,