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

Add IPv6 DHT support #144

Closed
wants to merge 5 commits into from
Closed

Add IPv6 DHT support #144

wants to merge 5 commits into from

Conversation

Aaron1011
Copy link
Contributor

@Aaron1011 Aaron1011 commented Oct 17, 2016

k-rpc-socket | k-rpc | bittorrent-dht | torrent-discovery | webtorrent

This is one of many pull requests across the WebTorrent ecosystem to add IPv6 DHT support, as per #88

Per the BEP 32 statement about maintaining distinct IPv4/IPv6 DHTs and the discussion on #88, my implementation requires separate instances of bittorrent-dht and everything below it on the protocol stack (k-rpc and k-rpc-socket). torrent-discovery maintains up to two DHT instances, one for each IP version used. Fortunately, WebTorrent already supports IPv6 peers, so no changes are needed in it beyond properly using the IPv6 DHT, if enabled in the options.

The best way to run all of my changes is by using the npm link command. Assuming that all of the necessary modules (k-rpc-socket, k-rpc, bittorrent-dht, torrent-discovery, webtorrent, and webtorrent-cli are sibling directories, the following commands will set things up properly (starting from the parent directory):

cd k-rpc-socket
npm install
npm link
cd ../k-rpc
npm install
npm link k-rpc-socket
npm link
cd ../bittorrent-dht
npm install
npm link k-rpc
npm link
cd ../torrent-discovery
npm install
npm link bittorrent-dht
npm link
cd ../webtorrent
npm install
npm link bittorrent-dht
npm link torrent-discovery
npm link
cd ../webtorrent-cli
npm install
npm link webtorrent

From there, you can test and run individual modules as you choose.


bittorrent-dht specific notes:

This repository has comparatively few changes - most of them are just wrapping the tests to use both IPv4 and IPv6 DHTs. I make use of the _encodeIP function that I add in k-rpc to write out the encoded form of an IPv4 or IPv6 address.

Notes:

  • My implementation can parse hybrid values lists. i.e. ones which contain a mixture of IPv4 and IPv6 addresses. However, I treat them as a non-fatal error condition, since they aren't supposed to be sent.
  • For the live test, I use ubuntu-16.10-desktop-amd64.iso and ubuntu-16.10-server-amd64.iso, since the other torrents don't have any IPv6 DHT nodes available. As Ubuntu is a fairly popular Linux distribution, there should always be at least some nodes in the DHT serving it.

@DiegoRBaquero
Copy link
Member

Hey @Aaron1011 , would you be willing to update the PRs to the current code base?

@Aaron1011
Copy link
Contributor Author

@DiegoRBaquero: I'm waiting on confirmation from @feross and @mafintosh - see #88 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants