1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-17 09:56:18 -05:00

use net.ParseAddress in socks udp

This commit is contained in:
Darien Raymond 2016-02-05 10:23:16 +00:00
parent 4d2bcda9cc
commit c618ce543c

View File

@ -75,12 +75,7 @@ func ReadUDPRequest(packet []byte) (*Socks5UDPRequest, error) {
} }
domain := string(packet[5 : 5+domainLength]) domain := string(packet[5 : 5+domainLength])
request.Port = v2net.PortFromBytes(packet[5+domainLength : 5+domainLength+2]) request.Port = v2net.PortFromBytes(packet[5+domainLength : 5+domainLength+2])
maybeIP := net.ParseIP(domain) request.Address = v2net.ParseAddress(domain)
if maybeIP != nil {
request.Address = v2net.IPAddress(maybeIP)
} else {
request.Address = v2net.DomainAddress(domain)
}
dataBegin = 5 + domainLength + 2 dataBegin = 5 + domainLength + 2
default: default:
log.Warning("Unknown address type ", addrType) log.Warning("Unknown address type ", addrType)