dialer: use KeepAliveConfig for TCP keepalive

This commit is contained in:
世界
2026-02-27 14:02:58 +08:00
parent 53853e9ae1
commit f2ec82dd2a
3 changed files with 32 additions and 2 deletions
+1 -2
View File
@@ -142,8 +142,7 @@ func NewDefault(ctx context.Context, options option.DialerOptions) (*DefaultDial
dialer.Timeout = C.TCPConnectTimeout
}
// TODO: Add an option to customize the keep alive period
dialer.KeepAlive = C.TCPKeepAliveInitial
dialer.Control = control.Append(dialer.Control, control.SetKeepAlivePeriod(C.TCPKeepAliveInitial, C.TCPKeepAliveInterval))
setKeepAliveConfig(&dialer, C.TCPKeepAliveInitial, C.TCPKeepAliveInterval)
var udpFragment bool
if options.UDPFragment != nil {
udpFragment = *options.UDPFragment