feat(relay): stateless pair-mux WebSocket relay skeleton#30
Open
Codename-11 wants to merge 1 commit into
Open
Conversation
Minimal self-hostable relay that routes opaque ciphertext bytes between
two endpoints sharing a `?pair=<code>` query param. First connection
becomes side A, second becomes side B, third is rejected. Binary frames
forward verbatim; text frames drop. Either disconnect tears the pair
down. Pairs with one-sided connections beyond 5 minutes are swept.
Zero crypto awareness by design — NaCl box wiring lives in the daemon
and client, never in the relay (Phase 10 of arc-v3-daemon plan).
Ships:
- `startRelay({ port, host })` API + `arc-relay start` Commander CLI
- Multi-stage Dockerfile pruned to the relay workspace (port 8765)
- docker-compose.yml with commented nginx/Caddy TLS-proxy options
- README with protocol table, run recipes, and smoke-test snippet
- 5 Vitest cases: A↔B round-trip, disconnect teardown, 3rd-conn 409,
missing-pair 400, pair-independence
Wires the new package into root tsconfig paths + vitest alias so
cross-workspace imports resolve in TS and tests.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
packages/relayworkspace: stateless WebSocket multiplexer that routes opaque bytes between two endpoints sharing a?pair=<code>query param.409. Binary frames forward verbatim; text frames drop; either disconnect tears the pair down; pairs with one-sided connections beyond 5 min are swept.What ships
startRelay({ port, host, pairTtlMs?, sweepIntervalMs? })+RelayHandlepublic API.arc-relay start [--port 8765] [--host 0.0.0.0]Commander CLI; installed asbinfor the workspace.GET /healthreturns{ ok: true, pairs: <count> }for container probes.Dockerfilepruned to the relay workspace, exposes:8765.docker-compose.ymlwith commented nginx + certbot and Caddy TLS-proxy options.README.mdwith protocol table, run recipes, and smoke-test snippet.tsconfig.jsonpaths +vitest.config.tsalias wired up for cross-workspace imports.Test plan
npx tsc --noEmitpasses (strict, ESM, Node16 module).npx vitest run packages/relay/tests/relay.test.ts— 5/5 green:?pair=rejected at upgrade (400)arc-relay start --port 8775, opened two ws clients, confirmedb got: hi-from-a, confirmedGET /healthreturns{"ok":true,"pairs":0}after both closed.Notes
Part of the v3 daemon pivot — see
docs/plans/arc-v3-daemon.mdPhase 10.🤖 Generated with Claude Code