Remove superflous brackets; fix DoH default port as well

This commit is contained in:
Frank Denis 2018-03-17 14:43:26 -07:00
parent 86fb695189
commit 1f81710b91
1 changed files with 2 additions and 2 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(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)
}