Repository navigation
Add a SOCKS5 proxy option to the Electrum client - #199
Open
zebra-nerd wants to merge 3 commits into
Open
zebra-nerd wants to merge 3 commits into
zebra-nerd wants to merge 3 commits into
Conversation
The Electrum client could not be told to use a SOCKS5 proxy, so an application sending its wallet traffic through Tor had to wrap the whole process or put a relay in front of the server. electrum-client supports SOCKS5 and its `proxy` feature is already enabled here; the builder never passed a proxy on. - Add `ElectrumClientBuilder::socks5()`, taking the proxy as `host:port`. - The server host goes to the proxy as a domain name and is resolved there, so `.onion` urls work and no local DNS query is made. A unit test pins this against a local listener.
Expose the SOCKS5 proxy option of the Electrum client builder, so the foreign languages can connect through a proxy such as Tor. - Add the optional `socks5` field to the `ElectrumClientBuilder` record. - Add a Python example that runs offline against a local listener and checks the proxy is handed the server host name.
- Add a "SOCKS5 proxy" section to the Electrum client page. - List the new Python example.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Electrum client cannot be told to use a SOCKS5 proxy, so an application that sends its wallet traffic through Tor has to wrap the whole process (torsocks) or put a relay in front of the server.
electrum-clientalready supports SOCKS5 and itsproxyfeature is already enabled inlwk_wollet; the builder just never passes a proxy on.This adds
ElectrumClientBuilder::socks5()inlwk_wolletand the matching optionalsocks5field on the bindings'ElectrumClientBuilderrecord:host:port, aselectrum_client::Socks5Config::newtakes it..onionurls work and no DNS query for the server is made locally. A unit test inlwk_wolletand the Python example pin this against a local listener that reads the CONNECT request and refuses it; neither needs the network.Not in this PR:
socksfeature and a cfg for wasm, where a proxy cannot be set. I can send it separately if this direction is fine.Socks5Config::with_credentials, which Tor uses for stream isolation). The builder derivesDebug, so that would need a redacting impl first.TokenProvider::Blockstream: the OAuth2 token is still fetched over a direct HTTPS connection. This is stated in the doc comment ofsocks5()and in the docs page.lwk_cliandlwk_wasm(the Electrum client is not built for wasm).This supersedes #60, which added the option to
ElectrumOptions, deprecated since.Checked locally:
cargo fmt --check,cargo test -p lwk_wollet --lib(142 passed), and the new Python example against a release build of the bindings.cargo clippy --all-targets -- -D warningswas run with a newer toolchain than the pinned one (1.99.1), where it only reports lints in files this PR does not touch.