Open hackergrrl opened 5 years ago
This would be super useful for a project I'm working on.
Would a PR that adds support be welcome?
@mafintosh @aral @pfrazee Is supporting IPv6 here and across hyperswam a possibility? It would be really helpful for IPv6 networks such as meshnets, and as the Internet evolves.
Sadly I haven't had time for this.
From talking to @mafintosh in the past it seems the first step would be to make an equivalent of ipv4-peers for ipv6 peers.
If someone could implement this it could be the first step for getting ipv6 to work.
After that it'd be good to set up an ipv6 DHT bootstrap node and make an example of initializing the DHT with the ipv6-peers encoding / figuring out how to do that at the hyperswarm level.
@mafintosh @RangerMauve The main driver for having IPv6 is user experience and network performance. Getting any P2P network to operate behind NAT is a pain and if you ever ran tcpdump
on most P2P nodes (like IPFS or SSB) you surely have seen how many connections attempts are being made towards RFC 1918 networks which other NATed nodes announce, and effectively wasted. I run BitTorrent and IPFS over IPv6 for a few years now and it just works like a breeze. For DAT to even work I need to create awkward port forwards or run an additional proxy node on my router to be able to talk both to NAT and other nodes on the Internet.
If this is purely matter of resources, maybe we can do some crowdsourcing on Bountysource, Gitcoin or something like that?
Part of the issue is that the tech leads for hyperswarm don't use IPv6 in their day to day so it's a bit harder for them to integrate it. I think also with regards to all the other things on the TODO list this just isn't a high priority item.
I don't think I have time to implement stuff at the moment but I'm willing to donate some time to mentor somebody else that wants to start putting it together and submitting a PR.
It might be useful to talk about this more at the next dat comm comm https://github.com/datproject/comm-comm/issues/136
Maf can give a better explanation, but my understanding is that we started with IPv4 because it has the largest adoption so it's wise to make that work first. Hyperswarm's DHT includes hole-punching specifically to handle NATs and success rates have been very high so far.
IPv6 is on the roadmap but it's not trivial to implement because it introduces duplicate addresses for each peer, and so the network has to include logic to avoid creating duplicate connections. The decision was to prioritize IPv4's success-rate before putting resources into implementing IPv6.
An alternate way of approaching this would be through webtorrent/bittorrent-dht#88, where there are already PRs to add IPv6 to the whole dat ecosystem.
@makeworld-the-better-one I don't think hyperswarm is using the bittorrent DHT anymore so it probably won't be enough. 😅
Just to share here: https://dat.discourse.group/t/where-is-dat-on-ipv6-support/32/4
I run BitTorrent and IPFS over IPv6 for a few years now and it just works like a breeze.
@kravietz can you elaborate on that? Do you mean that by using IPv6 you bypass NAT? I understand that NAT was introduced initially as a way to multiplex local addresses onto the limited IPv4 address space. But now everyone is sitting behind NAT. How does IPv6 helps? Is there any way to configure NAT to pass-through the IPv6 traffic, or are you saying this is what NAT does by default?
@urbien
When you're on IPv4 a typical set up will be like this:
123.5.5.5
on public routable IPv4, client is 10.10.10.10
. To open BitTorrent on port 12345
you need:10.10.10.10:12345
on gateway firewall10.10.10.10
123.5.5.5:12345
to 10.10.10.10:12345
(or use UPnP which does the same dynamically)On IPv6 large part of this complexity is gone:
2a02:123::1
, client uses auto-generated SLAAC address like 2a02:123:7::ccbe:c2a3:1a9c:fedd/64
[2a02:123:7::ccbe:c2a3:1a9c:fedd]:12345
which is a public routable IP and you just need to allow port 12345
on firewall to the whole world's peers to be able to talk to itIn other words, with IPv4 your gateway is a NAT translation box that needs to be configured to pass-through specific traffic. With IPv6 your gateway is simply a router that has a simple job of routing traffic between public subnets without any additional configuration.
Upcoming v5 has primitives to connect peers over ipv6
@mafintosh Is there some code I could look at to check it out? :O
related: https://github.com/webtorrent/bittorrent-dht/issues/88