All checks were successful
Go Build Multi-Platform / build (amd64, windows) (push) Successful in 34s
Go Build Multi-Platform / build (amd64, freebsd) (push) Successful in 38s
Go Build Multi-Platform / build (amd64, linux) (push) Successful in 37s
Go Build Multi-Platform / build (arm, freebsd) (push) Successful in 32s
Go Build Multi-Platform / build (arm, linux) (push) Successful in 35s
Go Build Multi-Platform / build (arm64, darwin) (push) Successful in 34s
Go Build Multi-Platform / build (arm, windows) (push) Successful in 37s
Go Build Multi-Platform / build (arm64, freebsd) (push) Successful in 42s
Go Build Multi-Platform / Create Release (push) Has been skipped
Go Test Multi-Platform / Test (ubuntu-latest, amd64) (push) Successful in 1m29s
Go Revive Lint / lint (push) Successful in 47s
Run Gosec / tests (push) Successful in 1m3s
Go Build Multi-Platform / build (amd64, darwin) (push) Successful in 27s
Go Build Multi-Platform / build (arm64, linux) (push) Successful in 44s
Go Build Multi-Platform / build (arm64, windows) (push) Successful in 42s
Go Test Multi-Platform / Test (ubuntu-latest, arm64) (push) Successful in 1m5s
40 lines
881 B
Go
40 lines
881 B
Go
// +build openbsd
|
|
|
|
package interfaces
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
"time"
|
|
|
|
"git.quad4.io/Networks/Reticulum-Go/pkg/debug"
|
|
)
|
|
|
|
func (tc *TCPClientInterface) setTimeoutsLinux() error {
|
|
tcpConn, ok := tc.conn.(*net.TCPConn)
|
|
if !ok {
|
|
return fmt.Errorf("not a TCP connection")
|
|
}
|
|
|
|
if err := tcpConn.SetKeepAlive(true); err != nil {
|
|
return fmt.Errorf("failed to enable keepalive: %v", err)
|
|
}
|
|
|
|
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)
|
|
}
|
|
|
|
debug.Log(debug.DEBUG_VERBOSE, "TCP keepalive configured (OpenBSD)", "i2p", tc.i2pTunneled)
|
|
return nil
|
|
}
|
|
|
|
func (tc *TCPClientInterface) setTimeoutsOSX() error {
|
|
return tc.setTimeoutsLinux()
|
|
}
|
|
|