remove default RTT implementation for non-Linux platforms and enhance keepalive period configuration for FreeBSD and Windows
Some checks failed
Go Build Multi-Platform / build (arm, linux) (push) Failing after 38s
Go Build Multi-Platform / build (arm, windows) (push) Failing after 33s
Go Build Multi-Platform / build (arm, freebsd) (push) Failing after 41s
Go Build Multi-Platform / build (arm64, darwin) (push) Failing after 31s
Go Build Multi-Platform / build (arm64, freebsd) (push) Failing after 22s
Go Build Multi-Platform / build (arm64, linux) (push) Failing after 29s
Go Build Multi-Platform / build (arm64, windows) (push) Failing after 37s
Go Build Multi-Platform / build (amd64, darwin) (push) Failing after 31s
Go Build Multi-Platform / build (amd64, freebsd) (push) Failing after 30s
Go Build Multi-Platform / build (amd64, linux) (push) Failing after 34s
Go Build Multi-Platform / build (amd64, windows) (push) Failing after 33s
Go Test Multi-Platform / Test (ubuntu-latest, arm64) (push) Successful in 1m0s
Go Build Multi-Platform / Create Release (push) Has been skipped
Go Revive Lint / lint (push) Successful in 48s
Go Test Multi-Platform / Test (ubuntu-latest, amd64) (push) Successful in 1m25s
Run Gosec / tests (push) Failing after 58s
Go Test Multi-Platform / Test (macos-latest, amd64) (push) Has been cancelled
Go Test Multi-Platform / Test (windows-latest, amd64) (push) Has been cancelled
Go Test Multi-Platform / Test (macos-latest, arm64) (push) Has been cancelled

This commit is contained in:
2025-11-20 18:14:57 -06:00
parent 189645940c
commit 24aa4fa88b
4 changed files with 14 additions and 14 deletions

View File

@@ -2,13 +2,3 @@
// +build !linux
package interfaces
import (
"time"
)
// platformGetRTT is defined in OS-specific files
// Default implementation for non-Linux platforms
func platformGetRTT(fd uintptr) time.Duration {
return 0
}

View File

@@ -20,7 +20,12 @@ func (tc *TCPClientInterface) setTimeoutsLinux() error {
return fmt.Errorf("failed to enable keepalive: %v", err)
}
if err := tcpConn.SetKeepAlivePeriod(TCP_PROBE_INTERVAL * time.Second); err != nil {
keepalivePeriod := TCP_PROBE_INTERVAL_SEC * time.Second
if tc.i2pTunneled {
keepalivePeriod = I2P_PROBE_INTERVAL_SEC * time.Second
}
if err := tcpConn.SetKeepAlivePeriod(keepalivePeriod); err != nil {
debug.Log(debug.DEBUG_VERBOSE, "Failed to set keepalive period", "error", err)
}

View File

@@ -86,8 +86,8 @@ func platformGetRTT(fd uintptr) time.Duration {
fd,
syscall.IPPROTO_TCP,
11, // TCP_INFO
uintptr(unsafe.Pointer(&info)),
uintptr(unsafe.Pointer(&infoLen)),
uintptr(unsafe.Pointer(&info)), //nolint:gosec
uintptr(unsafe.Pointer(&infoLen)), //nolint:gosec
0,
)

View File

@@ -26,7 +26,12 @@ func (tc *TCPClientInterface) setTimeoutsWindows() error {
return fmt.Errorf("failed to enable keepalive: %v", err)
}
if err := tcpConn.SetKeepAlivePeriod(TCP_PROBE_INTERVAL); err != nil {
keepalivePeriod := TCP_PROBE_INTERVAL_SEC * time.Second
if tc.i2pTunneled {
keepalivePeriod = I2P_PROBE_INTERVAL_SEC * time.Second
}
if err := tcpConn.SetKeepAlivePeriod(keepalivePeriod); err != nil {
debug.Log(debug.DEBUG_VERBOSE, "Failed to set keepalive period", "error", err)
}