fix: destination should unmap before find interface

This commit is contained in:
wwqgtxx
2025-05-27 18:26:35 +08:00
parent 60ae9dce56
commit 33590c4066
2 changed files with 2 additions and 2 deletions

View File

@@ -73,7 +73,7 @@ func ListenPacket(ctx context.Context, network, address string, rAddrPort netip.
}
if opt.interfaceName == "" {
if finder := DefaultInterfaceFinder.Load(); finder != nil {
opt.interfaceName = finder.FindInterfaceName(rAddrPort.Addr())
opt.interfaceName = finder.FindInterfaceName(rAddrPort.Addr().Unmap())
}
}
if rAddrPort.Addr().Unmap().IsLoopback() {

View File

@@ -408,7 +408,7 @@ func Dial(network, address string) (*TCPConn, error) {
ifaceName := dialer.DefaultInterface.Load()
if ifaceName == "" {
if finder := dialer.DefaultInterfaceFinder.Load(); finder != nil {
ifaceName = finder.FindInterfaceName(rAddrPort.Addr())
ifaceName = finder.FindInterfaceName(rAddrPort.Addr().Unmap())
}
}
if len(ifaceName) > 0 {