mirror of https://github.com/v2ray/v2ray-core
trim space before parsing address
parent
742d9d25d1
commit
03403bb66b
|
@ -2,6 +2,7 @@ package net
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"v2ray.com/core/app/log"
|
"v2ray.com/core/app/log"
|
||||||
"v2ray.com/core/common/predicate"
|
"v2ray.com/core/common/predicate"
|
||||||
|
@ -78,6 +79,7 @@ func ParseAddress(addr string) Address {
|
||||||
if lenAddr > 0 && addr[0] == '[' && addr[lenAddr-1] == ']' {
|
if lenAddr > 0 && addr[0] == '[' && addr[lenAddr-1] == ']' {
|
||||||
addr = addr[1 : lenAddr-1]
|
addr = addr[1 : lenAddr-1]
|
||||||
}
|
}
|
||||||
|
addr = strings.TrimSpace(addr)
|
||||||
|
|
||||||
ip := net.ParseIP(addr)
|
ip := net.ParseIP(addr)
|
||||||
if ip != nil {
|
if ip != nil {
|
||||||
|
|
Loading…
Reference in New Issue