chore: optimize codes (golint) and github actions

This commit is contained in:
nadoo committed 2021-12-25 17:55:39 +08:00
1 parent 40f75ef38b
commit 5b1a127d04
3 files changed
+8 -3

No files matched your search

+1 -3
View File
@@ -10,8 +10,6 @@ import (
"golang.org/x/sys/unix"
)
const IPV6_RECVORIGDSTADDR = 0x4a
// ref: https://github.com/LiamHaworth/go-tproxy/blob/master/tproxy_udp.go
// MIT License by @LiamHaworth
@@ -65,7 +63,7 @@ func ReadFromUDP(conn *net.UDPConn, b []byte) (int, *net.UDPAddr, *net.UDPAddr,
port := binary.BigEndian.Uint16(msg.Data[2:4])
return n, addr, &net.UDPAddr{IP: ip, Port: int(port)}, nil
}
if msg.Header.Level == syscall.SOL_IPV6 && msg.Header.Type == IPV6_RECVORIGDSTADDR {
if msg.Header.Level == syscall.SOL_IPV6 && msg.Header.Type == unix.IPV6_RECVORIGDSTADDR {
ip := net.IP(msg.Data[8:24])
port := binary.BigEndian.Uint16(msg.Data[2:4])
return n, addr, &net.UDPAddr{IP: ip, Port: int(port)}, nil