Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(doh): Add LibreDNS #1287

Merged
merged 1 commit into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import eu.kanade.tachiyomi.network.PREF_DOH_CLOUDFLARE
import eu.kanade.tachiyomi.network.PREF_DOH_CONTROLD
import eu.kanade.tachiyomi.network.PREF_DOH_DNSPOD
import eu.kanade.tachiyomi.network.PREF_DOH_GOOGLE
import eu.kanade.tachiyomi.network.PREF_DOH_LIBREDNS
import eu.kanade.tachiyomi.network.PREF_DOH_MULLVAD
import eu.kanade.tachiyomi.network.PREF_DOH_NJALLA
import eu.kanade.tachiyomi.network.PREF_DOH_QUAD101
Expand Down Expand Up @@ -289,6 +290,7 @@ object SettingsAdvancedScreen : SearchableSettings {
PREF_DOH_CONTROLD to "Control D",
PREF_DOH_NJALLA to "Njalla",
PREF_DOH_SHECAN to "Shecan",
PREF_DOH_LIBREDNS to "LibreDNS",
),
onValueChanged = {
context.stringResource(MR.strings.requires_app_restart)
Expand Down
14 changes: 14 additions & 0 deletions core/src/main/java/eu/kanade/tachiyomi/network/DohProviders.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const val PREF_DOH_MULLVAD = 9
const val PREF_DOH_CONTROLD = 10
const val PREF_DOH_NJALLA = 11
const val PREF_DOH_SHECAN = 12
const val PREF_DOH_LIBREDNS = 13

fun OkHttpClient.Builder.dohCloudflare() = dns(
DnsOverHttps.Builder().client(build())
Expand Down Expand Up @@ -183,3 +184,16 @@ fun OkHttpClient.Builder.dohShecan() = dns(
)
.build(),
)

/**
* Source: https://libredns.gr/
*/
fun OkHttpClient.Builder.dohLibreDNS() = dns(
DnsOverHttps.Builder().client(build())
.url("https://doh.libredns.gr/dns-query".toHttpUrl())
.bootstrapDnsHosts(
InetAddress.getByName("116.202.176.26"),
InetAddress.getByName("2a01:4f8:1c0c:8274::1"),
)
.build(),
)
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class NetworkHelper(
PREF_DOH_CONTROLD -> builder.dohControlD()
PREF_DOH_NJALLA -> builder.dohNajalla()
PREF_DOH_SHECAN -> builder.dohShecan()
PREF_DOH_LIBREDNS -> builder.dohLibreDNS()
}

builder.build()
Expand Down