mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-14 21:31:16 +08:00
fix: 当dns被禁用时,dns将根据general ipv6设置解析dns
This commit is contained in:
parent
b831eb178b
commit
891c2fe899
@ -79,7 +79,7 @@ func ApplyConfig(cfg *config.Config, force bool) {
|
||||
updateSniffer(cfg.Sniffer)
|
||||
updateHosts(cfg.Hosts)
|
||||
initInnerTcp()
|
||||
updateDNS(cfg.DNS)
|
||||
updateDNS(cfg.DNS, cfg.General.IPv6)
|
||||
loadProxyProvider(cfg.Providers)
|
||||
updateProfile(cfg)
|
||||
loadRuleProvider(cfg.RuleProviders)
|
||||
@ -125,13 +125,16 @@ func GetGeneral() *config.General {
|
||||
|
||||
func updateExperimental(c *config.Config) {}
|
||||
|
||||
func updateDNS(c *config.DNS) {
|
||||
func updateDNS(c *config.DNS, generalIPv6 bool) {
|
||||
if !c.Enable {
|
||||
resolver.DisableIPv6 = !generalIPv6
|
||||
resolver.DefaultResolver = nil
|
||||
resolver.DefaultHostMapper = nil
|
||||
resolver.DefaultLocalServer = nil
|
||||
dns.ReCreateServer("", nil, nil)
|
||||
return
|
||||
} else {
|
||||
resolver.DisableIPv6 = !c.IPv6
|
||||
}
|
||||
|
||||
cfg := dns.Config{
|
||||
@ -153,8 +156,6 @@ func updateDNS(c *config.DNS) {
|
||||
ProxyServer: c.ProxyServerNameserver,
|
||||
}
|
||||
|
||||
resolver.DisableIPv6 = !cfg.IPv6
|
||||
|
||||
r := dns.NewResolver(cfg)
|
||||
pr := dns.NewProxyServerHostResolver(r)
|
||||
m := dns.NewEnhancer(cfg)
|
||||
|
Loading…
Reference in New Issue
Block a user