qbittorent can use the stun server to query the port of the public network ip to help some users who do not have a public network ip to obtain better connectivity. #19487
At present in China, many users cannot obtain public network IPv4 addresses from operators . this means they have poor connectivity under IPv4 and cannot get many uploads. In this situation, TCP hole punching is a good solution.
In the Full Cone NAT environment, all requests sent with the same internal IP address and port are mapped to a specific external IP address and port. Moreover, any external host can communicate with the internal host by sending packets to the mapped external IP address and port. Therefore, if a set of mapping relationships can be continuously maintained, the effect of listening on a certain external IP address and port can be realized.
We can use the local port A to initiate a TCP long connection to maintain the NAT port mapping relationship, and use the STUN server address to obtain the corresponding public network IP and corresponding public network port B. Finally, use the port reuse feature to monitor port A at the same time to provide external services. We only need to fill in the port number of the public network port B in the listening port of qbittorrent,and configure port forwarding on the router, forward port A to the intranet port filled with the port number of B,so that some users can achieve the effect similar to having a public network ip.
Someone used a script, combined with the port forwarding function of the router, to achieve this function。
I think qbittorent should be able to integrate such a function to help more users get better connectivity.
After TCP hole punching, qBittorrent can report the public IPv4 address and port detected by STUN to the tracker, instead of the listening port in settings.
Suggestion
At present in China, many users cannot obtain public network IPv4 addresses from operators . this means they have poor connectivity under IPv4 and cannot get many uploads. In this situation, TCP hole punching is a good solution.
In the Full Cone NAT environment, all requests sent with the same internal IP address and port are mapped to a specific external IP address and port. Moreover, any external host can communicate with the internal host by sending packets to the mapped external IP address and port. Therefore, if a set of mapping relationships can be continuously maintained, the effect of listening on a certain external IP address and port can be realized.
We can use the local port A to initiate a TCP long connection to maintain the NAT port mapping relationship, and use the STUN server address to obtain the corresponding public network IP and corresponding public network port B. Finally, use the port reuse feature to monitor port A at the same time to provide external services. We only need to fill in the port number of the public network port B in the listening port of qbittorrent,and configure port forwarding on the router, forward port A to the intranet port filled with the port number of B,so that some users can achieve the effect similar to having a public network ip.
Someone used a script, combined with the port forwarding function of the router, to achieve this function。
I think qbittorent should be able to integrate such a function to help more users get better connectivity.
Use case
qBittorrent NAT TCP Hole Punching https://github.com/Mythologyli/qBittorrent-NAT-TCP-Hole-Punching/tree/master
Another use case, but it's just in Chinese https://www.cometbbs.com/t/%E5%9F%BA%E4%BA%8Estun%E7%A9%BF%E9%80%8F%E5%B7%A5%E5%85%B7lucky%EF%BC%8C%E4%BD%BFbt%E5%AE%A2%E6%88%B7%E7%AB%AF%E7%BB%BF%E7%81%AF%E3%80%81%E5%BC%80%E6%94%BEtcp%E7%AB%AF%E5%8F%A3%E7%9A%84%E5%8A%9E%E6%B3%95%EF%BC%88%E8%BF%9B%E5%8C%96%E7%89%88%EF%BC%89/82042/48
Extra info/examples/attachments
No response