lock to tor (#426)

* lock to tor

* bootstrap state
This commit is contained in:
callebtc
2025-09-14 16:36:02 +02:00
committed by GitHub
parent df4aa4b25d
commit 9c7567e62e
2 changed files with 24 additions and 5 deletions
@@ -43,11 +43,12 @@ object OkHttpProvider {
private fun baseBuilderForCurrentProxy(): OkHttpClient.Builder {
val builder = OkHttpClient.Builder()
val socks: InetSocketAddress? = TorManager.currentSocksAddress()
if (socks != null && TorManager.isProxyEnabled()) {
// If a SOCKS address is defined, always use it. TorManager sets this as soon as Tor mode is ON,
// even before bootstrap, to prevent any direct connections from occurring.
if (socks != null) {
val proxy = Proxy(Proxy.Type.SOCKS, socks)
builder.proxy(proxy)
}
return builder
}
}