Skip to content

Commit

Permalink
fix: default nameserver cannot use doh of pure IP
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyxim committed Jul 12, 2022
1 parent 92a20a5 commit 3a92ad4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
}
Expand Down

0 comments on commit 3a92ad4

Please sign in to comment.