Add server-side per-client bandwidth enforcement using TCP backpressure.
When configured, the server calls WaitN after reading each non-DISCO data
frame, which delays the next read, fills the TCP receive buffer, shrinks
the TCP window, and naturally throttles the sender — no packets are dropped.
Key design decisions:
- Rate limiting is on the receive (inbound) side, which is what an abusive
client controls
- DISCO frames are exempt since they are small control messages critical
for NAT traversal and direct connection establishment
- Mesh peers are exempt since they are trusted infrastructure
- The burst size is clamped to at least MaxPacketSize (64KB) to ensure a
single max-size frame can always be processed
- ServerInfo.TokenBucketBytesPerSecond/Burst are populated to inform
clients of the server-side limit
Also refactors sclient to store a context.Context directly instead of a
done channel, which simplifies the rate limiter's WaitN call.
Flags added to cmd/derper:
--per-client-rate-limit (bytes/sec, default 0 = unlimited)
--per-client-rate-burst (bytes, default 0 = 2x rate limit)
Example for 10Mbps: --per-client-rate-limit=1250000
Updates #38509
Signed-off-by: Mike O'Driscoll <mikeo@tailscale.com>