Skip to content

Commit 59c3d51

Browse files
committed
Add brackets around cached IPv6 IP addresses
Fixes #1005
1 parent 1c9924e commit 59c3d51

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

dnscrypt-proxy/xtransport.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ func (xTransport *XTransport) rebuildTransport() {
133133
ipOnly := host
134134
cachedIP, ok := xTransport.loadCachedIP(host, false)
135135
if ok {
136-
ipOnly = cachedIP.String()
136+
if ipv4 := cachedIP.To4(); ipv4 != nil {
137+
ipOnly = ipv4.String()
138+
} else {
139+
ipOnly = "[" + cachedIP.String() + "]"
140+
}
137141
} else {
138142
dlog.Debugf("[%s] IP address was not cached", host)
139143
}

0 commit comments

Comments
 (0)