From b898e07066dc02f6a7cdf7b45f582c6263beb20c Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 6 Apr 2023 14:18:38 +0200 Subject: [PATCH] A source URL may have an IP address that doesn't exist any more --- dnscrypt-proxy/xtransport.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dnscrypt-proxy/xtransport.go b/dnscrypt-proxy/xtransport.go index bc50d5fd..b4457257 100644 --- a/dnscrypt-proxy/xtransport.go +++ b/dnscrypt-proxy/xtransport.go @@ -9,6 +9,7 @@ import ( "encoding/base64" "encoding/hex" "errors" + "fmt" "io" "math/rand" "net" @@ -415,6 +416,9 @@ func (xTransport *XTransport) resolveAndUpdateCache(host string) error { return err } } + if foundIP == nil { + return fmt.Errorf("no IP address found for [%s]", host) + } xTransport.saveCachedIP(host, foundIP, ttl) dlog.Debugf("[%s] IP address [%s] added to the cache, valid for %v", host, foundIP, ttl) return nil