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

WIP: discover peers from cjdns #1316

Closed
wants to merge 4 commits into from
Closed

WIP: discover peers from cjdns #1316

wants to merge 4 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jun 1, 2015

Cjdns provides a private and authenticated IPv6 network on top of UDP or Ethernet. We can use its peer list ("peerstats") or routing table ("nodestore") to discover peers and assume IPFS might be running on port 4001.

This PR introduces a discovery service analogous to MDNS, which polls cjdns' admin API and then dials each of the possible peers.

It already discovers peers, but does not yet dial them, since dialing requires the peer ID. A little refactoring of swarm_dial.go will enable dialing without a peer ID. An idea for that will follow in a comment.

@jbenet jbenet added the backlog label Jun 1, 2015
interval = 5
}
return discovery.NewCjdnsService(h, time.Duration(interval)*time.Second)
}
Copy link
Author

Choose a reason for hiding this comment

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

setupDiscoveryOption will need a refactoring. Right now it can only use either MDNS or Cjdns. This is also a bad place for the default interval.

@jbenet
Copy link
Member

jbenet commented Jun 1, 2015

It already discovers peers, but does not yet dial them, since dialing requires the peer ID. A little refactoring of swarm_dial.go will enable dialing without a peer ID. An idea for that will follow in a comment.

still not 100% sure we want to allow dialing of peers without the key-- this is a step that's dangerous to do normally (it encourages people to put addresses out there without the keys, thus allowing lots of MITM). i'd prefer a cjdns-specific solution where we use the cjdns key for the ipfs node, or to make the cjdns discovery routine actually get the key (by opening a connection to the node, getting the key from the handshake, and closing the connection) -- before real dial happens. (a bit inefficient, but perhaps safer, as in the cjdns specific case, the network transport case gives us security)

@jbenet
Copy link
Member

jbenet commented Jun 1, 2015

This PR introduces a discovery service analogous to MDNS, which polls cjdns' admin API and then dials each of the possible peers.

this is great!!

@jbenet
Copy link
Member

jbenet commented Jun 1, 2015

maybe we could add /cjdns as a transport to multiaddr. although I know it should work as just /ipv6 :) (not sure)

@ghost
Copy link
Author

ghost commented Jun 2, 2015

i'd prefer a cjdns-specific solution where we use the cjdns key for the ipfs node, or to make the cjdns discovery routine actually get the key (by opening a connection to the node, getting the key from the handshake, and closing the connection) -- before real dial happens. (a bit inefficient, but perhaps safer, as in the cjdns specific case, the network transport case gives us security)

Agreed, I just thought I'll make it part of swarm_dial.go in order to avoid duplication. It's probably better to have it duplicated for now, and refactor later once it's definitely what we want. The service is small and contained, so the risk is low.

maybe we could add /cjdns as a transport to multiaddr. although I know it should work as just /ipv6 :) (not sure)

This would still require changes to both the code that expects an ID, and code that deals with IPv6. I think the other option of having the service fetch the ID before dialing, is less complicated.

@jbenet
Copy link
Member

jbenet commented Jun 2, 2015

I think the other option of having the service fetch the ID before dialing, is less complicated.

SGTM!

@whyrusleeping whyrusleeping mentioned this pull request Jun 2, 2015
58 tasks
@whyrusleeping whyrusleeping mentioned this pull request Jun 9, 2015
50 tasks
@jbenet jbenet mentioned this pull request Jun 16, 2015
55 tasks
@whyrusleeping whyrusleeping mentioned this pull request Jun 23, 2015
34 tasks
@whyrusleeping
Copy link
Member

@lgierth quick update here?

@ghost
Copy link
Author

ghost commented Jun 30, 2015

Nothing new at the moment, but fetching the PeerID before dialing, is still the approach I wanna use.

I'm closing while it's not committed to get worked on.

@ghost ghost closed this Jun 30, 2015
@jbenet jbenet removed the backlog label Jun 30, 2015
@ghost ghost self-assigned this Jun 30, 2015
@ghost
Copy link
Author

ghost commented Jun 30, 2015

Oops, I was something thinking that I hadn't committed to this PR this week.

Anyhow, no news at the moment.

@ghost ghost reopened this Jun 30, 2015
@jbenet jbenet added the status/in-progress In progress label Jun 30, 2015
@whyrusleeping whyrusleeping mentioned this pull request Jul 1, 2015
44 tasks
@jbenet jbenet mentioned this pull request Jul 8, 2015
37 tasks
@jbenet jbenet mentioned this pull request Jul 16, 2015
58 tasks
@jbenet jbenet mentioned this pull request Jul 27, 2015
43 tasks
@jbenet jbenet mentioned this pull request Aug 3, 2015
35 tasks
@ghost ghost mentioned this pull request Aug 20, 2015
16 tasks
@daviddias daviddias mentioned this pull request Sep 2, 2015
42 tasks
@ghost ghost mentioned this pull request Sep 8, 2015
41 tasks
@ghost ghost mentioned this pull request Sep 21, 2015
51 tasks
@RichardLitt RichardLitt mentioned this pull request Sep 23, 2015
65 tasks
@ghost ghost mentioned this pull request Nov 3, 2015
11 tasks
@daviddias daviddias mentioned this pull request Nov 10, 2015
42 tasks
@ghost ghost mentioned this pull request Nov 16, 2015
53 tasks
@ghost ghost mentioned this pull request Nov 26, 2015
42 tasks
Lars Gierth added 3 commits November 27, 2015 06:07
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
@ghost ghost mentioned this pull request Nov 30, 2015
14 tasks
WIP
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
@ghost ghost mentioned this pull request Dec 7, 2015
@ghost ghost added the topic/discovery Topic discovery label Dec 22, 2015
@whyrusleeping
Copy link
Member

@lgierth fine with closing this for now? future work towards this end will be done in libp2p

@ghost ghost closed this Jan 29, 2016
@Mikaela
Copy link
Contributor

Mikaela commented Feb 9, 2019

Are there any libp2p issues I could watch about this? I am wondering how integrated to Cjdns IPFS is and does that integration also help with other similar projects like Yggdrasil network?

I have been using Yggdrasil more than Cjdns lately as they provide Debian and RHEL repositories and the connections are more stable in my experience. The projects are very similar, but Yggdrasil thinks of the network as a tree instead and doesn't require supernodes. I wasn't able to find issues on this repository with the search Yggdrasil.

@Stebalien
Copy link
Member

I am wondering how integrated to Cjdns IPFS is and does that integration also help with other similar projects like Yggdrasil network

There isn't currently any built-in integration. Really, I'm not sure there needs to be any work to integrate the networks given that cjdns adds a virtual interface. That is, you should be able to run ipfs swarm connect /ip6/SOME_CJDNS_IP/tcp/4001/ipfs/Qm... and it should "just work".

This patch just used CJDNS as an additional source of potential IPFS peers.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/in-progress In progress topic/discovery Topic discovery
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants