wireguard-go/src/conn_linux.go

25 lines
307 B
Go
Raw Normal View History

2017-08-25 14:53:23 +02:00
package main
import (
"golang.org/x/sys/unix"
"net"
)
2017-09-21 03:09:57 +02:00
func setMark(conn *net.UDPConn, value uint32) error {
if conn == nil {
2017-08-25 14:53:23 +02:00
return nil
}
file, err := conn.File()
if err != nil {
return err
}
return unix.SetsockoptInt(
int(file.Fd()),
unix.SOL_SOCKET,
unix.SO_MARK,
2017-09-21 03:09:57 +02:00
int(value),
2017-08-25 14:53:23 +02:00
)
}