From 900b64403d097ac7260fa18cff1ec718ec2b39c7 Mon Sep 17 00:00:00 2001 From: James Tucker Date: Tue, 21 Jan 2025 13:17:21 -0800 Subject: [PATCH] cmd/natc: send TCP keepalives to upstreams Idle connections may silently close, detect those closures with TCP keeliave. Updates tailscale/corp#25169 Signed-off-by: James Tucker --- cmd/natc/natc.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/natc/natc.go b/cmd/natc/natc.go index d94523c6e..5df060f76 100644 --- a/cmd/natc/natc.go +++ b/cmd/natc/natc.go @@ -475,7 +475,8 @@ func proxyTCPConn(c net.Conn, dest string) { }, } p.AddRoute(addrPortStr, &tcpproxy.DialProxy{ - Addr: fmt.Sprintf("%s:%s", dest, port), + Addr: fmt.Sprintf("%s:%s", dest, port), + KeepAlivePeriod: time.Second, }) p.Start() }