Fix: PacketConn's internal remote address is overwritten (#2727)
When using vmess + fake-ip, after receiving the first UDP response, PacketConn's internal address will be rewritten to fake-ip, causing all subsequent sending operations to return "ErrUDPRemoteAddrMismatch". Signed-off-by: Hackerl <490021209@qq.com>
This commit is contained in:
parent
4c3c64a34a
commit
10dcb7a3ad
@ -39,7 +39,7 @@ func handleUDPToLocal(packet C.UDPPacket, pc net.PacketConn, key string, oAddr,
|
||||
return
|
||||
}
|
||||
|
||||
fromUDPAddr := from.(*net.UDPAddr)
|
||||
fromUDPAddr := *from.(*net.UDPAddr)
|
||||
if fAddr.IsValid() {
|
||||
fromAddr, _ := netip.AddrFromSlice(fromUDPAddr.IP)
|
||||
fromAddr = fromAddr.Unmap()
|
||||
@ -48,7 +48,7 @@ func handleUDPToLocal(packet C.UDPPacket, pc net.PacketConn, key string, oAddr,
|
||||
}
|
||||
}
|
||||
|
||||
_, err = packet.WriteBack(buf[:n], fromUDPAddr)
|
||||
_, err = packet.WriteBack(buf[:n], &fromUDPAddr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user