created getProxy function

This commit is contained in:
greenart7c3
2023-04-26 10:19:30 -03:00
parent c648f54b51
commit 5d9d7ba16e
3 changed files with 8 additions and 4 deletions
@@ -14,4 +14,8 @@ object HttpClient {
fun getHttpClient(): OkHttpClient {
return OkHttpClient.Builder().proxy(proxy).build()
}
fun getProxy(): Proxy? {
return proxy
}
}
@@ -1,5 +1,6 @@
package com.vitorpamplona.amethyst.service.relays
import com.vitorpamplona.amethyst.service.HttpClient
import com.vitorpamplona.amethyst.service.model.Event
import com.vitorpamplona.amethyst.service.model.EventInterface
import kotlinx.coroutines.DelicateCoroutinesApi
@@ -76,8 +77,7 @@ object Client : RelayPool.Listener {
}
} else {
/** temporary connection */
/** TODO: set the proxy for this temporary connection */
Relay(relay, false, true, emptySet(), null).requestAndWatch() {
Relay(relay, false, true, emptySet(), HttpClient.getProxy()).requestAndWatch() {
it.send(signedEvent)
it.disconnect()
}
@@ -1,6 +1,7 @@
package com.vitorpamplona.amethyst.service.relays
import com.vitorpamplona.amethyst.model.RelaySetupInfo
import com.vitorpamplona.amethyst.service.HttpClient
object Constants {
val activeTypes = setOf(FeedType.FOLLOWS, FeedType.PRIVATE_DMS)
@@ -10,8 +11,7 @@ object Constants {
fun convertDefaultRelays(): Array<Relay> {
return defaultRelays.map {
/** TODO: set the proxy */
Relay(it.url, it.read, it.write, it.feedTypes, null)
Relay(it.url, it.read, it.write, it.feedTypes, HttpClient.getProxy())
}.toTypedArray()
}