-
Notifications
You must be signed in to change notification settings - Fork 16
Conversation
ghost
commented
Jan 26, 2017
•
edited by ghost
Loading
edited by ghost
- Q: how did you draw the ascii art?
- A: by hand, with love
The section on addressing is still a bit rough around the edges, but I think it all captures the general idea. |
[go-libp2p-nat]: https://github.com/libp2p/go-libp2p-nat | ||
|
||
|
||
## Dramatization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
This helps in situations where nodes are behind NAT or reverse proxies, | ||
or simply don't support the same transports (e.g. go-ipfs vs. browser-ipfs). | ||
libp2p already has modules for NAT ([go-libp2p-nat][go-libp2p-nat]), | ||
but these don't always do the job, just because NAT traversal is a clusterfuck. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clusterfuck
technical term :D
we'll want to remove before merging for benefit of more proper readers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, did this in the spirit of banana-driven writing. if you can't come up with a good term, insert one which is so bad you have to replace it :)
One node asks a relay node to connect to another node on behalf of the first node. | ||
The relay node shortcircuits its streams to the two nodes, | ||
and they are then connected through the relay. | ||
This connection quaks and behaves just like a direct connection would, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm "quaks and"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🦆 🦆
+-------+ +---------+ +-------+ | ||
^ +-----+ ^ | ||
| | | | | ||
| /libp2p-circuit-relay/QmTwo | | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we come up with a shorter protocol name? like p2p-circuit
or p2pcr
or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm open to anything here -- in a similar fashion we already have /libp2p-webrtc-star
and /libp2p-webrtc-direct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, we can short all the libp2p specific transports to only use p2p
, at the same time we drop /ipfs/
and use /p2p/
for addrs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/p2p-circuit then?
- QmOne is configured to use QmRelay for relaying. | ||
- QmOne automatically added `/libp2p-circuit-relay/ipfs/QmTwo` to its set of QmTwo addresses. | ||
- QmOne tries to connect via relaying, because it shares this transport with QmTwo. | ||
- A lively and prolonged dialogue ensues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expand with:
Scene 3:
- QmOne connects to QmRelay, establishing a secure connection.
- QmOne asks QmRelay to connect to
/ipfs/QmTwo
- QmRelay can do so, and dials QmTwo, establishing a secure connection.
- QmRelay then plugs the connections together, letting QmOne speak to QmTwo.
- QmOne and QmTwo want to speak privately, so they, too, establish a secure connection over the relayed transport.
- A lively and secure dialogue ensues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Yeah, this is why we need Relay as a Mounted protocol
|
||
``` | ||
/ipfs/relay/circuit/0.1.0 | ||
QmOne |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ipfs/QmOne
?
and it should be /p2p
once we make that switch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, changing it to /p2p
``` | ||
<multistream-header> | ||
<src> | ||
<dst> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<dst-multiaddr>
?
- `multistream-header`: This field is not strictly part of the relay stream. | ||
- Multistreams are prefixed with a multicodec field identifying the protocol used for the stream. | ||
- `src`: The PeerID of the node opening the connection. | ||
- `dst`: The PeerID of the node that `src` wants to connect to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm i may be fine if this is a peer-only thing. then it works differently than the circuit relay thing i had made, which dials to multiaddrs. (i.e. i tell A what to dial to connect to the next step)
|
||
AllowRelaying(bool whetherToRelayOthersConnections) | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cant comment on the interfaces because i havent used them :)
- *Not capable of *connecting* via relaying.* | ||
|
||
Since the existing protocol is incomplete, insecure, and certainly not used, | ||
we can safely remove it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, we do need to be able to dial multiaddrs that the relaying node does not previously know. I think this is two things.
- (1) a circuit relay that dials other multiaddrs.
- (2) a circuit relay that understands
/{ipfs, p2p}/<peerid>
multiaddrs, and can dial to those with its own routing.
it would be useful to setup a bunch of boxes that do (1) kind of relay without dht or anything else. just dumb pipes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes agreed, in the addressing section i wrote:
Relay addresses can be encapsulated "infinitely",
so that one can construct onion-like relay chains:
/libp2p-circuit-relay/ipfs/QmFoo/libp2p-circuit-relay/ipfs/QmBar
Relay addresses can encapsulated in an /ipfs address to signal a specific relay node to use:
/ipfs/QmRelay/libp2p-circuit-relay/ipfs/QmFoo
or/dns6/relay.libp2p.io/ipfs/QmRelay/libp2p-circuit-relay/ipfs/QmFoo
the stream protocol could understand any of these.
# go-libp2p-relay | ||
Circuit Switching for libp2p | ||
# go-libp2p-circuit-relay | ||
> Circuit Switching in libp2p |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec should be a libp2p spec inside the specs folder, it applies to any language (or at least, it should)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, gonna move it there eventually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for moving it :)
+--------------------------------------------+ +------------------------------------+ | ||
``` | ||
|
||
[go-libp2p-nat]: https://github.com/libp2p/go-libp2p-nat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this link here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a footnote link, the actual link is within the paragraphs above. I'll inline it.
- QmOne wants to connect to QmTwo, | ||
and through peer routing has acquired a set of addresses of QmTwo. | ||
- QmTwo doesn't support any of the transports used by QmOne. | ||
- Awkward silence. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahaah 😁
or `/dns6/relay.libp2p.io/ipfs/QmRelay/libp2p-circuit-relay/ipfs/QmFoo` | ||
|
||
|
||
### /ipfs/relay/circuit stream protocol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we do /p2p-circuit-relay/
instead? /ipfs/relay
relay would make it specific to IPFS and could also mean other types of relay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the protocol multicodec, not the multiaddr, as in: https://github.com/libp2p/specs/blob/master/7-properties.md#757-protocol-multicodecs
05c1aa2
to
80b1b29
Compare
I think I've addressed all comments, plus the addressing and wire sections got a big makeover and are a lot better now. (I'm not sure yet how to fit in the "Scene 3" as suggested.) |
|
||
## Addressing | ||
|
||
`/p2p-circuit` multiaddrs don't carry any meaning of their own. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we move ipfs
to p2p
this starts looking pretty odd having p2p
twice in there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how to avoid that:
- multiaddrs are meant to be as verbose as neccessary.
- some kind of prefix for libp2p-specific protocols (other example:
/libp2p-webrtc-star
) is likely helpful to open up development to other projects and communities.
I also don't mind it much really :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given that I don't have any good ideas I'm withdrawing my concerns :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given that I don't have any good ideas I'm withdrawing my concerns :)
Humble request - Can this be moved to libp2p/specs? |
Yes if it looks good to you? I just didn't wanna interrupt the PR in the middle of it |
Got positive feedback from @whyrusleeping too -- closing this PR in favor of moving the document into libp2p/specs. |