Skip to content
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

Support SOCSK5 proxy for BT UDP Trackers and DHT connections #1857

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

myl7
Copy link

@myl7 myl7 commented Dec 5, 2021

The PR adds a new class DHTConnectionSocksProxyImpl which inherients DHTConnectionImpl, and is used in DHTSetup, to provide SOCKS5 proxy support for UDP connections in BT, including UDP tracker and DHT connections (as DHTConnectionImpl is used by both DHT and UDP trackers despite the name).

The actual SOCKS5 logic is wrapped in class SocksProxySocket, to make it possible to reuse the logic in other features like general SOCKS5 proxy support for HTTP downloading.

The PR also adds options bt-udp-socks-proxy, bt-udp-socks-proxy-user, and bt-udp-socks-proxy-pass to configure the proxy. When no proxy is set, the app fallbacks to use DHTConnectionImpl that is without proxy. Parsing and cleaning of bt-udp-socks-proxy uses newly added SocksProxyOptionHandler, which works like HttpProxyOptionHandler. These UDP proxy options, though put aside other proxy options, wont be overrided by all-proxy.

A test has been included in the PR. However, as the test requires a SOCKS5 proxy server, currently the test is surpressed by early returning. I would like to suggest adding a SOCKS5 proxy server as fixtures via adding a 3rd party library or asking developers to start one in advance by such as GOST.

Ref: #470 and part of #153

@kendling
Copy link

I need this function too.

@exebook
Copy link

exebook commented May 6, 2023

btw if you need a quick SOCKS5 server you can do this:
ssh -N -D 1080 $SERVER
It will create SOCKS5 server on 1080, you just need ssh access to some SERVER.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants