Add shecan DoH provider

Closes #8557
This commit is contained in:
arkon 2022-11-18 22:12:19 -05:00
parent a8e45beb51
commit d12ea86b55
3 changed files with 17 additions and 2 deletions

View file

@ -48,6 +48,7 @@ import eu.kanade.tachiyomi.network.PREF_DOH_MULLVAD
import eu.kanade.tachiyomi.network.PREF_DOH_NJALLA
import eu.kanade.tachiyomi.network.PREF_DOH_QUAD101
import eu.kanade.tachiyomi.network.PREF_DOH_QUAD9
import eu.kanade.tachiyomi.network.PREF_DOH_SHECAN
import eu.kanade.tachiyomi.util.CrashLogUtil
import eu.kanade.tachiyomi.util.lang.launchNonCancellable
import eu.kanade.tachiyomi.util.lang.withUIContext
@ -257,6 +258,7 @@ class SettingsAdvancedScreen : SearchableSettings {
PREF_DOH_MULLVAD to "Mullvad",
PREF_DOH_CONTROLD to "Control D",
PREF_DOH_NJALLA to "Njalla",
PREF_DOH_SHECAN to "Shecan",
),
onValueChanged = {
context.toast(R.string.requires_app_restart)

View file

@ -20,6 +20,7 @@ const val PREF_DOH_QUAD101 = 8
const val PREF_DOH_MULLVAD = 9
const val PREF_DOH_CONTROLD = 10
const val PREF_DOH_NJALLA = 11
const val PREF_DOH_SHECAN = 12
fun OkHttpClient.Builder.dohCloudflare() = dns(
DnsOverHttps.Builder().client(build())
@ -145,7 +146,6 @@ fun OkHttpClient.Builder.dohMullvad() = dns(
* unfiltered option
* Source : https://controld.com/free-dns/?
*/
fun OkHttpClient.Builder.dohControlD() = dns(
DnsOverHttps.Builder().client(build())
.url("https://freedns.controld.com/p0".toHttpUrl())
@ -160,7 +160,6 @@ fun OkHttpClient.Builder.dohControlD() = dns(
/*
* Njalla
*
* Non logging and uncensored
*/
fun OkHttpClient.Builder.dohNajalla() = dns(
@ -172,3 +171,16 @@ fun OkHttpClient.Builder.dohNajalla() = dns(
)
.build(),
)
/**
* Source: https://shecan.ir/
*/
fun OkHttpClient.Builder.dohShecan() = dns(
DnsOverHttps.Builder().client(build())
.url("https://free.shecan.ir/dns-query".toHttpUrl())
.bootstrapDnsHosts(
InetAddress.getByName("178.22.122.100"),
InetAddress.getByName("185.51.200.2"),
)
.build(),
)

View file

@ -54,6 +54,7 @@ class NetworkHelper(context: Context) {
PREF_DOH_MULLVAD -> builder.dohMullvad()
PREF_DOH_CONTROLD -> builder.dohControlD()
PREF_DOH_NJALLA -> builder.dohNajalla()
PREF_DOH_SHECAN -> builder.dohShecan()
}
return builder