This commit is contained in:
j2rong4cn 2025-05-01 11:40:31 +08:00
parent a6e8fe409a
commit 13b70d5543
2 changed files with 7 additions and 1 deletions

View file

@ -189,7 +189,10 @@ func (s *DNS) LookupIP(domain string, option dns.IPOption) ([]net.IP, uint32, er
// Static host lookup
switch addrs, err := s.hosts.Lookup(domain, option); {
case err != nil:
return nil, 0, err
if go_errors.Is(err, dns.ErrEmptyResponse) {
return nil, 0, dns.ErrEmptyResponse
}
return nil, 0, errors.New("returning nil for domain ", domain).Base(err)
case addrs == nil: // Domain not recorded in static host
break
case len(addrs) == 0: // Domain recorded, but no valid IP returned (e.g. IPv4 address with only IPv6 enabled)