mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 10:41:50 +01:00
DNS-over-HTTPS (Adguard) (#5715)
* Update DohProviders.kt * Update NetworkHelper.kt * Update SettingsAdvancedController.kt * fix typo * Fix typo * Fix typo
This commit is contained in:
parent
bc41040fd3
commit
0ab0dd95ae
@ -11,6 +11,7 @@ import java.net.InetAddress
|
||||
|
||||
const val PREF_DOH_CLOUDFLARE = 1
|
||||
const val PREF_DOH_GOOGLE = 2
|
||||
const val PREF_DOH_ADGUARD = 3
|
||||
|
||||
fun OkHttpClient.Builder.dohCloudflare() = dns(
|
||||
DnsOverHttps.Builder().client(build())
|
||||
@ -38,3 +39,16 @@ fun OkHttpClient.Builder.dohGoogle() = dns(
|
||||
)
|
||||
.build()
|
||||
)
|
||||
|
||||
// AdGuard "Default" DNS works too but for the sake of making sure no site is blacklisted, i picked "Unfiltered"
|
||||
fun OkHttpClient.Builder.dohAdGuard() = dns(
|
||||
DnsOverHttps.Builder().client(build())
|
||||
.url("https://dns-unfiltered.adguard.com/dns-query".toHttpUrl())
|
||||
.bootstrapDnsHosts(
|
||||
InetAddress.getByName("94.140.14.140"),
|
||||
InetAddress.getByName("94.140.14.141"),
|
||||
InetAddress.getByName("2a10:50c0::1:ff"),
|
||||
InetAddress.getByName("2a10:50c0::2:ff"),
|
||||
)
|
||||
.build()
|
||||
)
|
||||
|
@ -41,6 +41,7 @@ class NetworkHelper(context: Context) {
|
||||
when (preferences.dohProvider()) {
|
||||
PREF_DOH_CLOUDFLARE -> builder.dohCloudflare()
|
||||
PREF_DOH_GOOGLE -> builder.dohGoogle()
|
||||
PREF_DOH_ADGUARD -> builder.dohAdGuard()
|
||||
}
|
||||
|
||||
return builder
|
||||
|
@ -18,6 +18,7 @@ import eu.kanade.tachiyomi.data.library.LibraryUpdateService.Target
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import eu.kanade.tachiyomi.network.PREF_DOH_CLOUDFLARE
|
||||
import eu.kanade.tachiyomi.network.PREF_DOH_GOOGLE
|
||||
import eu.kanade.tachiyomi.network.PREF_DOH_ADGUARD
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.openInBrowser
|
||||
import eu.kanade.tachiyomi.util.CrashLogUtil
|
||||
@ -146,11 +147,13 @@ class SettingsAdvancedController : SettingsController() {
|
||||
context.getString(R.string.disabled),
|
||||
"Cloudflare",
|
||||
"Google",
|
||||
"AdGuard",
|
||||
)
|
||||
entryValues = arrayOf(
|
||||
"-1",
|
||||
PREF_DOH_CLOUDFLARE.toString(),
|
||||
PREF_DOH_GOOGLE.toString(),
|
||||
PREF_DOH_ADGUARD.toString(),
|
||||
)
|
||||
defaultValue = "-1"
|
||||
summary = "%s"
|
||||
|
Loading…
Reference in New Issue
Block a user