libp2p/go-libp2p-autonat

AutoNAT only adds AutoNAT service peers on *new* connection

Closed this issue · 3 comments

The AutoNAT service contains a mapping of ID to AddrInfo, but this mapping is only updated when the host reports a new connection.

The issue is that the host's existing connections are not checked for AutoNAT support.

My specific issue arose when I was trying to have my relay hosts also provide AutoNAT service. Because I was bootstrapping my relay hosts into the local peer's DHT, the peer already had connections to them by the time the AutoNAT service was initialized. This meant that the list of AutoNAT peers never included the relay hosts and, thus, NAT status could not be determined.

It would seem that, at a minimum, it would be good to allow the AutoNAT to be bootstrapped with its own list of peers (this list of bootstrap peers would probably need to be provided to EnableAutoRelay). Although ideally, it would be better for the AutoNAT service to query existing connections from the host when it starts.

vyzo commented

We are in the process of adding a static list of relay peers that can be used instead of discovery in libp2p/go-libp2p#705.
We also want to add passive discovery whereby relays can also be discovered by connecting to them, as reported by the circuit subsystem.

vyzo commented

Also of note, we would happily accept a patch that makes autonat check existing connections for service support.

autonat no longer maintains a this peer cache, and will aim to only piggyback on existing connections