From 2943e3982c6f45a43004f1544fa9e7a11ba494bf Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Tue, 12 Jul 2022 13:05:59 +0800 Subject: [PATCH] fix: default nameserver cannot use doh of pure IP --- config/config.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/config/config.go b/config/config.go index 02c691c0..da8fb828 100644 --- a/config/config.go +++ b/config/config.go @@ -817,12 +817,10 @@ func parseDNS(rawCfg *RawConfig, hosts *trie.DomainTrie[netip.Addr], rules []C.R host, _, err := net.SplitHostPort(ns.Addr) if err != nil || net.ParseIP(host) == nil { u, err := url.Parse(ns.Addr) - if err == nil { + if err == nil && net.ParseIP(u.Host) == nil { if ip, _, err := net.SplitHostPort(u.Host); err != nil || net.ParseIP(ip) == nil { return nil, errors.New("default nameserver should be pure IP") } - } else { - return nil, errors.New("default nameserver should be pure IP") } } }