Skip to content

Fix reconnection to clearnet addresses via Tor #3054

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rorp
Copy link
Contributor

@rorp rorp commented Apr 1, 2025

Fixes #3051

@t-bast
Copy link
Member

t-bast commented Apr 1, 2025

At first glance, this seems to be incorrect: it will incorrectly use Tor in some configurations. But I'll need to spend more time looking at this again and how we configure it to be sure.

@sstone does that ring a bell? I'm pretty sure we had these distinct cases for a good reason.

@sstone
Copy link
Member

sstone commented Apr 1, 2025

The proposed change do not check useForIPv4 and useForIPv6 anymore which does seem wrong. I commented on the linked issue which describes 2 different problems (the first one being the expected behaviour when the socks5 proxy is configured to handle all connections).

@rorp
Copy link
Contributor Author

rorp commented Apr 2, 2025

At first glance, this seems to be incorrect

It appears to be a logical approach. When outgoing Tor connections are disabled, we are effectively unable to connect to Tor addresses, so we default to selecting only clearnet addresses.

Conversely, if Tor connections are enabled, we consider all available addresses - both Tor and clearnet - and randomly select one. Client actor then establishes a connection to the chosen address via either Tor or clearnet, depending on the configuration settings.

@rorp
Copy link
Contributor Author

rorp commented Apr 2, 2025

It can be incorrect if use-for-tor is set to false. In this case, even if Tor is enabled, it will attempt to connect to Tor addresses via clearnet, which doesn't make sense at all.

I think we can remove use-for-tor configuration parameter.

@rorp rorp force-pushed the fix_reconnection_to_clearnet_addresses_via_tor branch from 6ad6c83 to 9aaffa2 Compare April 3, 2025 16:51
@rorp
Copy link
Contributor Author

rorp commented Apr 3, 2025

It can be incorrect if use-for-tor is set to false. In this case, even if Tor is enabled, it will attempt to connect to Tor addresses via clearnet, which doesn't make sense at all.

I added a handler for this unlikely case, too.

@rorp rorp force-pushed the fix_reconnection_to_clearnet_addresses_via_tor branch from 9aaffa2 to add2616 Compare April 4, 2025 12:28
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.

Issue with Tor configuration causing unnecessary force closures
3 participants