libtorrent icon indicating copy to clipboard operation
libtorrent copied to clipboard

UDP tracker with hostname always fails over SOCKS5

Open arvidjaar opened this issue 1 year ago • 0 comments

libtorrent version (or branch): 2.0.5 platform/architecture: Ubuntu 22.04, x86_64 compiler and compiler version: Distribution package libtorrent-rasterbar2.0:amd64 2.0.5-5 please describe what symptom you see, what you would expect to see instead and how to reproduce it. qBittorrent client fails to talk to UDP tracker using hostname in URL over SOCKS5, e.g. udp://tracker.opentrackr.org:1337. There are two problems, this is the second one. The first one is reported as https://github.com/arvidn/libtorrent/issues/6986

The udp_tracker_connection::send_udp_connect() tries to pass remote host name to SOCKS5 server using udp_socket::send_hostname(). But this function only works when "hostname" is numerical IP address and fails for normal hostname.

As proof of concept I commented out check for SOCKS5 proxy in udp_tracker_connection::start() which forces it to resolve hostname locally and use IP addresses when talking to SOCKS5 proxy. This has advantage of trying to use all addresses instead of relying on proxy to chose "good" one.

With SOCKS5 servers I tried I also needed another patch from issue 6986, but it is not directly related to this specific problem.

arvidjaar avatar Jul 30 '22 18:07 arvidjaar