Skip to content

Commit

Permalink
fix SO_MARK on non-linux OS
Browse files Browse the repository at this point in the history
  • Loading branch information
ginuerzh committed Apr 7, 2022
1 parent bbeaafc commit ca632e8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
4 changes: 0 additions & 4 deletions chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
7 changes: 7 additions & 0 deletions sockopts_linux.go
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions sockopts_other.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build !linux

package gost

func setSocketMark(fd int, value int) (e error) {
return nil
}

0 comments on commit ca632e8

Please sign in to comment.