mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2026-10-19 16:16:35 +00:00
19 lines
420 B
Go
19 lines
420 B
Go
package dialer
|
|
|
|
import (
|
|
"net"
|
|
"syscall"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func WithBindToInterface(_ *net.Interface) SocketOption { return UnsupportedSocketOption }
|
|
|
|
func WithRoutingMark(mark int) SocketOption {
|
|
return SocketOptionFunc(func(_, _ string, c syscall.RawConn) error {
|
|
return rawConnControl(c, func(fd uintptr) error {
|
|
return unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_RTABLE, mark)
|
|
})
|
|
})
|
|
}
|