fix SO_MARK on non-linux OS

This commit is contained in:
ginuerzh 2022-04-07 22:43:12 +08:00
parent bbeaafc897
commit ca632e8909
4 changed files with 15 additions and 5 deletions

View File

@ -2,7 +2,7 @@ NAME=gost
BINDIR=bin
VERSION=$(shell cat gost.go | grep 'Version =' | sed 's/.*\"\(.*\)\".*/\1/g')
GOBUILD=CGO_ENABLED=0 go build --ldflags="-s -w" -v -x -a
GOFILES=cmd/gost/*
GOFILES=cmd/gost/*.go
PLATFORM_LIST = \
darwin-amd64 \

View File

@ -133,10 +133,6 @@ func (c *Chain) DialContext(ctx context.Context, network, address string, opts .
return
}
func setSocketMark(fd int, value int) (e error) {
return syscall.SetsockoptInt(fd, syscall.SOL_SOCKET, syscall.SO_MARK, value)
}
func (c *Chain) dialWithOptions(ctx context.Context, network, address string, options *ChainOptions) (net.Conn, error) {
if options == nil {
options = &ChainOptions{}

7
sockopts_linux.go Normal file
View File

@ -0,0 +1,7 @@
package gost
import "syscall"
func setSocketMark(fd int, value int) (e error) {
return syscall.SetsockoptInt(fd, syscall.SOL_SOCKET, syscall.SO_MARK, value)
}

7
sockopts_other.go Normal file
View File

@ -0,0 +1,7 @@
//go:build !linux
package gost
func setSocketMark(fd int, value int) (e error) {
return nil
}