nictuku / dht

Kademlia/Mainline DHT node in Go.
Other
826 stars 144 forks source link

Proposal/Feature request: Add IPv6 support. #29

Closed spikebike closed 9 years ago

spikebike commented 10 years ago

One of the harder parts of P2P is dealing with IP Masq/NAT'd peers. Fortunately there's an awesome fix, IPv6. Google claims 9.85% of Google's traffic in the USA is from IPv6 users, far from a trivial number. I've managed to get IPv6 connectivity working at 2 locations so I can tinker. Comcast is giving out /60's to regular home users!

I'm going to take a shot at it. I've not written any IPv6 code before though.

The resources I'm referencing are https://github.com/jech/dht and http://www.bittorrent.org/beps/bep_0032.html.

Just figured I'd post here in case anyone else is interested or planning similar.

nictuku commented 10 years ago

Yep, it would be great to see IPv6 support in the library.

spikebike commented 10 years ago

My fork is not ready to merge, but it's getting closer. It swap's peers over IPv6, not currently finding peers with the same infohash tough. Changes outside of nettools has been 2 or so lines so far.

benjojo commented 10 years ago

This is great work! I would love to see this working as alot of my own systems are now using this library and have IPv6 addresses!

spikebike commented 10 years ago

I have all the basic IPv6 working. Bootstrapping works, although I could only find one public IPv6 bootstrapping host. Find_node, Get_peers, and related seem to work fine. I ran the example code to find peers for the same infohash on 3 machines and they found each other quickly.

So pure IPv4 works, pure IPv6 works. Still have supported the "want" feature to allow IPv4 peers to share IPv6 addresses and vice versa. BEP_0032 gives me the impression that the language they had in mind didn't hide all the IPv4/v6 implementation details to allow the same code to handle both protocols.

Have to ponder some implementation ideas like:

spikebike commented 10 years ago

I've issued a pull request on a working implementation of IPv6 for this DHT.

spikebike commented 9 years ago

Tweaked pull request with feedback from nictuku.

nictuku commented 9 years ago

Should we consider this closed? :)

spikebike commented 9 years ago

One piece of functionality is missing is the BEP described ability to query IPv4 peers for new IPv6 peers and vice versa. Seems to only be a bootstrapping issue. It's on the todo list, but not sure which approach would be best.

But yeah, I consider this closed.