-
Notifications
You must be signed in to change notification settings - Fork 292
Description
@lgierth @diasdavid @dignifiedquire
The current spec describes the multistream interaction as <src><dst><data>, further defining it as:
After getting a stream to the relay node from its libp2p swarm, the dialing transport writes the header to the stream. The relaying node reads the header, gets a stream to the destination node, then writes the header to the destination stream and shortcircuits the two streams.
In order to make sure that this is unambiguous an example might be required, such as:
Peer Aconnects to relay (Relay) and writes the destination address as a header- The header is in the form of
/ipfs/relay/circuit/1.0.0\n/<valid multiaddr of dest node>
- The header is in the form of
- The
Relayreads the header and the address ofPeer Bfrom the streamRelaythen connects toPeer Band writes a header in the form of/ipfs/relay/circuit/1.0.0\n/<valid multiaddr of source node>Peer Bstores the origin/source address to be able to later dial back (is this the case?)
- Once connected to both peers, the
Relayshort circuits the two streams
This is what I currently have implemented as well, but I still feel that I might be reading the spec incorrectly, so just making sure this is the intended flow. Adding an example like this to the spec might also help future implementors. Please feel free to correct were things are off.