Files
tailscale/net
James Tucker d6211abfb2 net/udprelay,feature/relayserver,client/local: make endpoint lifetimes configurable
The bind and steady state endpoint lifetimes were hardcoded to 30s and
5m, which makes tests reproducing relay-session-reap scenarios, e.g.
in-process magicsock e2e tests and natlab VM tests for #20082 (black
hole following relay session reap), take 5+ minutes of wall time.

Add Server.SetLifetimes, which validates the new values and pokes the
endpoint GC loop to reset its ticker so they take effect immediately,
and a SetLifetimesForTest wrapper for brevity in in-process tests. For
tests that run tailscaled as a separate process, e.g. natlab VM tests,
expose it at runtime via a PermitWrite-gated LocalAPI debug endpoint,
debug-peer-relay-server-lifetimes, mirroring the existing
debug-peer-relay-sessions plumbing through the relayserver extension,
with a corresponding client/local method. A LocalAPI hook is preferred
over env knobs as it is per-instance and parallel-test-safe, and works
after the relay server is started via the RelayServerPort pref.
Production behavior is unchanged unless the hook is used.

Updates #20082

Change-Id: I827c54b222a268cbdb90c41febfe95ae3f2295f2
Signed-off-by: James Tucker <james@tailscale.com>
2026-06-11 02:44:56 +00:00
..