fix: default nameserver cannot use doh of pure IP
This commit is contained in:
parent
30b2c58ab5
commit
2943e3982c
1 changed files with 1 additions and 3 deletions
|
@ -817,12 +817,10 @@ func parseDNS(rawCfg *RawConfig, hosts *trie.DomainTrie[netip.Addr], rules []C.R
|
||||||
host, _, err := net.SplitHostPort(ns.Addr)
|
host, _, err := net.SplitHostPort(ns.Addr)
|
||||||
if err != nil || net.ParseIP(host) == nil {
|
if err != nil || net.ParseIP(host) == nil {
|
||||||
u, err := url.Parse(ns.Addr)
|
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 {
|
if ip, _, err := net.SplitHostPort(u.Host); err != nil || net.ParseIP(ip) == nil {
|
||||||
return nil, errors.New("default nameserver should be pure IP")
|
return nil, errors.New("default nameserver should be pure IP")
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return nil, errors.New("default nameserver should be pure IP")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue