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

[discovery] Add support for AutoRelay #699

Closed
Tracked by #703
jacobheun opened this issue Jul 10, 2020 · 3 comments
Closed
Tracked by #703

[discovery] Add support for AutoRelay #699

jacobheun opened this issue Jul 10, 2020 · 3 comments
Assignees
Labels
Epic kind/enhancement A net-new feature or improvement to an existing feature P0 Critical: Tackled by core team ASAP status/ready Ready to be worked

Comments

@jacobheun
Copy link
Contributor

jacobheun commented Jul 10, 2020

AutoRelay enables libp2p nodes to dynamically find and bind to relays on the network. Once binding (listening) is done, the node can and should advertise its addresses to the network, allowing any other node to dial it over its bound relay(s). While direct connections to nodes are preferable, it's not always possible to do so due to NATs.

Use Cases

Finding Relays

A connected relay

The Circuit Relay module has the ability to ask connected nodes if they support the relay HOP protocol. If they do, the libp2p node can bind to that relay as a listener. A node should record a list of relays and use only a subset of those to avoid binding to a large number of relays, as this is not considerate to those relays.

  1. When a node connects to a peer that announces support for the relay protocol, /libp2p/circuit/relay/0.1.0, it may ask that node if it support HOP.
  2. If the peer supports HOP, libp2p should add it to its list of known relays.
  3. When a known relay is added, libp2p should check to see if it needs a/another relay (to meet some min threshold). If below that threshold, libp2p should bind to that relay and add it to its announced addresses.
    1. When adding announced addresses, libp2p SHOULD avoid adding private addresses of the relay, such as /ip4/127.0.0.1/tcp/4001.
    2. If libp2p does not have enough known relays, it should query the network if possible.
  4. When libp2p updates its addresses, it should update the network.
Remote Relays

When a node with AutoRelay enabled boots, it should search the network for the relay protocol, /libp2p/relay. This search may be done via one of several options leveraging libp2p.contentRouting.findProviders(). Depending on what features are turned on this may include: the DHT, Delegate Routing, and/or the Rendezvous Protocol (WIP).

If a node does not have enough known relays connected, and is unable to connect to other known relays, it should query the network for more relays. This should be done with a backoff to avoid spamming queries.

References:

@jacobheun jacobheun added the kind/enhancement A net-new feature or improvement to an existing feature label Jul 10, 2020
@jacobheun jacobheun changed the title Add support for AutoRelay [Placeholder] Add support for AutoRelay Jul 10, 2020
@jacobheun jacobheun changed the title [Placeholder] Add support for AutoRelay [discovery] Add support for AutoRelay Jul 13, 2020
@jacobheun jacobheun added the status/ready Ready to be worked label Jul 16, 2020
@vasco-santos vasco-santos self-assigned this Jul 28, 2020
@jacobheun jacobheun added Epic P0 Critical: Tackled by core team ASAP labels Jul 28, 2020
@vasco-santos
Copy link
Member

vasco-santos commented Jul 31, 2020

After discussing with @jacobheun I am planning on dividing this effort in a set of PRs as follows:

Milestone PR State
1) Auto relay - initial implementation #723 DONE
2) Identify push integration #748 WIP
3) Query the network for relays #749 WIP
4) Avoid announcing private addresses TODO TODO

WIP NOTES:

Milesone 1

  • When a node connects to a peer that announces support for the relay protocol, /libp2p/circuit/relay/0.1.0, it may ask that node if it support HOP.
  • If the peer supports HOP, libp2p should add it to its list of known relays.
  • maxListeners

Milestone 2

  • Identify push with multiaddrs update

Milestone 3

  • If libp2p does not have enough known relays, it should query the network if possible.

Milesone 4

  • Avoid announcing private addresses

@vasco-santos
Copy link
Member

This is partially implemented from 0.30. We do need to improve the logic around finding remote relays on the network:

If a node does not have enough known relays connected, and is unable to connect to other known relays, it should query the network for more relays. This should be done with a backoff to avoid spamming queries.

@maschad
Copy link
Member

maschad commented Sep 28, 2023

Closing as CircuitRelay v2 has an equivalent auto relay feature built-in.

@maschad maschad closed this as completed Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Epic kind/enhancement A net-new feature or improvement to an existing feature P0 Critical: Tackled by core team ASAP status/ready Ready to be worked
Projects
None yet
Development

No branches or pull requests

3 participants