Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPFS DHT integration #90

Merged
merged 16 commits into from
Dec 5, 2016
Merged

IPFS DHT integration #90

merged 16 commits into from
Dec 5, 2016

Conversation

vyzo
Copy link
Contributor

@vyzo vyzo commented Dec 2, 2016

Wherein we take the firsts steps to integrate with IPFS:

  • Refactors mcnode/proto to extract network related functionality
  • Integrates libp2p-kad-dht and connects to the DHT as a client, with bootstrap through the IPFS planets; leeching ok for now per jbenet.
  • Node.doLookup is modified to use the DHT for looking up peers as a fallback to directory lookup (or when there is no directory), and also caches lookup results with the standard peerstore ttl
  • Fixes peer api operations to fail consistently with 404 when there is a peer lookup failure.
  • Adds a /net/lookup/{peerId} endpoint to perform network lookups for debugging purposes

Closes #81

Example of node discovery through DHT:

$ mcclient listPeers
QmeiY2eHMwK92Zt6X4kUUC3MsjMmVb2VnGZ17DhnhRPCEQ
QmSp4R1R3rk7ho8M6P24sQG2yFiz8THYjwei468sz3GbSM
QmTVsocFCSEdPyM8dZ734GRhjvvmYyL9fShyezVkbPj17E
QmZ6dckUhRouVr6AsBTpK6vMLVpcz1KAeJAJVQEZQ5gCek

# DHT lookup!
$ curl http://localhost:9002/net/lookup/QmSbgwkKxtrBFDoGGwoKqH7soYiL64xpMK5oEYdiRnQGJp
/ip4/10.10.1.191/tcp/9001
/ip4/54.242.130.109/tcp/9001

$ mcclient id QmSbgwkKxtrBFDoGGwoKqH7soYiL64xpMK5oEYdiRnQGJp
Peer ID: QmSbgwkKxtrBFDoGGwoKqH7soYiL64xpMK5oEYdiRnQGJp
Publisher ID: 4XTTMGkYEx5trQX5VV32S82gguRMtVFQL5UDnZNHzyNEHKBeZ
Info: Mediachain Labs test node

Copy link
Contributor

@parkan parkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff for net.go was being suppressed and I was very confused, makes sense now.

@vyzo vyzo merged commit 8794a47 into master Dec 5, 2016
@vyzo vyzo deleted the vyzo-dht branch December 5, 2016 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants