mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-12-06 08:06:50 +00:00
Connections from newUpstreamDialer were dialed with net.Dialer{KeepAlive: 30s}. Go then keeps TCP_KEEPINTVL 15 s and TCP_KEEPCNT 9, so a peer that stops answering is declared dead 165 s after its last packet, and no TCP_USER_TIMEOUT is set.
The dialer now sets KeepAliveConfig{Idle 15 s, Interval 5 s, Count 3} and, on Linux, TCP_USER_TIMEOUT 30 s (idle + interval x count) through Dialer.Control. Other platforms keep the keep-alive configuration only.
SOCKS5 and TLS fingerprint transports keep their own dialers.
10 lines
287 B
Go
10 lines
287 B
Go
//go:build !linux
|
|
|
|
package repository
|
|
|
|
import "syscall"
|
|
|
|
// upstreamDialControl is nil off Linux: TCP_USER_TIMEOUT is a Linux socket
|
|
// option, and the keep-alive configuration alone bounds idle connections.
|
|
var upstreamDialControl func(network, address string, c syscall.RawConn) error
|