Skip to content

Commit

Permalink
Transit: document the "for $side" in the relay handshake
Browse files Browse the repository at this point in the history
We already do this everywhere anyways, so this is more a correction
of the documentation than a change to the protocol. Therefore, I've
omitted describing any backwards compatibility handling.
  • Loading branch information
piegamesde committed Oct 8, 2021
1 parent bffed13 commit 185c6ed
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions transit.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,13 @@ WebSockets), and the relay will also connect two clients using different protoco
together.

When connecting to a relay, the Transit client first writes RELAY-HANDSHAKE
to the socket, which is `please relay %s\n`, where `%s` is the hex-encoded
32-byte HKDF derivative of the transit key, using `transit_relay_token` as
the context. The client then waits for `ok\n`.
to the socket, which is `please relay $channel for $side\n`, where `$channel`
is the hex-encoded 32-byte HKDF derivative of the transit key,
using `transit_relay_token` as the context, and `$side` is a random per session
identifier. The `side` is used to deduplicate a client opening multiple
connections to the same relay server: without, it may result in a loopback
to itself and a dead-lock of the protocol.
The client then waits for `ok\n`.

The relay waits for a second connection that uses the same token. When this
happens, the relay sends `ok\n` to both, then wires the connections together,
Expand Down

0 comments on commit 185c6ed

Please sign in to comment.