mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-01-04 00:23:43 +08:00
fix: tun udp with 4in6 ip
This commit is contained in:
parent
e6d16e458f
commit
d00d83abd4
@ -44,11 +44,12 @@ func handleUDPToLocal(packet C.UDPPacket, pc net.PacketConn, key string, oAddr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fromUDPAddr := from.(*net.UDPAddr)
|
fromUDPAddr := from.(*net.UDPAddr)
|
||||||
if fAddr.IsValid() {
|
fromUDPAddr = &(*fromUDPAddr) // make a copy
|
||||||
fromAddr, _ := netip.AddrFromSlice(fromUDPAddr.IP)
|
if fromAddr, ok := netip.AddrFromSlice(fromUDPAddr.IP); ok {
|
||||||
fromAddr.Unmap()
|
if fAddr.IsValid() && (oAddr.Unmap() == fromAddr.Unmap()) {
|
||||||
if oAddr == fromAddr {
|
fromUDPAddr.IP = fAddr.Unmap().AsSlice()
|
||||||
fromUDPAddr.IP = fAddr.AsSlice()
|
} else {
|
||||||
|
fromUDPAddr.IP = fromAddr.Unmap().AsSlice()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user