go-libp2p-kad-dht icon indicating copy to clipboard operation
go-libp2p-kad-dht copied to clipboard

Libp2p DHT

Open Stebalien opened this issue 5 years ago • 2 comments

Currently, the DHT in this package is the "IPFS" DHT.

  1. It's called IpfsDHT.
  2. It's protocol starts with /ipfs.
  3. It requires the IPFS DHT validators.
  4. It defaults to a special "auto" mode where nodes won't join the DHT until they're publicly reachable.

These are all requirements for the IPFS DHT, but not requirements for DHTs in general. Worse, the IPFS DHT is actually a dual DHT at this point because dht.New will return a semi-broken DHT that will refuse to work on private/localhost networks.

For motivation, see: https://github.com/libp2p/go-libp2p-kad-dht/issues/569, https://github.com/libp2p/go-libp2p-kad-dht/issues/564, https://github.com/libp2p/go-libp2p-kad-dht/issues/561.

We should:

  • [ ] Rename the DHT: #337, #419.
  • [ ] Change the constructor:
    • [ ] No default validators (maybe /pk?).
    • [ ] Server mode by default.
    • [ ] Make the protocol name a mandatory argument.
    • [ ] Remove the IPFS DHT bootstrappers.
  • [ ] Introduce a new ipfs/go-ipfs-dht package in a new repo. We could also put an IPFS DHT sub-package in this repo, but it's probably cleaner if that lives in the IPFS repo.
    • This new package should have a simple New() function that takes very few options.

This way, users trying to build libp2p apps can explicitly choose which DHT they want to join and how they want to configure their network.

Stebalien avatar Apr 21 '20 00:04 Stebalien

cc @raulk.

Stebalien avatar Apr 21 '20 00:04 Stebalien

  • [ ] https://github.com/libp2p/go-libp2p-examples/issues/156 is also a good subtask for this epic

willscott avatar Apr 21 '20 17:04 willscott