feat: add Tor SOCKS5 proxy support for outbound .onion connections #91
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.
Summary
connection.rsfor routing outbound peer connections through a Tor proxyset_tor_proxy_address()onNodeBuilder(FFI-compatible via UDL) to configure the SOCKS5 proxy.onion(OnionV3) addresses through SOCKS5 with Tor stream isolation (random password auth per connection), clearnet addresses through direct TCPlightning_net_tokio::tor_connect_outbound()from upstream PR Add Tor support for outbound connections via SOCKS lightningdevkit/ldk-node#778Relates to getAlby/hub#2035
Related PRs
This is part of a 3-PR series enabling Tor .onion-to-.onion Lightning peer connections in Alby Hub:
Dependency chain: PR 1 → PR 2 → PR 3
Files changed
src/connection.rs— SOCKS5 handshake, base32 encoder for OnionV3 address derivation, routing logic + 15 unit testssrc/builder.rs—tor_proxy_addressfield andset_tor_proxy_address()method onNodeBuilderbindings/ldk_node.udl— FFI interface definition forset_tor_proxy_addressTest plan
cargo test --lib connection::tests— 15 tests passing (base32 encoding, SOCKS5 protocol with mock proxy)cargo checkpasses with zero warnings🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com