Fix some ipv4 in v6 issues

This commit is contained in:
Owen
2025-12-01 17:54:38 -05:00
parent 2256d1f041
commit cd466ac43f
2 changed files with 23 additions and 1 deletions

View File

@@ -371,6 +371,10 @@ func (s *WireGuardService) runDirectUDPRelay(listener net.PacketConn) {
var srcAddrPort netip.AddrPort
if udpAddr, ok := remoteAddr.(*net.UDPAddr); ok {
srcAddrPort = udpAddr.AddrPort()
// Unmap IPv4-in-IPv6 addresses to ensure consistency with parsed endpoints
if srcAddrPort.Addr().Is4In6() {
srcAddrPort = netip.AddrPortFrom(srcAddrPort.Addr().Unmap(), srcAddrPort.Port())
}
} else {
logger.Debug("Unexpected address type in relay: %T", remoteAddr)
continue