libp2p / libp2p/rust-libp2p

auto-relay: automatically make reservations on relays as we discover them

Open
#4,651 11 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
5.6k
Forks
1.3k
Avg merge
8h 47m
Merged PRs (30d)
19

Description

Description

Today, a user of rust-libp2p can make a reservation on a relay by instructing the Swarm to listen_on a relayed address, i.e. one with /p2p-circuit in it.

We should develop a module similar to go-libp2ps AutoRelay that does this automatically as we connect to relays:

  • Upon a new connection, check the supported protocols on that connection for the relay "hop" protocol.
  • Based on some configuration (to be decided), conclude that we should make a new reservation.
  • Emit a ToSwarm::ListenOn command with a constructed /p2p-circuit address for the discovered relay.
Motivation

Give users a module they can drop into their Behaviour that automatically creates reservations as we connect to relays.

Requirements
  1. The number of reservations we make must be bounded by something, i.e. maximum 10. Should probably be configurable.
  2. We may want to make this conditional on our number of external addresses. If we don't have any external addresses, reservations will be useful because it means we are likely behind a NAT.
Open questions

No response

Are you planning to do it yourself in a pull request ?

No

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing Swarm listen_on flow, relay reservation handling, and Behaviour/ToSwarm interface, then compare them with go-libp2p's AutoRelay. Define the reservation policy and configuration, including the maximum count and external-address condition; done means discovered relay connections can trigger bounded, constructed /p2p-circuit ListenOn commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.