mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 15:36:41 -05:00
make Codacy/PR Quality Review happy
This commit is contained in:
parent
8c6dac924c
commit
e176746d03
@ -53,7 +53,7 @@ func (nl *pfiocNatlook) setPort(remote, local int) {
|
||||
binary.BigEndian.PutUint16((*[2]byte)(unsafe.Pointer(&nl.Dport))[:], uint16(local))
|
||||
}
|
||||
|
||||
// use ioctl to read original destination from /dev/pf
|
||||
// OriginalDst uses ioctl to read original destination from /dev/pf
|
||||
func OriginalDst(la, ra net.Addr) (net.IP, int, error) {
|
||||
f, err := os.Open("/dev/pf")
|
||||
if err != nil {
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"v2ray.com/core/transport/internet"
|
||||
)
|
||||
|
||||
// GetOriginalDestination
|
||||
// GetOriginalDestination from tcp conn
|
||||
func GetOriginalDestination(conn internet.Connection) (net.Destination, error) {
|
||||
la := conn.LocalAddr()
|
||||
ra := conn.RemoteAddr()
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
"v2ray.com/core/transport/internet"
|
||||
)
|
||||
|
||||
// RetrieveOriginalDest
|
||||
// RetrieveOriginalDest from stored laddr, caddr
|
||||
func RetrieveOriginalDest(oob []byte) net.Destination {
|
||||
dec := gob.NewDecoder(bytes.NewBuffer(oob))
|
||||
var la, ra net.UDPAddr
|
||||
@ -24,7 +24,7 @@ func RetrieveOriginalDest(oob []byte) net.Destination {
|
||||
return net.UDPDestination(net.IPAddress(ip), net.Port(port))
|
||||
}
|
||||
|
||||
// store laddr, caddr for later use
|
||||
// ReadUDPMsg stores laddr, caddr for later use
|
||||
func ReadUDPMsg(conn *net.UDPConn, payload []byte, oob []byte) (int, int, int, *net.UDPAddr, error) {
|
||||
nBytes, addr, err := conn.ReadFromUDP(payload)
|
||||
var buf bytes.Buffer
|
||||
|
Loading…
Reference in New Issue
Block a user