From 74f1bf330d831d8082d799dac43d134660f5ce36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Tue, 7 Jun 2022 11:49:38 +0800 Subject: [PATCH] =?UTF-8?q?DNS=E8=A7=A3=E6=9E=90=E5=BA=93=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=BD=BF=E7=94=A8Go=E5=8E=9F=E7=94=9F=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/node.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/internal/nodes/node.go b/internal/nodes/node.go index f96c102..de1fe89 100644 --- a/internal/nodes/node.go +++ b/internal/nodes/node.go @@ -927,15 +927,22 @@ func (this *Node) onReload(config *nodeconfigs.NodeConfig) { var err error switch config.DNSResolver.Type { case nodeconfigs.DNSResolverTypeGoNative: - err = os.Setenv("GODEBUG", "netdns=go+2") + err = os.Setenv("GODEBUG", "netdns=go") case nodeconfigs.DNSResolverTypeCGO: - err = os.Setenv("GODEBUG", "netdns=cgo+2") + err = os.Setenv("GODEBUG", "netdns=cgo") default: - err = os.Unsetenv("GODEBUG") + // 默认使用go原生 + err = os.Setenv("GODEBUG", "netdns=go") } if err != nil { remotelogs.Error("NODE", "[DNS_RESOLVER]set env failed: "+err.Error()) } + } else { + // 默认使用go原生 + err := os.Setenv("GODEBUG", "netdns=go") + if err != nil { + remotelogs.Error("NODE", "[DNS_RESOLVER]set env failed: "+err.Error()) + } } }