RELAYLINK

UDP forwarding requirements

Document ID: REQ-001L
Status: Draft
Version: v1.2.0
Updated: 2026-11-29
Requirement Date: 2026-10-05
Companion Design: UDP Forwarding Technical Design

1. Scope

This requirement extends RelayLink's TCP proxy and peer capabilities with unicast UDP forwarding across both standard cloud-ingress channels and authorized Agent-to-Agent mappings, forwarding datagrams to a fixed UDP host and port reachable by the target Agent. The specific defaults and limits below represent the current engineering specification and have not yet undergone standalone requirement sign-off, so the status remains Draft rather than auto-advancing to Done. Existing TCP behavior remains fully preserved.

RelayLink forwards unicast UDP payloads only. It does not provide broadcast, multicast, IP-layer overlay routing, original caller IP preservation, or generic service discovery. Dynamic ports returned by SQL Browser (UDP 1434) are neither parsed nor rewritten, and configuring UDP 1434 does not enable named-instance auto-discovery. Applications remain responsible for handling packet loss, timeouts, retries, and duplicate datagrams. (Optional preferDirect P2P transport and same-mode fallback for authorized unicast UDP are specified in Peer Direct & Relay Fallback.)

2. Functional Requirements

FR-UDP-01 Configuration and Usage

  • Add transportProtocol (tcp or udp, defaulting to tcp when omitted) and udpIdleTimeoutSeconds (default 60, valid range 1–3600 seconds) to Server-managed channel configs.
  • Channel configs are centrally managed and distributed by the Server; Agents do not persist channel definitions locally. The Admin UI allows selecting the transport protocol and editing the UDP idle timeout, while both Server and Agent status pages and read-only APIs expose the active protocol.
  • TCP and UDP channels may bind the same address and numeric port, whereas overlapping listeners of the same protocol cannot be enabled concurrently. Port suggestions check per protocol, and saving validates actual bind availability.
  • Peer mappings inherit the target channel's protocol and idle timeout; the caller Agent allocates, persists, and reports its local loopback port.

FR-UDP-02 Data Handling and Sessions

  • Preserve exact datagram boundaries and payload contents for 0-byte, binary, and up to 65507-byte payloads. Never split stream chunks into separate UDP packets or forward partial datagrams.
  • Isolate sessions by (ingress, source IP, source port); traffic must never mix across sources, channels, clients, or servers. Each session uses an independent target UDP socket and routes replies solely back to the original source.
  • The first datagram triggers tunnel or direct-path setup on the authenticated session with bounded queuing; no business payload reaches the target until target setup and the audit gate succeed. Drop datagrams without synthesizing application errors when no Agent is online, capacity is exhausted, ACL checks fail, or setup fails.
  • Successful forwarding in either direction resets the idle timer. Idle expiration reclaims the session; subsequent datagrams start a fresh session without replaying stale queued payloads.
  • Material config changes, disables, deletions, security-group revocations, control disconnects, and service shutdowns must release tunnels, target sockets, and quotas immediately; no-op config saves must not revoke active sessions.

FR-UDP-03 Security and Resource Limits

  • Reuse per-client authentication, one-time tunnel tokens, config version checks, connection/pending limits, the SQLite audit gate, and secret-redaction boundaries. UDP source sessions count against existing connection quotas.
  • Standard ingress evaluates application-layer security groups against the actual source IP, while deployment firewalls/security groups govern network boundaries. Peer access enforces target certificate pinning and HMAC access proofs; inner TLS is enabled by default and plaintext is permitted only when explicitly disabled per channel.
  • Queue at most 32 datagrams per source session and drop newest datagrams on overflow; unbounded queuing is prohibited. Stream writes enforce bounded timeouts, and idle or cancellation signals must terminate both relay tasks promptly.
  • Standard and default relay data tunnels between Agent and Server remain TCP-only, introducing no new public UDP data port on the Server relay plane (optional UDP usage under preferDirect is governed separately by DES-011). Reliable stream encapsulation introduces head-of-line blocking and does not promise real-time UDP latency or lossless delivery.

FR-UDP-04 Incremental Compatibility

Preserve non-destructive backward compatibility with legacy clients. Newer Servers must continue accepting v3 Agents for standard TCP and authorized TCP peer access using legacy snapshot structures and digests. UDP configuration is pushed exclusively to v4+ Agents, and legacy Agents must never interpret unrecognized UDP configs as TCP. Authentication, TLS, one-time binding, audit gates, and quota limits remain strictly enforced. See ADR-0025.

3. Acceptance Criteria

ID Acceptance Scenario Pass Criteria
A75 Standard ingress plus encrypted and plaintext peer access sending 0, 1, 32769, and 65507-byte datagrams across two concurrent sources Complete round-trip replies with exact datagram boundaries and strict source isolation
A76 Default protocol/timeout values, invalid protocol/timeout rejection, shared TCP/UDP port numbers, port conflicts, and UI/read-only API inspection Defaults to TCP; invalid values and same-protocol overlaps rejected; cross-protocol port sharing works; UI matches snapshots
A77 Queue overflow, out-of-range or truncated record lengths, idle reclamation, capacity limits, and cancellation Bounded drops on overflow, zero partial datagrams forwarded, quotas reclaimed, and next datagram starts a fresh session
A78 Security-group denials and rule changes, protocol/config changes, disable/delete, disconnects, invalid access proofs, and legacy clients Unauthorized traffic rejected and affected sessions revoked; caller peer ingress syncs protocol changes; zero payload/secret logs; v3 keeps TCP registration, config updates, and cross-version TCP peer access while rejecting UDP
A79 Full existing TCP regression suite plus Linux/macOS service deployment, cross-host tests, and sustained UDP runs TCP regression passes; target-environment measurements are recorded separately rather than substituted with localhost runs

Current verification evidence and remaining gaps are tracked in Verification Status.

Repository source