Repository navigation
feat: test a member's relay from outside when the host asks (K2) - #622
Merged
Merged
Conversation
A host sharing a built-in call relay can ask one room device to test it from outside. Two new SignalBody types ride the existing kind 21059/20462 envelope: relay-test (id, endpoint) from the host and relay-test-result (id, endpoint, ok, stage, sameNetwork) back to the host alone. Both bodies are closed and carry no address, credential, name or time. The mesh admits them from roster devices without a media connection, on a budget of their own. relayTestVerdict and relayTestFinding fix how a tester judges what its two peers saw and what a host may call reachable; a pass from the host's own network is a hint only. Pinned by vectors/relay-outside-test-v1.json, assembled by hand.
The tester's app answers only the member who offers that built-in relay in the room, and only for a standard offer it holds. It declines while a test runs, within a minute of the last one for that host, or while Hide my IP address forbids that host's relay; otherwise it takes a relay login that is never applied to its calls, runs peer A relay-only on the relay and peer B with the relay's listener as its only STUN server, and sends the verdict to the host's device alone. No screen offers the host's trigger yet; the built-in relay's own settings add it. Acceptance builds expose it as a hook for the new loopback spec, which reuses the supervised spry-node fixture.
A relay with mapped ports refuses peers on its own addresses other than its allocations, so a tester whose host candidate is the relay's address never passes and learns no outside address. It was reported as a STUN failure; it is now inbound with sameNetwork, a hint rather than a finding. The loopback acceptance spec asserts that outcome, which is the honest one on a single machine.
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.
Stage K2 of the built-in relay: a host asks one member device to test its relay from outside its network, and gets an encrypted pass or fail back. No UI: the host button is K5.
SignalBodytypes on the existing pairwise signal wrap (NIP-44 to one device, device-signed, NIP-40 expiration 60 s):relay-test{id, endpoint}andrelay-test-result{id, endpoint, ok, stage?, sameNetwork?: true}. Closed shapes; no address, credential or name in either. No new kind or storage key.declinedwhen busy, within 60 s of the last test for that device, or when Hide my IP forbids that host (no dialog); redeems a login on demand that is never applied to its calls; runs a relay-only peer against a STUN-only peer with a data-channel echo, and checks the selected pairs' stats.declined,credentials,allocate,stun,inbound;sameNetworkwhen the tester's addresses include the relay's IP. The host may say reachable only forokwithoutsameNetwork.src/relay-test.ts,app/src/relay-outside-test.ts,docs/protocol.mdsection,vectors/relay-outside-test-v1.json(12 requests, 22 results, 17 verdicts, 9 wraps).test/relay-outside-test.spec.ts(npm run test:relay-outside-test, not in CI, like K1's): on one machine spry-turn refuses peers on its own IP in mapped mode, so it assertsok:false, stage:'inbound', sameNetwork:true. A real pass needs the separate-network tests in design section 6.2; the pass path is unit-tested with a fake peer connection. Host trigger exists only in builds withVITE_E2E_RELAY_OUTSIDE_TEST=true.Tests (M4): typecheck;
npm test8549 passed; new e2e 1/1; K1 e2e 3/3.https://claude.ai/code/session_01P4tkjt9pRAySng1JJnHn9t