Skip to content

peer.AddressBook needs to be smarter #603

Closed

Description

@jbenet

Address management is actually a really complicated issue.

We can have:

  1. user-given local listen addrs -- the user-given addrs to listen on (these may be unspecified -- /ip4/0.0.0.0/tcp/0)
  2. os assigned local listener addrs-- these are os-assigned version of (1)
  3. interface resolved local listener addrs -- these are per-interface resolved version of (2)
  4. remote peer listen addrs -- the addrs remote peers know they're listening at
  5. observed remote peer addrs -- addrs we've observed the remote peer to dial from (6 + 7)
  6. observed remote peer listen addrs -- subset of (5) that corresponds to addrs in remote's (3)
  7. observed remote peer dial-ephemeral addrs -- addrs in (5-6)

As a node, we should be advertising our own addrs in (3) and those we learn in (6) in the dht. And some of these sets may change over time (i.e. 3 can change as machine interfaces go up and down), be location dependent (5-7), and even go stale quickly (5-7).

The super basic peerstore.AddressBook is really not working well to deal with this level of complexity. It could do a lot of heavy lifting rather than have all this logic spread out all over the codebase (in p2p/net, in routing/dht, in core).

And it likely should be differentiated from peer.Peerstore to avoid baking in the crazy complexity into what's supposed to be a simple object. (peer.Peerstore maybe should just expose an AddressBook() AddressBook)

Activity

  1. jbenet commented on Mar 28, 2015

    @jbenet
    MemberAuthor

    this seems to be in a good place now. i'll reopen if needed

  2. added a commit that references this issue on Oct 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions