From 59c3d5121daa280ca6eae18ac8e67ec8c7daaa9b Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 31 Oct 2019 16:38:43 +0100 Subject: [PATCH] Add brackets around cached IPv6 IP addresses Fixes #1005 --- dnscrypt-proxy/xtransport.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dnscrypt-proxy/xtransport.go b/dnscrypt-proxy/xtransport.go index acf2eb11..faaf12c1 100644 --- a/dnscrypt-proxy/xtransport.go +++ b/dnscrypt-proxy/xtransport.go @@ -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) }