A source URL may have an IP address that doesn't exist any more

This commit is contained in:
Frank Denis 2023-04-06 14:18:38 +02:00
parent cf7d60a704
commit b898e07066
1 changed files with 4 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
"encoding/base64" "encoding/base64"
"encoding/hex" "encoding/hex"
"errors" "errors"
"fmt"
"io" "io"
"math/rand" "math/rand"
"net" "net"
@ -415,6 +416,9 @@ func (xTransport *XTransport) resolveAndUpdateCache(host string) error {
return err return err
} }
} }
if foundIP == nil {
return fmt.Errorf("no IP address found for [%s]", host)
}
xTransport.saveCachedIP(host, foundIP, ttl) xTransport.saveCachedIP(host, foundIP, ttl)
dlog.Debugf("[%s] IP address [%s] added to the cache, valid for %v", host, foundIP, ttl) dlog.Debugf("[%s] IP address [%s] added to the cache, valid for %v", host, foundIP, ttl)
return nil return nil