Status: Proposed
Date: 2026-10-05 (cross-reference updated 2026-11-29)
Context
RelayLink needed unicast UDP forwarding on top of its existing TCP architecture. Under ADR-0001 and ADR-0008, the Server-relayed TCP design already provides per-session authentication, one-time data binding tokens, the SQLite audit gate, resource quotas, and optional inner TLS for peer access. Exposing a brand-new public UDP data port on the Server relay plane would require designing and verifying separate packet authentication, anti-replay protection, NAT state tracking, and encryption protocols from scratch.
Decision
Standard cloud-ingress UDP and default peer-relayed UDP both create an independent source session keyed by (ingress, source IP, source port) and reuse existing per-session TCP data tunnels with 4-byte big-endian length framing to preserve datagram boundaries (0–65507 bytes). Authorized peer UDP keeps existing HMAC access proofs and optional inner TLS. Channels add transportProtocol and udpIdleTimeoutSeconds (defaulting to TCP when omitted), wire protocol v4+ carries UDP traffic, and newer Servers retain v3 TCP compatibility per ADR-0025. Existing raw TCP byte copying and half-close semantics remain unchanged. (When ADR-0043 later introduced optional preferDirect peer routing, direct unicast UDP over QUIC/ICE-TCP also reused this same 4-byte length framing over reliable streams.)
This ADR records the architectural tradeoff adopted in code. Because concrete defaults have not yet undergone standalone formal review, its status remains Proposed.
Alternatives Considered
| Option | Tradeoff |
|---|---|
| Native public UDP data plane on the Server | Closer to native UDP latency semantics, but requires bespoke packet authentication, encryption, anti-replay, and NAT mapping |
| Single multiplexed global tunnel | Reduces TCP socket count, but complicates per-source traffic isolation, fair scheduling, and fault containment |
| Standard cloud ingress only | Leaves authorized Agent-to-Agent peer access without UDP support |
Consequences
- Security and lifecycle reuse: Inherits existing client authentication, one-time binding, audit gates, quotas, and revocation paths.
- Per-source isolation and cleanup: Each source session exclusively consumes one data tunnel and one target UDP socket, requiring the bounded
32-datagram queue andudpIdleTimeoutSecondsidle reclamation. - Latency and scope limits: TCP retransmission introduces head-of-line blocking, so real-time UDP latency is not guaranteed. Broadcast, multicast, caller source-IP passthrough, and replay of dropped datagrams are excluded.
- Upgrade requirement: Agents participating in UDP forwarding must run wire protocol v4 or later; v3 Agents remain compatible for TCP.