mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
chore: optimize codes (golint) and github actions
This commit is contained in:
1 parent
40f75ef38b
commit
5b1a127d04
3 files changed
+8
-3
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user