Links the Tor okhttpclient with nests

This commit is contained in:
Vitor Pamplona
2026-04-28 14:45:14 -04:00
parent 66557268f7
commit 17054fc35a
4 changed files with 9 additions and 8 deletions
@@ -43,7 +43,7 @@ import kotlin.math.min
* the process; the default constructor creates a dedicated client.
*/
class OkHttpNestsClient(
private val http: OkHttpClient = OkHttpClient(),
private val httpClient: (String) -> OkHttpClient,
) : NestsClient {
override suspend fun mintToken(
room: NestsRoomConfig,
@@ -142,7 +142,7 @@ class OkHttpNestsClient(
val request = buildRequest()
val response: Response =
try {
http.newCall(request).execute()
httpClient(url).newCall(request).execute()
} catch (e: SocketException) {
transportError = e
if (++transportAttempts >= MAX_TRANSPORT_RETRIES) throw NestsException("Failed to reach $url", e)