Skip to content
This repository was archived by the owner on Sep 9, 2022. It is now read-only.

Relay Discovery and unspecific address dialing #4

Merged
merged 7 commits into from
Jul 25, 2017
Merged

Conversation

vyzo
Copy link
Contributor

@vyzo vyzo commented Jul 24, 2017

Implements passive relay discovery and unspecific relay address dialing, as discussed in libp2p/go-libp2p#209.

Implementation Notes:

  • Relay discovery is implemented through a Notifee, which tests CanHop for all new connections and tracks a list of known hop relays.
  • Unspecific address dialing is implemented by iterating through the list of known relays and attempting to dial through them; if none of the connection attempts succeed it fails with a RelayError.

@vyzo
Copy link
Contributor Author

vyzo commented Jul 24, 2017

summoning @Stebalien @whyrusleeping

@vyzo vyzo changed the title Relay Discover and unspecific address dialing Relay Discovery and unspecific address dialing Jul 24, 2017
vyzo added 3 commits July 24, 2017 13:51
it's racey, plus relay is a sticky property of nodes; test if we have active
connections instead at the time of dial.
d.mx.Lock()
for p := range d.relays {
relays = append(relays, p)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, the fast and idiomatic way to do this is:

relays := append([]peer.ID{}, d.relays...)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, relays isn't a slice.

@Stebalien
Copy link
Member

LGTM. Eventually, we'll probably want to use the DHT to find relays (or maybe even just gossip them) but asking connected peers is a good start.


Slightly off topic but it would be nice if peers could advertise us service lists on connect instead of having to test for everything (lots of extra round trips).

@vyzo vyzo merged commit 139840f into master Jul 25, 2017
@vyzo vyzo deleted the feat/relay-discovery branch July 25, 2017 07:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants