Skip to content

feat: prove end-to-end QUIC packet path switching - #471

Open
0xcadams wants to merge 1 commit into
0xcadams/latency-01-evidencefrom
0xcadams/peer-packet-switching
Open

0xcadams wants to merge 1 commit into
0xcadams/latency-01-evidencefrom
0xcadams/peer-packet-switching

Conversation

@0xcadams

Copy link
Copy Markdown
Member

What

Add the first transport gate for the relay-first native rewrite: one end-to-end QUIC session keeps its application streams and real TCP target connection while encrypted packet delivery changes between two relays and direct UDP. This layer follows #455 and will feed the authorization and role migration layers below final integration PR #470.

Why

The existing relay stream forwarder cannot move an established application connection to P2P. The rewrite needs evidence that packet delivery can change without reconnecting a database or replaying application bytes, including when only TCP relay transport is available.

Changes

  • Add a shared transport-owned packet endpoint with warm relay fallback, authenticated direct-path probes, bounded queues, fixed fragment reassembly, and joined cancellation.
  • Keep the handwritten packet wire contract in tunnelv1 on protocol 1 and existing /1 ALPNs. Fragment 1200-byte inner packets into frames that fit minimum-size outer QUIC datagrams.
  • Prove relay A → direct → relay B and return through relay A using real QUIC datagram or TLS/TCP-yamux relay legs, a monotonic TCP application exchange, and preserved half-close. Also prove all-TCP fallback with direct UDP blocked throughout.
  • Bound one blocked TCP carrier to 64 queued frames (67,136 frame bytes) and independently recover through its sibling. Local race-qualified recovery was roughly 250–310 ms with a 150 ms path timeout; an unread TCP carrier escaped head-of-line blocking in roughly 100 ms under the shorter fault-test settings. These are local proof measurements.
  • Passed task go:test:peer-transport -- -race, task go:test, task go:lint, task generate-check, task format, and task format-check. Production integration adds shared-socket STUN/ICE, shared relay demultiplexing, and control-authorized lifetimes around this owner.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T18:05:40.809280Z 9454a33 PR opened
🔒 Security Review ✅ Completed 2026-10-26T18:07:16.658367Z 9454a33 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
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.

1 participant