Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Here's a pre-spec #1

Closed
wants to merge 2 commits into from
Closed

Here's a pre-spec #1

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jan 26, 2017

  • Q: how did you draw the ascii art?
  • A: by hand, with love

@ghost ghost requested review from jbenet, daviddias and whyrusleeping January 26, 2017 03:29
@ghost
Copy link
Author

ghost commented Jan 26, 2017

@ghost
Copy link
Author

ghost commented Jan 26, 2017

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
Copy link

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.
Copy link

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

Copy link
Author

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,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm "quaks and"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦆 🦆

+-------+ +---------+ +-------+
^ +-----+ ^
| | | |
| /libp2p-circuit-relay/QmTwo | | |
Copy link

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?

Copy link
Author

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

Copy link
Member

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

Copy link
Author

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.
Copy link

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.

Copy link
Member

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
Copy link

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

Copy link
Author

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>
Copy link

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.
Copy link

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)
}
```
Copy link

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.
Copy link

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.

Copy link
Author

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
Copy link
Member

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)

Copy link
Author

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

Copy link
Member

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
Copy link
Member

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?

Copy link
Author

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.
Copy link
Member

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
Copy link
Member

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ghost ghost force-pushed the feat/prespec branch 3 times, most recently from 05c1aa2 to 80b1b29 Compare January 27, 2017 02:02
@ghost
Copy link
Author

ghost commented Jan 27, 2017

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.
Copy link
Member

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.

Copy link
Author

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:

  1. multiaddrs are meant to be as verbose as neccessary.
  2. 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 :)

Copy link
Member

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 :)

Copy link
Member

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 :)

@daviddias
Copy link
Member

Humble request - Can this be moved to libp2p/specs?

@ghost
Copy link
Author

ghost commented Jan 29, 2017

Yes if it looks good to you? I just didn't wanna interrupt the PR in the middle of it

@ghost
Copy link
Author

ghost commented Feb 8, 2017

Got positive feedback from @whyrusleeping too -- closing this PR in favor of moving the document into libp2p/specs.

@ghost ghost closed this Feb 8, 2017
@daviddias daviddias deleted the feat/prespec branch February 9, 2017 00:58
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants