Skip to content

feat: support tor .onion relay storage and connections#154

Merged
barrydeen merged 1 commit intomainfrom
feat/tor-relay-storage
Mar 3, 2026
Merged

feat: support tor .onion relay storage and connections#154
barrydeen merged 1 commit intomainfrom
feat/tor-relay-storage

Conversation

@barrydeen
Copy link
Owner

Summary

  • Users can now add .onion relays to any relay list at any time, regardless of Tor state
  • .onion relays are only connected when Tor is active — silently skipped otherwise
  • Fixed cleartext ws:// blocked by Android network security policy for .onion domains
  • Fixed OkHttpClient not having Tor proxy when Tor is enabled before login/startup
  • Fixed relay probe timeout too short for Tor (4s → 15s) and wrong protocol order for .onion
  • Fixed relay picker ignoring user-specified ws:///wss:// protocol
  • Added broadcast feedback toast to relay screen

Test plan

  • Add a .onion relay with Tor off — should be accepted and saved
  • The .onion relay appears in relay list but is not connected
  • Enable Tor — .onion relay auto-connects
  • Disable Tor — .onion relay disconnects but stays in the saved list
  • Enable Tor before login, login — .onion relays in saved list connect
  • Use relay feed picker to connect to a .onion relay while Tor is active
  • Broadcast relay list shows toast confirmation
  • Clearnet relays still work normally with Tor on and off

Split RelayConfig.isAcceptableUrl into isValidUrl (structural
validation, always allows .onion) and isConnectableUrl (checks Tor
state). Users can always add .onion relays to their lists; connections
are only attempted when Tor is active.

- Add network security config to allow cleartext ws:// for .onion
- Lazily rebuild OkHttpClient when Tor state changes (ensureClientCurrent)
- Fix relay probe: try ws:// first for .onion, increase timeout for Tor
- Fix relay picker to respect user-specified protocol (ws:// or wss://)
- Pass saved relay configs on Tor switch to pick up .onion relays
- Add broadcast feedback toast to relay screen
- Add TorRelay debug logging for connection troubleshooting
@barrydeen barrydeen merged commit 9d85729 into main Mar 3, 2026
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.

1 participant