From fc5c9b931b429908c4f68af4b4cb93e55339c5f8 Mon Sep 17 00:00:00 2001 From: Dreamacro <8615343+Dreamacro@users.noreply.github.com> Date: Wed, 29 Jun 2022 23:36:24 +0800 Subject: [PATCH] Fix: try to unmap lAddr on tproxy udp listener --- listener/tproxy/udp.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/listener/tproxy/udp.go b/listener/tproxy/udp.go index 60783563..0e7c059f 100644 --- a/listener/tproxy/udp.go +++ b/listener/tproxy/udp.go @@ -72,6 +72,11 @@ func NewUDP(addr string, in chan<- *inbound.PacketAdapter) (*UDPListener, error) if err != nil { continue } + + if rAddr.Addr().Is4() { + // try to unmap 4in6 address + lAddr = netip.AddrPortFrom(lAddr.Addr().Unmap(), lAddr.Port()) + } handlePacketConn(in, buf[:n], lAddr, rAddr) } }()