sing/common/control/mark_linux.go
2022-07-07 21:39:44 +08:00

17 lines
384 B
Go

package control
import (
"syscall"
E "github.com/sagernet/sing/common/exceptions"
)
func RoutingMark(mark int) Func {
return func(network, address string, conn syscall.RawConn) error {
var innerErr error
err := conn.Control(func(fd uintptr) {
innerErr = syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_MARK, mark)
})
return E.Errors(innerErr, err)
}
}