diff --git a/core/src/main/golang/config/load.go b/core/src/main/golang/config/load.go index 4609603..aa6785c 100644 --- a/core/src/main/golang/config/load.go +++ b/core/src/main/golang/config/load.go @@ -6,7 +6,6 @@ import ( "github.com/Dreamacro/clash/config" "github.com/Dreamacro/clash/constant" - "github.com/Dreamacro/clash/dns" "github.com/Dreamacro/clash/hub/executor" "github.com/Dreamacro/clash/log" "github.com/kr328/cfa/tun" @@ -30,31 +29,6 @@ Rule: - 'MATCH,DIRECT' ` -func init() { - defaultNameServers := []string{ - "223.5.5.5", - "119.29.29.29", - "1.1.1.1", - "208.67.222.222", - } - - OptionalDnsPatch = &config.RawDNS{ - Enable: true, - IPv6: true, - NameServer: defaultNameServers, - Fallback: []string{}, - FallbackFilter: config.RawFallbackFilter{ - GeoIP: false, - IPCIDR: []string{}, - }, - Listen: ":0", - EnhancedMode: dns.FAKEIP, - FakeIPRange: "198.18.0.0/16", - FakeIPFilter: []string{}, - DefaultNameserver: defaultNameServers, - } -} - // LoadDefault - load default configure func LoadDefault() { DnsPatch = nil diff --git a/core/src/main/golang/config/patch.go b/core/src/main/golang/config/patch.go index 2613775..b23dd15 100644 --- a/core/src/main/golang/config/patch.go +++ b/core/src/main/golang/config/patch.go @@ -3,6 +3,7 @@ package config import ( "github.com/Dreamacro/clash/component/fakeip" "github.com/Dreamacro/clash/config" + "github.com/Dreamacro/clash/dns" "net/url" ) @@ -14,6 +15,31 @@ var ( cachedPool *fakeip.Pool ) +func init() { + defaultNameServers := []string{ + "223.5.5.5", + "119.29.29.29", + "1.1.1.1", + "208.67.222.222", + } + + OptionalDnsPatch = &config.RawDNS{ + Enable: true, + IPv6: true, + NameServer: defaultNameServers, + Fallback: []string{}, + FallbackFilter: config.RawFallbackFilter{ + GeoIP: false, + IPCIDR: []string{}, + }, + Listen: ":0", + EnhancedMode: dns.FAKEIP, + FakeIPRange: "198.18.0.0/16", + FakeIPFilter: []string{}, + DefaultNameserver: defaultNameServers, + } +} + func patchRawConfig(rawConfig *config.RawConfig) { rawConfig.DNS.FakeIPRange = "198.18.0.0/16" rawConfig.Experimental.Interface = ""