mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-07 17:51:16 +08:00
16 lines
265 B
Go
16 lines
265 B
Go
package dialer
|
|
|
|
import (
|
|
"syscall"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func setMark(i int) controlFunc {
|
|
return func(_, _ string, c syscall.RawConn) error {
|
|
return c.Control(func(fd uintptr) {
|
|
unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_MARK, i)
|
|
})
|
|
}
|
|
}
|