From 125f35e426c6c7a68e696157bf43bdd27509c3d7 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Mon, 16 May 2022 23:34:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BD=93dns=E8=A2=AB=E7=A6=81=E7=94=A8?= =?UTF-8?q?=E6=97=B6=EF=BC=8Cdns=E5=B0=86=E6=A0=B9=E6=8D=AEgeneral=20ipv6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=A7=A3=E6=9E=90dns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hub/executor/executor.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hub/executor/executor.go b/hub/executor/executor.go index 4bad0469..ab3a7e18 100644 --- a/hub/executor/executor.go +++ b/hub/executor/executor.go @@ -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)