mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-09-26 12:14:17 -04:00
Allow IP address is passed as domain in socks5 protocol
This commit is contained in:
@@ -2,6 +2,7 @@ package protocol
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net"
|
||||
|
||||
"github.com/v2ray/v2ray-core/common/alloc"
|
||||
"github.com/v2ray/v2ray-core/common/log"
|
||||
@@ -267,7 +268,12 @@ func (request *Socks5Request) Destination() v2net.Destination {
|
||||
case AddrTypeIPv6:
|
||||
address = v2net.IPAddress(request.IPv6[:], request.Port)
|
||||
case AddrTypeDomain:
|
||||
address = v2net.DomainAddress(request.Domain, request.Port)
|
||||
maybeIP := net.ParseIP(request.Domain)
|
||||
if maybeIP != nil {
|
||||
address = v2net.IPAddress(maybeIP, request.Port)
|
||||
} else {
|
||||
address = v2net.DomainAddress(request.Domain, request.Port)
|
||||
}
|
||||
default:
|
||||
panic("Unknown address type")
|
||||
}
|
||||
|
Reference in New Issue
Block a user