fix SO_MARK on non-linux OS
This commit is contained in:
parent
bbeaafc897
commit
ca632e8909
2
Makefile
2
Makefile
@ -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 \
|
||||
|
4
chain.go
4
chain.go
@ -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
7
sockopts_linux.go
Normal 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
7
sockopts_other.go
Normal file
@ -0,0 +1,7 @@
|
||||
//go:build !linux
|
||||
|
||||
package gost
|
||||
|
||||
func setSocketMark(fd int, value int) (e error) {
|
||||
return nil
|
||||
}
|
Loading…
Reference in New Issue
Block a user