diff --git a/app/dns/dns.go b/app/dns/dns.go index cd610907..6d810a70 100644 --- a/app/dns/dns.go +++ b/app/dns/dns.go @@ -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) diff --git a/app/dns/hosts.go b/app/dns/hosts.go index 3b38268f..b7ce1854 100644 --- a/app/dns/hosts.go +++ b/app/dns/hosts.go @@ -86,6 +86,9 @@ func (h *StaticHosts) lookup(domain string, option dns.IPOption, maxDepth int) ( return addrs, nil case len(addrs) == 1: if err, ok := addrs[0].(dns.RCodeError); ok { + if uint16(err) == 0 { + return nil, dns.ErrEmptyResponse + } return nil, err } if addrs[0].Family().IsDomain() { // Try to unwrap domain