20672be48c16c52c7ddca4df08bf1bfa77edfe6c
Structural rationale: alktty's 5-byte header is a sub-demux key for five logical streams sharing one BiStream; a tunnel has exactly one data stream per direction, so no type byte. TCP needs no length prefix (channels already length-prefixes every chunk). UDP needs boundary re-framing only, and u16 suffices (UDP max payload 65507). Wire overhead table: tunnel TCP = 8 B/chunk total (channels header only), tunnel UDP = 10 B/datagram, vs alktty's 13 B. udpgw calibration: 5 B + per-datagram address. Trade-offs accepted: no in-band control path for TCP channels ever (post-ADR-049 this is clean; escape hatch = new ALPN, not a wire change); sentinel collision does not exist (UDP len=0 = empty datagram, legal; EOF is the channels-level sentinel on the BiStream at a different layer); future multi-endpoint UDP gateway framing lives inside datagram payloads (udpgw precedent). Residual for the Phase 1 codec ADR: empty-datagram semantics; u16 BE over varint (leaned, MTU-bounded anyway).
Languages
Rust
98.3%
Python
1.5%
Shell
0.2%