Fix: fix dns fake-ip patch

This commit is contained in:
kr328 2021-11-14 19:40:02 +08:00
parent 3397cdd95f
commit 25936c8361
2 changed files with 14 additions and 8 deletions

View file

@ -20,4 +20,5 @@ var (
// Nintendo Switch // Nintendo Switch
"*.n.n.srv.nintendo.net", "*.n.n.srv.nintendo.net",
} }
defaultFakeIPRange = "28.0.0.0/8"
) )

View file

@ -62,19 +62,24 @@ func patchProfile(cfg *config.RawConfig, _ string) error {
func patchDns(cfg *config.RawConfig, _ string) error { func patchDns(cfg *config.RawConfig, _ string) error {
if !cfg.DNS.Enable { if !cfg.DNS.Enable {
cfg.DNS.Enable = true cfg.DNS = config.RawDNS{
cfg.DNS.IPv6 = false Enable: true,
cfg.DNS.NameServer = defaultNameServers UseHosts: true,
cfg.DNS.EnhancedMode = C.DNSFakeIP DefaultNameserver: defaultNameServers,
cfg.DNS.FakeIPRange = "28.0.0.0/8" NameServer: defaultNameServers,
cfg.DNS.DefaultNameserver = defaultNameServers EnhancedMode: C.DNSFakeIP,
cfg.DNS.FakeIPFilter = defaultFakeIPFilter FakeIPRange: defaultFakeIPRange,
FakeIPFilter: defaultFakeIPFilter,
FallbackFilter: config.RawFallbackFilter{
GeoIP: false,
},
}
cfg.ClashForAndroid.AppendSystemDNS = true cfg.ClashForAndroid.AppendSystemDNS = true
} }
if cfg.ClashForAndroid.AppendSystemDNS { if cfg.ClashForAndroid.AppendSystemDNS {
cfg.DNS.NameServer = append(cfg.DNS.NameServer, "dhcp://" + dns.SystemDNSPlaceholder) cfg.DNS.NameServer = append(cfg.DNS.NameServer, "dhcp://"+dns.SystemDNSPlaceholder)
} }
return nil return nil