Add brackets around cached IPv6 IP addresses

Fixes #1005
This commit is contained in:
Frank Denis 2019-10-31 16:38:43 +01:00
parent 1c9924e055
commit 59c3d5121d
1 changed files with 5 additions and 1 deletions

View File

@ -133,7 +133,11 @@ func (xTransport *XTransport) rebuildTransport() {
ipOnly := host
cachedIP, ok := xTransport.loadCachedIP(host, false)
if ok {
ipOnly = cachedIP.String()
if ipv4 := cachedIP.To4(); ipv4 != nil {
ipOnly = ipv4.String()
} else {
ipOnly = "[" + cachedIP.String() + "]"
}
} else {
dlog.Debugf("[%s] IP address was not cached", host)
}