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

introduce a proper address pipeline #2229

Open
2 tasks
marten-seemann opened this issue Mar 27, 2023 · 1 comment
Open
2 tasks

introduce a proper address pipeline #2229

marten-seemann opened this issue Mar 27, 2023 · 1 comment
Labels
effort/weeks Estimated to take multiple weeks exp/wizard Extensive knowledge (implications, ramifications) required P1 High: Likely tackled by core team if no one steps up

Comments

@marten-seemann
Copy link
Contributor

marten-seemann commented Mar 27, 2023

We need to get a lot smarter about address management. Wrapping / replacing addresses via the AddrsFactory doesn't scale.

I'm imagining a new service that's responsible for the entire process of address management.

  1. It ingests in new "address candidates" from various sources: user provided address hints, transports claiming to listen on certain addresses, Identify, relay service etc.
  2. It verifies these addresses using AutoNAT v2.
  3. It groups and categorizes these addresses (public / private / relayed).
  4. It provides interfaces to make these different categories of addresses available to consumers.

Updated(@sukunrt): Using this issue for tracking:

@marten-seemann marten-seemann added exp/wizard Extensive knowledge (implications, ramifications) required P0 Critical: Tackled by core team ASAP effort/weeks Estimated to take multiple weeks labels Mar 27, 2023
@p-shahi p-shahi added P1 High: Likely tackled by core team if no one steps up and removed P0 Critical: Tackled by core team ASAP labels May 22, 2023
mergify bot pushed a commit to libp2p/rust-libp2p that referenced this issue May 24, 2023
Previously, a `NetworkBehaviour` could report an `AddressScore` for an external address. This score was a `u32` and addresses would be ranked amongst those.

In reality, an address is either confirmed to be publicly reachable (via a protocol such as AutoNAT) or merely represents a candidate that might be an external address. In a way, addresses are guilty (private) until proven innocent (publicly reachable).

When a `NetworkBehaviour` reports an address candidate, we perform address translation on it to potentially correct for ephemeral ports of TCP. These candidates are then injected back into the `NetworkBehaviour`. Protocols such as AutoNAT can use these addresses as a source for probing their NAT status. Once confirmed, they can emit a `ToSwarm::ExternalAddrConfirmed` event which again will be passed to all `NetworkBehaviour`s.

This simplified approach will allow us implement Kademlia's client-mode (#2032) without additional configuration options: As soon as an address is reported as publicly reachable, we can activate server-mode for that connection.

Related: #3877.
Related: #3953.
Related: #2032.
Related: libp2p/go-libp2p#2229.

Co-authored-by: Max Inden <mail@max-inden.de>

Pull-Request: #3954.
@sukunrt
Copy link
Member

sukunrt commented Jul 11, 2023

We need something like #2293 to test this.

umgefahren pushed a commit to umgefahren/rust-libp2p that referenced this issue Mar 8, 2024
Previously, a `NetworkBehaviour` could report an `AddressScore` for an external address. This score was a `u32` and addresses would be ranked amongst those.

In reality, an address is either confirmed to be publicly reachable (via a protocol such as AutoNAT) or merely represents a candidate that might be an external address. In a way, addresses are guilty (private) until proven innocent (publicly reachable).

When a `NetworkBehaviour` reports an address candidate, we perform address translation on it to potentially correct for ephemeral ports of TCP. These candidates are then injected back into the `NetworkBehaviour`. Protocols such as AutoNAT can use these addresses as a source for probing their NAT status. Once confirmed, they can emit a `ToSwarm::ExternalAddrConfirmed` event which again will be passed to all `NetworkBehaviour`s.

This simplified approach will allow us implement Kademlia's client-mode (libp2p#2032) without additional configuration options: As soon as an address is reported as publicly reachable, we can activate server-mode for that connection.

Related: libp2p#3877.
Related: libp2p#3953.
Related: libp2p#2032.
Related: libp2p/go-libp2p#2229.

Co-authored-by: Max Inden <mail@max-inden.de>

Pull-Request: libp2p#3954.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/weeks Estimated to take multiple weeks exp/wizard Extensive knowledge (implications, ramifications) required P1 High: Likely tackled by core team if no one steps up
Projects
None yet
Development

No branches or pull requests

3 participants