chore: support IN-PORT rule

This commit is contained in:
wwqgtxx
2022-11-11 23:36:06 +08:00
parent 64be213b66
commit b2d7149a95
13 changed files with 60 additions and 14 deletions

View File

@ -7,6 +7,7 @@ import (
)
type packet struct {
pc net.PacketConn
lAddr *net.UDPAddr
buf []byte
}
@ -35,3 +36,7 @@ func (c *packet) LocalAddr() net.Addr {
func (c *packet) Drop() {
pool.Put(c.buf)
}
func (c *packet) InAddr() net.Addr {
return c.pc.LocalAddr()
}

View File

@ -81,6 +81,7 @@ func NewUDP(addr string, in chan<- *inbound.PacketAdapter) (*UDPListener, error)
func handlePacketConn(pc net.PacketConn, in chan<- *inbound.PacketAdapter, buf []byte, lAddr *net.UDPAddr, rAddr *net.UDPAddr) {
target := socks5.ParseAddrToSocksAddr(rAddr)
pkt := &packet{
pc: pc,
lAddr: lAddr,
buf: buf,
}