1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-25 17:05:23 +00:00

make Codacy/PR Quality Review happy

This commit is contained in:
lucifer9 2020-02-14 11:11:33 +08:00 committed by kslr
parent 8c6dac924c
commit e176746d03
3 changed files with 4 additions and 4 deletions

View File

@ -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 {

View File

@ -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()

View File

@ -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