feat(wind-tuic): ActiveConnections registry for per-user limits + kick#31
Merged
Conversation
… kick Add an optional live-connection registry to the TUIC server core so a host binary can enforce a per-user concurrent-connection limit (count_for) and actively kick a user's live connections (kick_user) - e.g. when a panel removes or rekeys a user. Each authenticated connection registers its cancel token in serve_connection (after the on_authenticated veto) and deregisters on close; cancelling the token trips the existing shutdown path and closes the QUIC connection. Threaded through both the quinn and quiche backends as an Option-defaulting field, so existing callers (e.g. the reference tuic-server) are unaffected. dashmap backs the registry, gated behind the server feature. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional live-connection registry to the TUIC server core so a host binary can:
ActiveConnections::count_for), andActiveConnections::kick_user) — e.g. when a panel removes or rekeys a user.How it works
wind_tuic::ActiveConnections(DashMap<conn_id, (UserId, CancellationToken)>), gated behind theserverfeature.serve_connectionregisters each connection after theon_authenticatedveto (so a per-user limit check counts only the user's other live connections) and deregisters on close. Cancelling the stored token trips the existing shutdown path, which closes the QUIC connection.Option-defaulting field, so existing callers (e.g. the referencetuic-server) are unaffected.Testing
cargo test -p wind-tuic(incl. the newactive::tests::count_and_kick)cargo build -p tuic-serverandcargo build -p wind-tuic --features quicheboth green.🤖 Generated with Claude Code