Revert "Update udpant usages"

This commit is contained in:
世界 2024-11-27 18:04:39 +08:00
parent 59a6bdc1fa
commit 091b5da950
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
5 changed files with 8 additions and 22 deletions

View file

@ -37,16 +37,10 @@ func NewUDPForwarder(ctx context.Context, stack *stack.Stack, handler Handler, t
stack: stack,
handler: handler,
}
udpNat := udpnat.New(handler, forwarder.PreparePacketConnection, timeout, true)
udpNat.Start()
forwarder.udpNat = udpNat
forwarder.udpNat = udpnat.New(handler, forwarder.PreparePacketConnection, timeout, true)
return forwarder
}
func (f *UDPForwarder) Close() {
f.udpNat.Close()
}
func (f *UDPForwarder) HandlePacket(id stack.TransportEndpointID, pkt *stack.PacketBuffer) bool {
source := M.SocksaddrFrom(AddrFromAddress(id.RemoteAddress), id.RemotePort)
destination := M.SocksaddrFrom(AddrFromAddress(id.LocalAddress), id.LocalPort)