Add Mullvad and Control D as DoH providers (#7785)

This commit is contained in:
Ahmad Azwar Annas 2022-08-18 12:59:40 +00:00 committed by GitHub
parent 1f9f9662bc
commit 80b4b7bee6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 0 deletions

View File

@ -17,6 +17,8 @@ const val PREF_DOH_ALIDNS = 5
const val PREF_DOH_DNSPOD = 6 const val PREF_DOH_DNSPOD = 6
const val PREF_DOH_360 = 7 const val PREF_DOH_360 = 7
const val PREF_DOH_QUAD101 = 8 const val PREF_DOH_QUAD101 = 8
const val PREF_DOH_MULLVAD = 9
const val PREF_DOH_CONTROLD = 10
fun OkHttpClient.Builder.dohCloudflare() = dns( fun OkHttpClient.Builder.dohCloudflare() = dns(
DnsOverHttps.Builder().client(build()) DnsOverHttps.Builder().client(build())
@ -120,3 +122,37 @@ fun OkHttpClient.Builder.dohQuad101() = dns(
) )
.build(), .build(),
) )
/*
* Mullvad DoH
* without ad blocking option
* Source : https://mullvad.net/en/help/dns-over-https-and-dns-over-tls/
*/
fun OkHttpClient.Builder.dohMullvad() = dns(
DnsOverHttps.Builder().client(build())
.url("https://doh.mullvad.net/dns-query".toHttpUrl())
.bootstrapDnsHosts(
InetAddress.getByName("194.242.2.2"),
InetAddress.getByName("193.19.108.2"),
InetAddress.getByName("2a07:e340::2"),
)
.build(),
)
/*
* Control D
* unfiltered option
* Source : https://controld.com/free-dns/?
*/
fun OkHttpClient.Builder.dohControlD() = dns(
DnsOverHttps.Builder().client(build())
.url("https://freedns.controld.com/p0".toHttpUrl())
.bootstrapDnsHosts(
InetAddress.getByName("76.76.2.0"),
InetAddress.getByName("76.76.10.0"),
InetAddress.getByName("2606:1a40::"),
InetAddress.getByName("2606:1a40:1::"),
)
.build(),
)

View File

@ -47,6 +47,8 @@ class NetworkHelper(context: Context) {
PREF_DOH_DNSPOD -> builder.dohDNSPod() PREF_DOH_DNSPOD -> builder.dohDNSPod()
PREF_DOH_360 -> builder.doh360() PREF_DOH_360 -> builder.doh360()
PREF_DOH_QUAD101 -> builder.dohQuad101() PREF_DOH_QUAD101 -> builder.dohQuad101()
PREF_DOH_MULLVAD -> builder.dohMullvad()
PREF_DOH_CONTROLD -> builder.dohControlD()
} }
return builder return builder

View File

@ -23,8 +23,10 @@ import eu.kanade.tachiyomi.network.PREF_DOH_ALIDNS
import eu.kanade.tachiyomi.network.PREF_DOH_CLOUDFLARE import eu.kanade.tachiyomi.network.PREF_DOH_CLOUDFLARE
import eu.kanade.tachiyomi.network.PREF_DOH_DNSPOD import eu.kanade.tachiyomi.network.PREF_DOH_DNSPOD
import eu.kanade.tachiyomi.network.PREF_DOH_GOOGLE import eu.kanade.tachiyomi.network.PREF_DOH_GOOGLE
import eu.kanade.tachiyomi.network.PREF_DOH_MULLVAD
import eu.kanade.tachiyomi.network.PREF_DOH_QUAD101 import eu.kanade.tachiyomi.network.PREF_DOH_QUAD101
import eu.kanade.tachiyomi.network.PREF_DOH_QUAD9 import eu.kanade.tachiyomi.network.PREF_DOH_QUAD9
import eu.kanade.tachiyomi.network.PREF_DOH_CONTROLD
import eu.kanade.tachiyomi.ui.base.controller.openInBrowser import eu.kanade.tachiyomi.ui.base.controller.openInBrowser
import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.base.controller.pushController
import eu.kanade.tachiyomi.ui.setting.database.ClearDatabaseController import eu.kanade.tachiyomi.ui.setting.database.ClearDatabaseController
@ -196,6 +198,8 @@ class SettingsAdvancedController(
"DNSPod", "DNSPod",
"360", "360",
"Quad 101", "Quad 101",
"Mullvad",
"Control D",
) )
entryValues = arrayOf( entryValues = arrayOf(
"-1", "-1",
@ -207,6 +211,8 @@ class SettingsAdvancedController(
PREF_DOH_DNSPOD.toString(), PREF_DOH_DNSPOD.toString(),
PREF_DOH_360.toString(), PREF_DOH_360.toString(),
PREF_DOH_QUAD101.toString(), PREF_DOH_QUAD101.toString(),
PREF_DOH_MULLVAD.toString(),
PREF_DOH_CONTROLD.toString(),
) )
defaultValue = "-1" defaultValue = "-1"
summary = "%s" summary = "%s"