diff --git a/app/dns/dns.go b/app/dns/dns.go index a359cb3e..1395231d 100644 --- a/app/dns/dns.go +++ b/app/dns/dns.go @@ -206,7 +206,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 1f582416..2ceae7ba 100644 --- a/app/dns/hosts.go +++ b/app/dns/hosts.go @@ -87,6 +87,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