Skip to content

Commit 0bf50d1

Browse files
fixed tcp timeout and incorrect warning
1 parent fba55ba commit 0bf50d1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

gohpts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ func New(conf *Config) *proxyapp {
804804
p.logger.Fatal().Msg("Cannot specify TPRoxy and TProxyOnly at the same time")
805805
} else if runtime.GOOS == "linux" && conf.TProxyMode != "" && !slices.Contains(SupportedTProxyModes, conf.TProxyMode) {
806806
p.logger.Fatal().Msg("Incorrect TProxyMode provided")
807-
} else if runtime.GOOS != "linux" {
807+
} else if runtime.GOOS != "linux" && (conf.TProxy != "" || conf.TProxyOnly != "" || conf.TProxyMode != "") {
808808
conf.TProxy = ""
809809
conf.TProxyOnly = ""
810810
conf.TProxyMode = ""

tproxy_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func newTproxyServer(pa *proxyapp) *tproxyServer {
3535
Control: func(network, address string, conn syscall.RawConn) error {
3636
var operr error
3737
if err := conn.Control(func(fd uintptr) {
38-
operr = unix.SetsockoptInt(int(fd), unix.IPPROTO_TCP, unix.TCP_USER_TIMEOUT, int(timeout*1000))
38+
operr = unix.SetsockoptInt(int(fd), unix.IPPROTO_TCP, unix.TCP_USER_TIMEOUT, int(timeout.Milliseconds()))
3939
operr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR, 1)
4040
if ts.pa.tproxyMode == "tproxy" {
4141
operr = unix.SetsockoptInt(int(fd), unix.SOL_IP, unix.IP_TRANSPARENT, 1)

0 commit comments

Comments
 (0)