ipfs-check icon indicating copy to clipboard operation
ipfs-check copied to clipboard

Reuse long running libp2p host for checks

Open 2color opened this issue 5 months ago • 2 comments

What's the problem

Running the ipfs-check backend on a machine behind NAT will fail running checks against other peers behind NAT, because we create a short-lived test host for the check, which doesn't connect to any peers, so it can't find any observed addrs, preventing NAT hole punching from happening.

Idea

Reuse the long running libp2p peer for checks that don't involve an explicit multiaddr

Since the DHT traversal which happens as part of the check will likely open a connection (and hole punch) to a peer, we could reuse the long running libp2p host and pass it into Vole for the bitswap check.This would simplify the code and speed up the response.

Moreover, this would ensure higher success rates for users running this backend behind NAT.

Other ideas

Reduce activation threshold

Unfortunately, this configuration is global, so may not work for us, but this solved a similar problem in Vole https://github.com/ipfs-shipyard/vole/pull/39/files

Related issues

https://github.com/libp2p/go-libp2p/issues/2941

2color avatar Aug 29 '24 15:08 2color