summaryrefslogtreecommitdiffhomepage
path: root/conn_default.go
diff options
context:
space:
mode:
Diffstat (limited to 'conn_default.go')
-rw-r--r--conn_default.go46
1 files changed, 0 insertions, 46 deletions
diff --git a/conn_default.go b/conn_default.go
index 9b2325c..862032d 100644
--- a/conn_default.go
+++ b/conn_default.go
@@ -8,10 +8,8 @@
package main
import (
- "golang.org/x/sys/unix"
"net"
"os"
- "runtime"
"syscall"
)
@@ -171,47 +169,3 @@ func (bind *NativeBind) Send(buff []byte, endpoint Endpoint) error {
}
return err
}
-
-var fwmarkIoctl int
-
-func init() {
- switch runtime.GOOS {
- case "linux", "android":
- fwmarkIoctl = 36 /* unix.SO_MARK */
- case "freebsd":
- fwmarkIoctl = 0x1015 /* unix.SO_USER_COOKIE */
- case "openbsd":
- fwmarkIoctl = 0x1021 /* unix.SO_RTABLE */
- }
-}
-
-func (bind *NativeBind) SetMark(mark uint32) error {
- if fwmarkIoctl == 0 {
- return nil
- }
- if bind.ipv4 != nil {
- fd, err := bind.ipv4.SyscallConn()
- if err != nil {
- return err
- }
- err = fd.Control(func(fd uintptr) {
- err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, fwmarkIoctl, int(mark))
- })
- if err != nil {
- return err
- }
- }
- if bind.ipv6 != nil {
- fd, err := bind.ipv6.SyscallConn()
- if err != nil {
- return err
- }
- err = fd.Control(func(fd uintptr) {
- err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, fwmarkIoctl, int(mark))
- })
- if err != nil {
- return err
- }
- }
- return nil
-}