replace xnet.Transport by xnet.Pipe

This commit is contained in:
ginuerzh
2025-07-28 20:52:15 +08:00
parent 35a049fb03
commit 208d18125c
52 changed files with 468 additions and 104 deletions
+9 -1
View File
@@ -1,13 +1,21 @@
package dialer
import (
"net"
"golang.org/x/sys/unix"
)
func bindDevice(network string, fd uintptr, ifceName string) error {
func bindDevice(network, address string, fd uintptr, ifceName string) error {
if ifceName == "" {
return nil
}
host, _, _ := net.SplitHostPort(address)
if ip := net.ParseIP(host); ip != nil && !ip.IsGlobalUnicast() {
return nil
}
return unix.BindToDevice(int(fd), ifceName)
}