Commit 88f01cda authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Use canary domain to avoid firefox using it's own DoH

Implements #285
parent 824bc87a
...@@ -148,7 +148,7 @@ dependencies { ...@@ -148,7 +148,7 @@ dependencies {
implementation 'com.frostnerd.utilskt:lifecycle:1.2.2' implementation 'com.frostnerd.utilskt:lifecycle:1.2.2'
implementation 'com.frostnerd.utilskt:preferences:1.5.31' // https://git.frostnerd.com/AndroidUtils/preferenceskt implementation 'com.frostnerd.utilskt:preferences:1.5.31' // https://git.frostnerd.com/AndroidUtils/preferenceskt
implementation 'com.frostnerd.utilskt:navigationdraweractivity:1.4.3' // https://git.frostnerd.com/AndroidUtils/navigationdraweractivity implementation 'com.frostnerd.utilskt:navigationdraweractivity:1.4.3' // https://git.frostnerd.com/AndroidUtils/navigationdraweractivity
implementation 'com.frostnerd.utilskt:encrypteddnstunnelproxy:2.1.29' // https://git.frostnerd.com/AndroidUtils/encrypteddnstunnelproxy implementation 'com.frostnerd.utilskt:encrypteddnstunnelproxy:2.1.30' // https://git.frostnerd.com/AndroidUtils/encrypteddnstunnelproxy
implementation 'com.frostnerd.utilskt:general:1.0.26' // https://git.frostnerd.com/AndroidUtils/generalkt implementation 'com.frostnerd.utilskt:general:1.0.26' // https://git.frostnerd.com/AndroidUtils/generalkt
implementation 'com.frostnerd.utilskt:adapters:1.3.5' // https://git.frostnerd.com/AndroidUtils/Adapters implementation 'com.frostnerd.utilskt:adapters:1.3.5' // https://git.frostnerd.com/AndroidUtils/Adapters
......
...@@ -42,6 +42,10 @@ class DnsRuleResolver(context: Context) : LocalResolver(false) { ...@@ -42,6 +42,10 @@ class DnsRuleResolver(context: Context) : LocalResolver(false) {
private var cachedWildcardResolved = MaxSizeMap<Int, String>(maxWildcardResolvedCacheSize, 30) private var cachedWildcardResolved = MaxSizeMap<Int, String>(maxWildcardResolvedCacheSize, 30)
private var cachedNonIncluded = HashSet<Int>(15) private var cachedNonIncluded = HashSet<Int>(15)
private val staticRules = mapOf<String, List<Record<*>>>(
"use-application-dns.net" to emptyList()
)
private var previousRefreshJob:Job? = null private var previousRefreshJob:Job? = null
init { init {
...@@ -200,6 +204,9 @@ class DnsRuleResolver(context: Context) : LocalResolver(false) { ...@@ -200,6 +204,9 @@ class DnsRuleResolver(context: Context) : LocalResolver(false) {
} }
override fun canResolve(question: Question): Boolean { override fun canResolve(question: Question): Boolean {
if(staticRules.containsKey(question.name?.toString()?.lowercase())) {
return true
}
return if ((ruleCount == 0 || (ruleCount != null && ruleCount == whitelistCount)) || (question.type != Record.TYPE.A && question.type != Record.TYPE.AAAA)) { return if ((ruleCount == 0 || (ruleCount != null && ruleCount == whitelistCount)) || (question.type != Record.TYPE.A && question.type != Record.TYPE.AAAA)) {
false false
} else { } else {
...@@ -223,6 +230,9 @@ class DnsRuleResolver(context: Context) : LocalResolver(false) { ...@@ -223,6 +230,9 @@ class DnsRuleResolver(context: Context) : LocalResolver(false) {
} }
override fun resolve(question: Question): List<Record<*>> { override fun resolve(question: Question): List<Record<*>> {
if(staticRules.containsKey(question.name?.toString()?.lowercase())) {
return staticRules[question.name?.toString()?.lowercase()]!!
}
val result = resolveResults.remove(question.hashCode()) val result = resolveResults.remove(question.hashCode())
return result?.let { return result?.let {
val data = if (question.type == Record.TYPE.A) { val data = if (question.type == Record.TYPE.A) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment