From d12ea86b5528522e7afc76d49eedbd3a01f02e03 Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 18 Nov 2022 22:12:19 -0500 Subject: [PATCH] Add shecan DoH provider Closes #8557 --- .../settings/screen/SettingsAdvancedScreen.kt | 2 ++ .../eu/kanade/tachiyomi/network/DohProviders.kt | 16 ++++++++++++++-- .../eu/kanade/tachiyomi/network/NetworkHelper.kt | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt index f9d1e0307..5469836d2 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt @@ -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) diff --git a/core/src/main/java/eu/kanade/tachiyomi/network/DohProviders.kt b/core/src/main/java/eu/kanade/tachiyomi/network/DohProviders.kt index 9c71919c5..95f448f13 100644 --- a/core/src/main/java/eu/kanade/tachiyomi/network/DohProviders.kt +++ b/core/src/main/java/eu/kanade/tachiyomi/network/DohProviders.kt @@ -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(), +) diff --git a/core/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt b/core/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt index 7c6388773..adf77d07e 100644 --- a/core/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt +++ b/core/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt @@ -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