feature/conn25: expire idle flows from FlowTable

Track lastSeen on each cached flow and add a sweeper goroutine
that periodically removes flows idle past the idle timeout.

Introduce tunables for idle timeout, maximum flows removed per sweep (to
limit mutex hold time), and the sweeper interval.

Also cap the previously-unlimited tables: 10k client flows, 100k
connector flows.

Updates tailscale/corp#38630

Signed-off-by: Michael Ben-Ami <mzb@tailscale.com>
This commit is contained in:
Michael Ben-Ami
2026-06-08 11:03:25 -04:00
committed by mzbenami
parent 65a117184b
commit 618b606b46
4 changed files with 286 additions and 17 deletions
+1
View File
@@ -134,6 +134,7 @@ func (e *extension) Init(host ipnext.Host) error {
ctx, cancel := context.WithCancelCause(context.Background())
e.ctxCancel = cancel
go e.sendLoop(ctx)
dph.StartFlowExpirySweepers(ctx)
return nil
}