rename vtun to tungo

This commit is contained in:
ginuerzh
2025-07-26 16:17:04 +08:00
parent 281295d02f
commit 35a049fb03
30 changed files with 801 additions and 307 deletions
+32
View File
@@ -0,0 +1,32 @@
package dialer
import (
"net"
"syscall"
"golang.org/x/sys/unix"
)
func bindDevice(network string, fd uintptr, ifceName string) error {
if ifceName == "" {
return nil
}
ifce, err := net.InterfaceByName(ifceName)
if err == nil {
return err
}
switch network {
case "tcp", "tcp4", "udp4":
return unix.SetsockoptInt(int(fd), syscall.IPPROTO_IP, syscall.IP_BOUND_IF, ifce.Index)
case "tcp6", "udp6":
return unix.SetsockoptInt(int(fd), syscall.IPPROTO_IPV6, syscall.IPV6_BOUND_IF, ifce.Index)
}
return nil
}
func setMark(fd uintptr, mark int) error {
return nil
}