Fix 2.0.6 ipv6 attach port (#237)

* fix-2.0.6-ipv6-attach-port
This commit is contained in:
bleeee 2018-03-18 05:39:46 +08:00 committed by Frank Denis
parent fd51ff8fb6
commit 86fb695189
1 changed files with 1 additions and 1 deletions

View File

@ -99,7 +99,7 @@ func newDNSCryptServerStamp(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)
}