speed up ping

This commit is contained in:
Hiddify
2024-01-25 23:59:07 +01:00
parent cc4e89445f
commit 96e7bfffce
3 changed files with 23 additions and 3 deletions

6
build_windows.bat Normal file
View File

@@ -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

View File

@@ -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 {

View File

@@ -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,