trim space before parsing address

pull/1713/head
Darien Raymond 2017-12-11 00:41:40 +01:00
parent 742d9d25d1
commit 03403bb66b
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 2 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package net
import (
"net"
"strings"
"v2ray.com/core/app/log"
"v2ray.com/core/common/predicate"
@ -78,6 +79,7 @@ func ParseAddress(addr string) Address {
if lenAddr > 0 && addr[0] == '[' && addr[lenAddr-1] == ']' {
addr = addr[1 : lenAddr-1]
}
addr = strings.TrimSpace(addr)
ip := net.ParseIP(addr)
if ip != nil {