Clarify the difference between a tunnel and a relay#8
Conversation
relay/README.md
Outdated
| Unlike a transparent **tunnel**, where a libp2p peer would just proxy a communication | ||
| stream to a destination (the destination being unaware of the original source), | ||
| a circuit-relay makes the destination aware of the original source and | ||
| the circuit followed to stablish communication between the two. This provides |
relay/README.md
Outdated
| a circuit-relay makes the destination aware of the original source and | ||
| the circuit followed to stablish communication between the two. This provides | ||
| the destination side with the capacity of re-contacting the original source | ||
| by rebuilding the circuit in the oposite direction, using the same relay. |
|
Awesome, thanks! Two tiny typos, LGTM 👍 |
relay/README.md
Outdated
| Apart from that, this relayed connection behaves just like a regular | ||
| connection would, but over an existing swarm stream with another peer | ||
| (instead of e.g. TCP.): One node asks a relay node to connect to another node | ||
| n its behalf. The relay node shortcircuits its streams to the two nodes, |
relay/README.md
Outdated
| a circuit-relay makes the destination aware of the original source and | ||
| the circuit followed to stablish communication between the two. This provides | ||
| the destination side with the capacity of re-contacting the original source | ||
| by rebuilding the circuit in the oposite direction, using the same relay. |
There was a problem hiding this comment.
@hsanjuan @lgierth can this part be clarified a little further, because the wording is explicit in saying that the connection is rebuilt using the same relay, which makes me ask why can't it be rebuilt using an alternative relay, in case the original one is unavailable. I guess this is just wording, and in case the original is unavailable a new one will be selected, or not?
5aa9199 to
85d0278
Compare
relay/README.md
Outdated
| original source), a circuit-relay makes the destination aware of the original | ||
| source and the circuit followed to establish communication between the two. | ||
| This provides the destination side with full knowledge of the circuit which, | ||
| if needed, could be rebuilt in the opposite direction using |
There was a problem hiding this comment.
I think the key point that confused me and something worth highlighting here is that, the relay connection can be rebuilt using the same relay node or by asking the swarm to route it over some other relay peer. So I would perhaps word it as if needed, could be rebuilt either through the same relay node, or if unavailable by asking the swarm to route the connection over any other known relay.
There was a problem hiding this comment.
But @dryajov, the spec does not really specify how to "ask the swarm" or do relay discovery. Therefore I find your wording more confusing (it opens more questions). I just want to highlight that in a tunnel the receiving node would not have information about the circuit, while in a relay like this it does. Perhaps I will just remove the sentence?
There was a problem hiding this comment.
@hsanjuan Fair enough. Maybe leaving the mention that the connection could be rebuilt and leaving out the details could make it more readable. Perhaps, something like this:
This provides the destination side with full knowledge of the circuit which, if needed, could be rebuilt in the opposite direction.
There was a problem hiding this comment.
@dryajov we have a deal! I have pushed it in the last form.
It took me a while to realize that a relay it's not just tunneling a stream to a destination through a proxy peer but rather it is making a destination peer aware that the source peer is reachable through the relaying node. Hopefully this makes that more explicit. License: MIT Signed-off-by: Hector Sanjuan <code@hector.link>
85d0278 to
1297a18
Compare
It took me a while to realize that a relay it's not just
tunneling a stream to a destination through a proxy peer
but rather it is making a destination peer
aware that the source peer is reachable through the relaying
node. Hopefully this makes that more explicit.
License: MIT
Signed-off-by: Hector Sanjuan code@hector.link