mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-03 07:56:42 -05:00
fix test break
This commit is contained in:
parent
5ef1a201f5
commit
e6ebbc245c
@ -26,13 +26,17 @@ func GetOriginalDestination(conn internet.Connection) (v2net.Destination, error)
|
|||||||
addr, err := syscall.GetsockoptIPv6Mreq(int(fd), syscall.IPPROTO_IP, SO_ORIGINAL_DST)
|
addr, err := syscall.GetsockoptIPv6Mreq(int(fd), syscall.IPPROTO_IP, SO_ORIGINAL_DST)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Trace(newError("failed to call getsockopt").Base(err))
|
log.Trace(newError("failed to call getsockopt").Base(err))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
ip := v2net.IPAddress(addr.Multiaddr[4:8])
|
ip := v2net.IPAddress(addr.Multiaddr[4:8])
|
||||||
port := uint16(addr.Multiaddr[2])<<8 + uint16(addr.Multiaddr[3])
|
port := uint16(addr.Multiaddr[2])<<8 + uint16(addr.Multiaddr[3])
|
||||||
dest = v2net.TCPDestination(ip, v2net.Port(port))
|
dest = v2net.TCPDestination(ip, v2net.Port(port))
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return v2net.Destination{}, newError("failed to get original destination").Base(err)
|
return v2net.Destination{}, newError("failed to control connection").Base(err)
|
||||||
|
}
|
||||||
|
if !dest.IsValid() {
|
||||||
|
return v2net.Destination{}, newError("failed to call getsockopt")
|
||||||
}
|
}
|
||||||
return dest, nil
|
return dest, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user