Skip to content

Clarify/confirm <src><dst><data> multistream flow in relay #12

@dryajov

Description

@dryajov

@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 A connects 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 Relay reads the header and the address of Peer B from the stream
    • Relay then connects to Peer B and writes a header in the form of /ipfs/relay/circuit/1.0.0\n/<valid multiaddr of source node>
    • Peer B stores the origin/source address to be able to later dial back (is this the case?)
  • Once connected to both peers, the Relay short 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions