Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[circuit-relay] Relay discovery #424

Closed
dryajov opened this issue Apr 3, 2017 · 12 comments
Closed

[circuit-relay] Relay discovery #424

dryajov opened this issue Apr 3, 2017 · 12 comments

Comments

@dryajov
Copy link
Member

dryajov commented Apr 3, 2017

Currently we're sending only one dst address to the circuit-relay, however, the relay can discover other addresses for that peer, either through the dht or by checking it's peer-book and try all it's known addrs. Alternatively (I like this better) we can also send multiple dst addrs that the peer is reachable on, from the dialer.

Edits:
Reworded

@daviddias daviddias changed the title Allow circuit-relay to try all known peer addrs Relay discovery May 10, 2017
@daviddias
Copy link
Member

In other words:

  • Currently, libp2p-circuit only supports dialing with known relays (explicit on the multiaddr)
  • We want to support in the future
    • Relay discovery through DHT
    • Relay discovery through trying to mount the Relay protocol with known peers

We won't support relay discovery for the first iteration.

@dryajov
Copy link
Member Author

dryajov commented May 10, 2017

The current js implementation actually tries to mount every incoming peer muxed connection on the hop protocol and records it as a relay if it succeeds. This same mechanism is used to connect to bootstrapped relay nodes, as in - there is no circuit specific logic to connect to bootstrap circuit nodes.

@ghost
Copy link

ghost commented May 16, 2017

I think eventually we'd want something like Service Routing? Where you ask the DHT to give you nodes which speak a given protocol.

Or extend Peer Routing with capabilities that are beyond "has block X", e.g. "speaks transport Y", "speaks protocol Z version 1.x",

@dryajov
Copy link
Member Author

dryajov commented May 16, 2017

Yep, absolutely. For now this sort of passive discovery can probably fill the gap?

@RangerMauve
Copy link

Is every peer going to be capable of acting as a relay, or are there going to be community driven relay nodes out in the open?

Is there any documentation on how a peer would advertise their available interfaces on the DHT?
Should peers include relay routes among their advertised interfaces?

For the web, in order for a relay to be usable for dialing into a browser, will the browser already have to have an active connection to the relay?

@dryajov
Copy link
Member Author

dryajov commented Jan 11, 2018

@RangerMauve In theory, every peer can act as a relay (configurable through options). My guess is that we'll also have some dedicated relay nodes - probably bootstrap nodes and such, as well as community ran nodes. In reality, even the browser should be able to relay connections - tho that is not yet a tested feature.

Is there any documentation on how a peer would advertise their available interfaces on the DHT?

Not as far as I know, however there are several proposals elsewhere for general purpose service discovery, tho nothing concrete yet, AFAIK. @Stebalien might have some insights here.

Should peers include relay routes among their advertised interfaces?

Thats a good question, we haven't settled on anything here yet AFAIK, but allowing nodes to communicate which relays they're connected to would help speeding up connecting to them as well as reduce network load.

One more thing worth noting here, is that there are essentially two types of relays - active and passive. An active relay would dial the destination peer, if no connection already exist to that peer, whereas a passive relay will only relay to already connected peers.

For the web, in order for a relay to be usable for dialing into a browser, will the browser already have to have an active connection to the relay?

Yes, the browser requires to have a connection to some relay in order to be "dialable".

@RangerMauve
Copy link

@dryajov Thank you for the details.
Could you possibly link me to any of these service discovery proposals?
It's kind of hard to find stuff when it's spread across dozens of repositories. :P

@RangerMauve
Copy link

Re: peers advertising relay routes

Peers already have a set of multiaddrs which they give people, since AFAIK a circuit is a multiaddr, it would be useful for a peer to advertise full circuits in order to speed up connectivity.

For browsers, it would make sense to only advertise multiaddrs with circuits since they can't accept incoming connections. (websocket/webrtc -star seems really sketchy to me because they're centralization points)

@RangerMauve
Copy link

Also, what API would one use in js-ipfs in order to discover whether a peer supports being a passive or active relay?

@dryajov
Copy link
Member Author

dryajov commented Jan 11, 2018

Could you possibly link me to any of these service discovery proposals?

At least the ones I know of, I'm sure there are a few more - this is one of those things we've talked about from different perspectives, but so far haven't consolidated into anything concrete.

Peers already have a set of multiaddrs which they give people, since AFAIK a circuit is a multiaddr, it would be useful for a peer to advertise full circuits in order to speed up connectivity.

Yeah, that could be one way of doing.

For browsers, it would make sense to only advertise multiaddrs with circuits since they can't accept incoming connections.

We don't currently advertise /p2p-circuit addresses on the DHT for example, but you do get the multiaddr set with /p2p-circuit addrs (at least in js and hence the browser, I believe go is a bit different), which I believe is provided by identify (tho I might be wrong). So, in other words, that already happens, the browser does list its circuit address in its multiaddr set.

@dryajov
Copy link
Member Author

dryajov commented Jan 11, 2018

There is nothing yet that would tell you if the relay is active or passive, again, the rational was that it would eventually be part of some sort of capabilities protocol, so that info was never included, tho now that I think about it, perhaps it would have made sense to advertise that as part of the CAN_HOP message.

@daviddias daviddias changed the title Relay discovery [circuit-relay] Relay discovery Aug 22, 2019
@daviddias daviddias transferred this issue from libp2p/js-libp2p-circuit Aug 22, 2019
@mpetrunic
Copy link
Member

Closing as stale, efforts are now focused on #1029

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants