Fix parse socksaddr

This commit is contained in:
世界 2022-09-15 16:33:42 +08:00
parent 38f39bc0c6
commit a8e70a54fe
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -4,6 +4,7 @@ import (
"net"
"net/netip"
"strconv"
"strings"
"unsafe"
)
@ -171,6 +172,9 @@ func ParseAddr(s string) netip.Addr {
}
func ParseSocksaddr(address string) Socksaddr {
if !strings.Contains(address, ":") {
return ParseSocksaddrHostPort(address, 0)
}
host, port, err := net.SplitHostPort(address)
if err != nil {
return Socksaddr{}