arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation
http://libtorrent.org
Other
5.24k stars 997 forks source link

[Feature request] Support NAT hole punching when PEX and DHT are closed #7207

Open Illustar0 opened 1 year ago

Illustar0 commented 1 year ago

As we all know, when downloading a Private Torrent, uTP cannot perform hole punching, because PEX and DHT are closed, which makes the connection of users without public network IP quite poor. But recently I found an open source tool that can help users whose NAT type is FullCone to map the internal network port to the public network. The only disadvantage is that the public network port is random. This makes it possible for libtorrent to realize TCP and UDP hole punching without PEX and DHT

In fact, I tried deploying this tool on a router with firewall port forwarding, and successfully received incoming connections from other peers in Private Torrent in qbittorrent (I don't have a public IP) . In contrast, without deploying this tool, I cannot receive incoming connections, and the peers that can actively connect are also very limited, only those with public IPs.

So, I hope that libtorrent can make some improvements to support TCP/UDP hole punching without PEX and DHT environment

natter (the tool, written by python): https://github.com/MikeWang000000/Natter/tree/v0.9 natmap (C language version of natter): https://github.com/heiher/natmap

parthibx24 commented 1 year ago

@XCwosjw doesn't webrtc solve the same problem? It's being added to this library...

Illustar0 commented 1 year ago

It's interesting, and more efficient than what I've come up with. Looking forward to the release of a version that supports webtorrent

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

ThaUnknown commented 1 year ago

unfortunately, the webtorrent spec never defined how to support PeX or DHT so it was never implemented, webrtc functions a lot differently than other protocols so it was never decided how it should be accomplished

Illustar0 commented 1 year ago

Maybe you didn't notice what I said. What I'm hoping to achieve is exactly the NAT hole punching with PEX and DHT off (or not implemented)

In fact I usually use natter and natmap to open TCP rather than UDP ports to the public network, Because natter's support for UDP is not perfect

@arvidn Are there any plans to make this happen?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.