Skip to content

Customizable variadic length connection id for client - #2542

Open
anatawa12 wants to merge 5 commits into
cloudflare:masterfrom
anatawa12:customizable-variadic-length-connection-id
Open

Customizable variadic length connection id for client#2542
anatawa12 wants to merge 5 commits into
cloudflare:masterfrom
anatawa12:customizable-variadic-length-connection-id

Conversation

@anatawa12

Copy link
Copy Markdown

Closes #2541

@anatawa12
anatawa12 requested a review from a team as a code owner July 16, 2026 03:48
@zaczh

zaczh commented Jul 21, 2026

Copy link
Copy Markdown

Verified this against my use case — a MASQUE proxy on tokio-quiche 0.19.1 with an 8-byte server CID generator. With scid_len = 8 CONNECT-UDP round-trips fine including near-MTU datagrams; without it short-header packets get misrouted at the hardcoded MAX_CONN_ID_LEN, so the handshake completes but no data flows.

One API thought: scid_len duplicates info the router can already reach. It holds the SharedConnectionIdGenerator, so the length could be derived from the generator instead of a separate field the caller has to keep in sync:

// defaulted method on ConnectionIdGenerator
fn cid_len(&self) -> usize { MAX_CONN_ID_LEN }

then short_dcid(buf, self.cid_generator.cid_len()). Drops the mismatch footgun the field doc already warns about, and stays non-breaking. Needs to be a method rather than an assoc const since the generator is used behind dyn.

@anatawa12
anatawa12 force-pushed the customizable-variadic-length-connection-id branch from 0a0a7a0 to fe4479e Compare July 21, 2026 10:05
@anatawa12

Copy link
Copy Markdown
Author

@zaczh Thank you for feedback! My first use case was reducing client scid so directly using cid_len from ConnectionIdGenerator was not possible, but we have ConnectionId itself so we changed the code to derive scid_size from actual ConnectionId for client and ConnectionIdGenerator for server endpoint instead providing as separated parameter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: Customizable client-side connection id and non-20-byte connection id support for shorter connection id for smaller overhead

2 participants