chore: support IN-PORT rule
This commit is contained in:
@ -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()
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
|
Reference in New Issue
Block a user