Repository navigation
feat(relay)!: no internal client; a session is a client or a peer - #517
Merged
Merged
Conversation
"relay: new session" carried the remote address and whether the session was checked. It now names the session id, the transport, the path, the credential's sub, the MoQ version, the ALPN, the TLS version and the SNI, and for an upgraded session the subprotocols the client offered, its user agent and its origin. "relay: session ended" is new: the reason, the duration and the byte totals. A WebTransport client that offers no subprotocol is served as before; its line now shows an empty offer. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PskJnUHF5bxqi5ksWgz63G
The transport label of the session metrics said "peer" or "internal" for a relay peer's or an internal client's session. Those are not transports: both run over native QUIC. The metrics and the session log now name the class (client, internal, peer) and the transport (webtransport, websocket, quic) separately. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PskJnUHF5bxqi5ksWgz63G
A native-QUIC session whose certificate the relay CA verified, without the peering name, was an internal client: served without a credential, subscribe-only. Only the HLS egress used it, beside the two ways every other service connects, a credential or a peer certificate. Such a certificate now grants nothing: its session is a client's and needs a credential. The HLS egress connects with a credential, or with a peer certificate as a relay peer. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PskJnUHF5bxqi5ksWgz63G
A token lives an hour at most, so a credential fixed in RELAY_URL stopped admitting the egress at its first reconnect after that, which left a peer certificate as the only lasting way in once the internal client was gone. With RELAY_SIGNING_KEY the egress signs a fresh credential on every connect, for RELAY_TRACK_PATH alone. The egress refuses to start with a peer certificate beside a credential, which the relay would never read, and with a certificate that lacks the peering name. The relay logs a session it drops for presenting the relay's own peer certificate. Docs: the credential's expiry does not end a live session; a peer certificate must be the holder's own; class="peer" counts anything holding a peer certificate; the example config and a comment still named the internal client. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PskJnUHF5bxqi5ksWgz63G
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.
Stacked on #514.
Why
The relay sorted sessions into three classes. Two of them are how every service connects: a client with a credential, and a peer with a peer certificate from the relay CA. The third, the internal client, was a certificate from the same CA without the peering name: no credential, subscribe to anything, announce nothing.
Only the HLS egress used it. The funnel, the other platform service, connects with a credential it signs itself, and could not have used it, since it publishes. So there were two ways for a platform service to reach a relay, and the relay carried a grant, an admission path, a metric label and documentation for one caller.
Change
Relay
classifyreturnsclientorpeer;classInternal,internalGrantandadmission.internalare gone.CA_FILEwithout a peer certificate still accepts peers. The startup lines call thatinbound onlywhere they saidinternal clients only.classisclientorpeer.HLS egress
The egress connects to a relay with auth on in one of two ways:
RELAY_SIGNING_KEY(new)RELAY_CERT_FILE,RELAY_KEY_FILERELAY_TRACK_PATH, nothing elseRELAY_SIGNING_KEYis why the credential way works at all. A token lives an hour at most (token.MaxLifetime), and the relay checks that when a session starts. A credential fixed inRELAY_URL(?jwt=) therefore admitted the egress once and then refused its first reconnect after the hour, and every one after. The egress now signs a fresh one on each connect, as the funnel does, for its own path alone.?jwt=: the relay never reads a peer's credential, so it would limit nothing;RELAY_CERT_FILEwithout the peering name, naming the missing name;RELAY_TRACK_PATH.What this costs
class="peer"in the session metrics, with relay-to-relay traffic.qumo-deploy deploys no HLS egress today, and nothing in it issues a certificate without the peering name.
Review
A review of the first version found nine things, all addressed in the last commit:
?jwt=could not keep an egress connected past an hour →RELAY_SIGNING_KEY.RELAY_CERT_FILEwhen one was already set → the missing peering name is caught at startup and named.relay-config.example.envstill described the internal client → rewritten.peer_trust.gostill named it → fixed.class="peer"relay-to-relay traffic only → they now say it counts anything holding a peer certificate.Checked
go test ./internal/relay/ ./internal/hls/andgo test -tags=integration ./internal/integration/pass;golangci-lint run ./internal/...is clean.qumo hlsitself against a relay whose key set holds its signing key. The signing is unit-tested and the dial is the one it used before.🤖 Generated with Claude Code
https://claude.ai/code/session_01PskJnUHF5bxqi5ksWgz63G