Commit 9e0e0917 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Use target "0" as shortcut for "0.0.0.0" (less bytes)

parent 6bd4522e
......@@ -945,8 +945,9 @@ class DnsVpnService : VpnService(), Runnable {
false
} else {
val uniformQuestion = question.name.toString().replace(wwwRegex, "")
val resolveResult = dao.findRuleTarget(uniformQuestion, question.type, useUserRules)
var resolveResult = dao.findRuleTarget(uniformQuestion, question.type, useUserRules)
if (resolveResult != null) {
if(resolveResult == "0") resolveResult = "0.0.0.0"
resolveResults[question] = resolveResult
true
} else false
......
......@@ -272,16 +272,22 @@ class RuleImportService : Service() {
when {
matcher.groupCount() == 1 -> {
val host = matcher.group(1).replace(wwwRegex, "")
return DnsRule(Record.TYPE.ANY, host, "0.0.0.0", "::1", importedFrom = sourceId)
return DnsRule(Record.TYPE.ANY, host, "0", "::1", importedFrom = sourceId)
}
matcher == DNSMASQ_MATCHER -> {
val host = matcher.group(1).replace(wwwRegex, "")
val target = matcher.group(2)
val target = matcher.group(2).let {
if(it == "0.0.0.0") "0"
else it
}
return DnsRule(if (target.contains(":")) Record.TYPE.AAAA else Record.TYPE.A, host, target, importedFrom = sourceId)
}
matcher == HOSTS_MATCHER -> {
val target = matcher.group(1)
val host = matcher.group(2).replace(wwwRegex, "")
val host = matcher.group(2).replace(wwwRegex, "").let {
if(it == "0.0.0.0") "0"
else it
}
return DnsRule(if (target.contains(":")) Record.TYPE.AAAA else Record.TYPE.A, host, target, importedFrom = sourceId)
}
}
......
Supports Markdown
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