-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
DHT doesn't work under proxy #4078
Comments
yes, the log shows that the DHT packets aren't going through. what kind of proxy are you using? does it support UDP? |
I think yes, because, for example, in qBittorrent or tTorrent DHT and UDP trackers works when using this proxy. |
qbittorrent uses libtorrent, and there are options to bypass the proxy for UDP, if the proxy doesn't support it. What kind of proxy are you using? i.e. what are you setting the |
|
HTTP proxies can only proxy TCP streams. the DHT runs over UDP, so it doesn't work over an HTTP proxy |
So, qbittorrent just doesn't connect DHT over HTTP proxy? But how? |
I don't know what the default qbt settings are. |
Thank you, I will check SOCKS and write about the results. |
I configured Dante on my server and allowed it UDP:
I tested the same tracker in qbittorrent (PC network), my application (mobile network) and ttorrent (mobile network) - Main moments from
And
|
Could this be due to the fact that I didn't enabled an option that is responsible for this? I studied the documentation but didn’t find anything like it (except |
The proper way to debug this is to get a wireshark capture of your communication with the SOCKS5 proxy. Both the TCP and the UDP stream. I would be happy to look at a capture to see what's wrong. There is a unit test (that's passing) exercising the UDP over SOCKS5, here. As a sanity check, you could run this test to make sure it passes for you too. |
I made wireshark dump. Before dumping, I discovered another moment: So, the initial parameters before wireshark dumping:
Dump 1: I made wireshark dump only on a proxy server machine: session_log_1.txt Dump 2: I made wireshark dump both on the proxy server and on the client (Android). Android allows packets sniffing only through VpnService, but it doesn't support UDP, so the results are most likely incorrect: |
Dump 3: I found a workaround: I launched the Android emulator on my PC and turned on Wireshark. As a network, I used a USB LTE modem. Now I was able to sniff UDP on the client side.
|
is I see multiple successful The first one is: followed by: I see all UDP traffic going to I'm not entirely sure why libtorrent creates so many UDP associate calls, perhaps it does one per local listen interface. You could try to bind the local listen socket to a single IP/interface, then there will probably only be one socket created. So, this could be improved in libtorrent by moving the UDP SOCKS5 logic to a higher level, that replaces all listen sockets. Or perhaps more accurately, allow annotating which sockets are running over SOCKS5 in the Either way, as far as I can see, all the interaction with the proxy is correct from libtorrent's point of view. |
Yes
I use |
what I meant is that if you listen on two sockets, there will be two sockets that are created and mapped on the SOCKS5 proxy. If the proxy only supports one at a time, that might be problematic. |
That is, use |
how many |
Once:
Seems to be yes. android_emulator_client_dump_4.zip .
|
For comparison, I connected the emulator to the same network as the proxy server and set
|
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. |
@arvidn Hi. Please see the results that I managed to get earlier. |
I believe current |
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. |
@arvidn DHT does not work on any type of proxy. |
@arvidn |
I must have mis-typed. Confusing the settings to control whether peers and trackers use the proxy. |
Wouldn't it make sense to add one? Or maybe even separately for DHT... |
@arvidn Please pay attention to this. There is no point in using a proxy for DHT, because DHT stops working. You need to ask the user if they want to proxy DHT traffic. |
This comment was marked as off-topic.
This comment was marked as off-topic.
please stop declaring that things "don't work". please provide a wireshark dump demonstrating it not working. (Or some other useful record of it) not proxying DHT traffic would make other peers start contacting you directly, not via the proxy. That doesn't seem desirable. |
libtorrent version (or branch): libtorrent4j-1.2.1.0 (libtorrent 1.2.1)
platform/architecture: Android
Hello. In my torrent client for Android I use libtorrent. The only problem I encountered: DHT does not work if I setup a proxy. I checked this in similar apps that use libtorrent - DHT under proxy works fine. Here is the full session and DHT log right after launch: session.log
Basic moments:
I also used the option
proxy_peer_connections = true
, but this didn't work.The text was updated successfully, but these errors were encountered: