node: Fix tor proxy issue for regular addresses

This should allow using a Tor proxy for regular connections.
This commit is contained in:
Alexis Sellier 2024-05-09 21:45:48 +02:00
parent 6ab3bfcba0
commit 9766c67671
No known key found for this signature in database
1 changed files with 3 additions and 3 deletions

View File

@ -1060,10 +1060,10 @@ pub fn dial<G: Signer + Ecdh<Pk = NodeId>>(
signer: G, signer: G,
config: &service::Config, config: &service::Config,
) -> io::Result<WireSession<G>> { ) -> io::Result<WireSession<G>> {
// Convert the remote address into an internet protocol address (IP or DNS).
let inet_addr: NetAddr<InetHost> = match config.tor { let inet_addr: NetAddr<InetHost> = match config.tor {
// In Tor proxy mode, simply specify a different connection address. // In Tor proxy mode, simply specify the proxy address for all connections,
Some(TorConfig::Proxy { address: proxy }) => remote_addr.connection_addr(proxy.into()), // since we'll be routing all connections through the proxy.
Some(TorConfig::Proxy { address: proxy }) => proxy.into(),
// In transparent Tor mode, we treat `.onion` addresses as regular DNS names. // In transparent Tor mode, we treat `.onion` addresses as regular DNS names.
Some(TorConfig::Transparent) => { Some(TorConfig::Transparent) => {
let host = match &remote_addr.host { let host = match &remote_addr.host {