mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-09-30 07:46:41 -04:00
handle IPv6 address in tproxy
This commit is contained in:
parent
c48e1f02a6
commit
0a91893a26
@ -25,10 +25,14 @@ func RetrieveOriginalDest(oob []byte) v2net.Destination {
|
||||
return v2net.Destination{}
|
||||
}
|
||||
for _, msg := range msgs {
|
||||
if msg.Header.Level == syscall.SOL_IP && msg.Header.Type == syscall.IP_ORIGDSTADDR {
|
||||
if msg.Header.Level == syscall.SOL_IP && msg.Header.Type == syscall.IP_RECVORIGDSTADDR {
|
||||
ip := v2net.IPAddress(msg.Data[4:8])
|
||||
port := v2net.PortFromBytes(msg.Data[2:4])
|
||||
return v2net.UDPDestination(ip, port)
|
||||
} else if msg.Header.Level == syscall.SOL_IPV6 && msg.Header.Type == syscall.IP_RECVORIGDSTADDR {
|
||||
ip := v2net.IPAddress(msg.Data[8:24])
|
||||
port := v2net.PortFromBytes(msg.Data[2:4])
|
||||
return v2net.UDPDestination(ip, port)
|
||||
}
|
||||
}
|
||||
return v2net.Destination{}
|
||||
|
Loading…
Reference in New Issue
Block a user