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 <james@tailscale.com>
This commit is contained in:
James Tucker 2025-01-21 13:17:21 -08:00
parent 51adaec35a
commit 900b64403d
No known key found for this signature in database

View File

@ -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()
}