mediachain / concat

Mediachain daemons
MIT License
42 stars 13 forks source link

Peer discovery through DHT rendezvous #128

Closed vyzo closed 7 years ago

vyzo commented 7 years ago

The gist: ue use DHT provider records as a rendezvous mechanism:

Example:

$ curl http://127.0.0.1:9002/net/find
QmSbgwkKxtrBFDoGGwoKqH7soYiL64xpMK5oEYdiRnQGJp

$ mcclient id QmSbgwkKxtrBFDoGGwoKqH7soYiL64xpMK5oEYdiRnQGJp
Peer ID: QmSbgwkKxtrBFDoGGwoKqH7soYiL64xpMK5oEYdiRnQGJp
Publisher ID: 4XTTMGkYEx5trQX5VV32S82gguRMtVFQL5UDnZNHzyNEHKBeZ
Info: Mediachain Labs test node
yusefnapora commented 7 years ago

Looks good 😄

Should we be keeping a cache of discovered peers, or is that handled for us by the DHT layer? Although perhaps we don't really want to, since we don't want stale results from nodes that have gone offline.

Anyway, it's great that this works. With this + manifests it seems like we're on our way to becoming less dependent on the directories.

vyzo commented 7 years ago

There is no caching at the DHT client, but there is caching (with a hefty ttl) in full DHT nodes.

We could perhaps cache the provider addresses in the peerstore to avoid a subsequent lookup for a peer returned in the result set.