github.com/sagernet/sing@v0.4.0-beta.19.0.20240518125136-f67a0988a636/common/control/mark_linux.go (about)

     1  package control
     2  
     3  import (
     4  	"syscall"
     5  )
     6  
     7  func RoutingMark(mark int) Func {
     8  	return func(network, address string, conn syscall.RawConn) error {
     9  		return Raw(conn, func(fd uintptr) error {
    10  			return syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_MARK, mark)
    11  		})
    12  	}
    13  }