1
0
mirror of https://github.com/DNSCrypt/dnscrypt-proxy.git synced 2024-12-27 00:12:31 +01:00

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 b67d19ffb3
commit 71e3cf4aef

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)
}