Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 webtorrent/bittorrent-dht#88
Per the BEP 32 statement about maintaining distinct IPv4/IPv6 DHTs and the discussion on webtorrent/bittorrent-dht#88, my implementation requires separate instances of
bittorrent-dht
and everything below it on the protocol stack (k-rpc
andk-rpc-socket
).torrent-discovery
maintains up to twoDHT
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
, andwebtorrent-cli
are sibling directories, the following commands will set things up properly (starting from the parent directory):From there, you can test and run individual modules as you choose.
torrent-discovery specific notes:
This PR allows
torrent-discovery
to handle up to twoDHT
instances, one for each IP version used. To control the IPv6 instance, I've added adht6
parameter to the constructor, which behaves in exactly the same way as the regulardht
parameter. As always, tests are wrapped in order to be run for either IPv4 and IPv6. I've added a separate test to exercise both simultaneously.Notes:
DHT
instance they come from. Since users of this library already need to be able to handle IPv4 and IPv6 peers (sincebittorrent-dht
supports IPv4 and IPV6 trackers), this should be fine.Caveats: