Эх сурвалжийг харах

Add shecan DoH provider

Closes #8557
arkon 2 жил өмнө
parent
commit
d12ea86b55

+ 2 - 0
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)

+ 14 - 2
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(),
+)

+ 1 - 0
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