feat(quic): NAT traversal observability (rebind diagnostics + active sessions) - #21
feat(quic): NAT traversal observability (rebind diagnostics + active sessions)#21David Mireles (louzt) wants to merge 2 commits into
Conversation
Adds §Layer 0: SnapPipe-gated QUIC to OPERATIONAL-DEPLOYMENT.md. Cross-links to the 5-tier gist case study and to src/relay/listener.rs. Documents the ordered operations: 5-tier fallback → SnapPipe relay accept loop → server_handshake on stream 0 → streams 1..N forwarded. No code changes.
… metrics D1: RebindDiagnostics struct (AtomicU64/I64 counters) + spawn_observer that polls conn.stats() periodically to detect local IP changes, RTT min/max, and UDP throughput. Uses Quinn 0.11.9 ConnectionStats API (stats.path field, stats.udp_rx.bytes, conn.local_ip()). D2: SessionMetrics struct exposing 5 atomic handshake outcome counters (successful, expired_or_invalid, issuer_not_trusted, subject_mismatch, other_errors). Module docstring updated with NAT rebinding tolerance section referencing QuicTransportProfile keep_alive_interval_ms. D3: Relay.active_sessions() counter incremented before handle_connection starts and decremented when it finishes (including early rejection paths). Uses AtomicU64 with Relaxed ordering. All changes additive. No existing APIs modified.
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
NAT Traversal Observability — 3 additive changes
SnapPipe v0.2.1 exposes three new lock-free observability surfaces for QUIC
path migration and NAT rebinding events.
D1:
feat(quic): path-rebind diagnostic surfaceFiles:
src/quic/rebind.rs(new),src/quic/mod.rs,tests/quic_rebind_diagnostics.rsQUIC connections silently migrate paths (laptop Wi-Fi → 5G, carrier NAT rebinding).
Quinn does not surface a typed "path changed" event. The correct strategy is
periodic polling of
ConnectionStats.RebindDiagnosticsexposes lock-free counters:poll_count— total polls performedrx_bytes/tx_bytes— UDP bytes received/transmitted (fromstats.udp_rx.bytes)rtt_min_us/rtt_max_us— min/max RTT observed (fromstats.path.rtt)rebind_count— incremented when local IP address hash changes between pollslast_local_addr_hash— previous local IP hash for change detectionspawn_observer(conn, interval, diag, cancel)pollsconn.stats()everyintervaland callsdiag.record_poll().Quinn 0.11.9 API used:
conn.stats() -> ConnectionStatswherestats.path: PathStats(field, not method)stats.udp_rx.bytes/stats.udp_tx.bytes: u64stats.path.rtt: Durationconn.local_ip() -> Option<IpAddr>D2:
feat(session): NAT rebinding tolerance observabilityFiles:
src/session.rsSessionMetricsexposes 5 atomic handshake outcome counters:successful— ticket valid, issuer trusted, subject matchedexpired_or_invalid— ticket expired or signature invalidissuer_not_trusted— issuer not in trust storesubject_mismatch— subject did not matchother_errors— protocol error or I/O failureComplements
RebindDiagnostics(transport layer) with handshake outcomeobservability (session layer).
The module docstring now includes a "NAT rebinding tolerance" section
documenting how
QuicTransportProfile::keep_alive_interval_msandRebindDiagnosticstogether give operators visibility into path migrations.D3:
feat(metrics): relay-side active-sessions counterFiles:
src/relay/mod.rsRelaynow tracksactive_sessions: Arc<AtomicU64>. The counter isincremented before
handle_connectionstarts and decremented when itfinishes (including early rejection paths: trust rejection, rate limiting).
Relay::active_sessions() -> u64exposes the current count.Scope boundary
SessionMetricsis declared but not yet instantiated (increment site isa future change to the session handshake)
Validation
Dependencies
feat(relay): real Quinn socket listener, already merged)