feat(relay): accept control handshakes

The relay now keeps a shared room registry behind the QUIC endpoint and
runs an accept loop instead of only binding the socket. Each accepted
connection must open its first bidirectional control stream with a hello
frame; the relay joins the room registry and replies with welcome or reject.

Admission clamps the hello datagram budget to Quinn's negotiated peer
datagram size before choosing the effective room MTU, so room state is based
on what the connection can actually carry. Accepted peers remain present
until the QUIC connection closes, then the relay removes them through the
existing leave cleanup path.

The development self-signed certificate helper now exposes the certificate
to tests so a loopback Quinn client can trust the relay and exercise the real
stream codec path.

Test Plan:
- cargo fmt --check
- cargo test --workspace
- cargo clippy --workspace --all-targets -- -D warnings

Refs: PLAN.md relay QUIC control-stream startup flow
This commit is contained in:
2026-05-21 17:51:40 +02:00
parent 81ad7abe84
commit b8ae95a911
5 changed files with 361 additions and 23 deletions
+6 -4
View File
@@ -42,6 +42,7 @@ Shared diagnostics and structured logging vocabulary:
Public relay binary and relay-owned room state:
- QUIC endpoint binding and first-stream hello/welcome admission
- room admission for clients and gateways
- one gateway per room, duplicate client MAC rejection, and room limits
- stable effective room MTU chosen before Ethernet datagrams flow
@@ -61,7 +62,8 @@ cargo run -p lanparty-relay -- --listen 443/udp
```
`--listen` accepts either a socket address or a UDP port shorthand such as
`443/udp`. The relay binds a QUIC endpoint and waits for shutdown, but
connection handling is not wired yet. It currently uses a generated self-signed
development certificate; production certificate and client trust handling remain
future work.
`443/udp`. The relay binds a QUIC endpoint, accepts a control-stream `hello`,
and replies with `welcome` or `reject`. Ethernet datagram forwarding is still
implemented as relay-owned decisions but not yet wired to live QUIC datagrams.
It currently uses a generated self-signed development certificate; production
certificate and client trust handling remain future work.