Update udp.go

This commit is contained in:
wwqgtxx 2025-04-03 23:51:27 +08:00 committed by GitHub
parent f63df4bdce
commit 3a773d9b87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -81,12 +81,13 @@ func NewUDP(addr string, tunnel C.Tunnel, additions ...inbound.Addition) (*UDPLi
}
dscp, _ := getDSCP(oob[:oobn])
additions := append(additions, inbound.WithDSCP(dscp)) // don't change outside additions
if rAddr.Addr().Is4() {
// try to unmap 4in6 address
lAddr = netip.AddrPortFrom(lAddr.Addr().Unmap(), lAddr.Port())
}
handlePacketConn(l, tunnel, buf[:n], lAddr, rAddr, append(additions, inbound.WithDSCP(dscp))...)
handlePacketConn(l, tunnel, buf[:n], lAddr, rAddr, additions...)
}
}()