diff --git a/dnscrypt-proxy/stamps.go b/dnscrypt-proxy/stamps.go index 3f0f6c6a..eabd6552 100644 --- a/dnscrypt-proxy/stamps.go +++ b/dnscrypt-proxy/stamps.go @@ -99,7 +99,7 @@ func newDNSCryptServerStamp(bin []byte) (ServerStamp, error) { pos++ stamp.serverAddrStr = string(bin[pos : pos+len]) pos += len - if (net.ParseIP(strings.TrimRight(strings.TrimLeft(stamp.serverAddrStr, "["), "]"))) != nil { + if net.ParseIP(strings.TrimRight(strings.TrimLeft(stamp.serverAddrStr, "["), "]")) != nil { stamp.serverAddrStr = fmt.Sprintf("%s:%d", stamp.serverAddrStr, DefaultPort) } @@ -143,7 +143,7 @@ func newDoHServerStamp(bin []byte) (ServerStamp, error) { pos++ stamp.serverAddrStr = string(bin[pos : pos+len]) pos += len - if net.ParseIP(stamp.serverAddrStr) != nil { + if net.ParseIP(strings.TrimRight(strings.TrimLeft(stamp.serverAddrStr, "["), "]")) != nil { stamp.serverAddrStr = fmt.Sprintf("%s:%d", stamp.serverAddrStr, DefaultPort) }