Browse Source

fix SO_MARK on non-linux OS

pull/817/head
ginuerzh 4 years ago
parent
commit
ca632e8909
  1. 2
      Makefile
  2. 4
      chain.go
  3. 7
      sockopts_linux.go
  4. 7
      sockopts_other.go

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

@ -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

@ -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

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