Fix no error return when empty DNS cache retrieved

This commit is contained in:
世界 2024-08-20 23:17:02 +08:00
parent 064fb9b873
commit db5719e22f
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -188,6 +188,9 @@ func (r *Router) Lookup(ctx context.Context, domain string, strategy dns.DomainS
) )
responseAddrs, cached = r.dnsClient.LookupCache(ctx, domain, strategy) responseAddrs, cached = r.dnsClient.LookupCache(ctx, domain, strategy)
if cached { if cached {
if len(responseAddrs) == 0 {
return nil, dns.RCodeNameError
}
return responseAddrs, nil return responseAddrs, nil
} }
r.dnsLogger.DebugContext(ctx, "lookup domain ", domain) r.dnsLogger.DebugContext(ctx, "lookup domain ", domain)