Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Event-based autonat checking #57

Closed
Stebalien opened this issue Mar 20, 2020 · 2 comments
Closed

Event-based autonat checking #57

Stebalien opened this issue Mar 20, 2020 · 2 comments
Assignees

Comments

@Stebalien
Copy link
Member

Instead of using timeouts to determine when we should next try to check our NAT status, if we don't know our status:

  1. Listen for identify events for new peers.
  2. If the new peer supports AutoNAT try them.

And keep doing this till we find out our status.

@willscott
Copy link
Contributor

should react to protocol updates rather than identify events once protocol updates are emitted reliably - per libp2p/go-libp2p#860

@marten-seemann
Copy link
Contributor

I think that's what we're doing:

case event.EvtPeerIdentificationCompleted:
if s, err := as.host.Peerstore().SupportsProtocols(e.Peer, AutoNATProto); err == nil && len(s) > 0 {
currentStatus := as.status.Load().(autoNATResult)
if currentStatus.Reachability == network.ReachabilityUnknown {
as.tryProbe(e.Peer)
}
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants