Skip to content

Commit

Permalink
fix #1554: appropriate label for private dns firewall
Browse files Browse the repository at this point in the history
  • Loading branch information
hussainmohd-a committed Jul 23, 2024
1 parent 1ac241c commit 07fbd02
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3409,7 +3409,7 @@ class BraveVPNService :
if (trapVpnPrivateDns) {
logd("flow: dns-over-tls, returning Ipn.Block, $uid")
cm.isBlocked = true
cm.blockedByRule = FirewallRuleset.RULE1C.id
cm.blockedByRule = FirewallRuleset.RULE14.id
return@runBlocking persistAndConstructFlowResponse(cm, Backend.Block, connId, uid)
}

Expand Down
14 changes: 12 additions & 2 deletions app/src/main/java/com/celzero/bravedns/service/FirewallRuleset.kt
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ enum class FirewallRuleset(val id: String, val title: Int, val desc: Int, val ac
R.string.firewall_rule_block_app_desc,
R.integer.stall
),
RULE14(
"Private DNS",
R.string.firewall_rule_private_dns,
R.string.firewall_rule_private_dns_desc,
R.integer.stall
),
;

companion object {
Expand Down Expand Up @@ -234,6 +240,8 @@ enum class FirewallRuleset(val id: String, val title: Int, val desc: Int, val ac
RULE10.id -> RULE10
RULE11.id -> RULE11
RULE12.id -> RULE12
RULE13.id -> RULE13
RULE14.id -> RULE14
else -> null
}
}
Expand Down Expand Up @@ -270,16 +278,18 @@ enum class FirewallRuleset(val id: String, val title: Int, val desc: Int, val ac
RULE10.id -> R.drawable.ic_http
RULE11.id -> R.drawable.ic_global_lockdown
RULE12.id -> R.drawable.ic_proxy_white
RULE13.id -> R.drawable.ic_proxy_white
RULE14.id -> R.drawable.bs_dns_home_screen
else -> R.drawable.bs_dns_home_screen
}
}

fun getAllowedRules(): List<FirewallRuleset> {
return values().toList().filter { it.act == R.integer.allow }
return entries.filter { it.act == R.integer.allow }
}

fun getBlockedRules(): List<FirewallRuleset> {
return values().toList().filter { it.act != R.integer.allow }
return entries.filter { it.act != R.integer.allow }
}

fun ground(rule: FirewallRuleset): Boolean {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,7 @@
<string name="firewall_rule_domain_blocked_univ" translatable="true">Domain (Univ)</string>
<string name="firewall_rule_domain_trusted_univ" translatable="true">Trusted Domain (Univ)</string>
<string name="firewall_rule_proxied" translatable="true">Proxied</string>
<string name="firewall_rule_private_dns" translatable="true">Private DNS</string>

<string name="firewall_rule_no_rule_desc" translatable="true">No firewall rules matched this connection.</string>
<string name="firewall_rule_block_app_desc" translatable="true"><![CDATA[A user-set firewall rule blocked this <i>app</i>.<br/><br/> To change go to <i>All Apps</i> tab.]]></string>
Expand Down Expand Up @@ -1175,6 +1176,7 @@
<string name="firewall_rule_domain_blocked_univ_desc" translatable="true"><![CDATA[This connection was blocked because the <i>domain</i> is set as blocked in Universal domain rules.<br/><br/> To change this behaviour go to <i>Configure DNS</i> tab.]]></string>
<string name="firewall_rule_domain_trusted_univ_desc" translatable="true"><![CDATA[This connection was allowed because the <i>domain</i> is set as trusted in Universal domain rules.<br/><br/> To change this behaviour go to <i>Configure DNS</i> tab.]]></string>
<string name="firewall_rule_proxied_desc" translatable="true"><![CDATA[This connection was forwarded to user-preferred Proxy.<br/><br/> To change go to <i>Proxy</i> from <i>Configure</i> screen.]]></string>
<string name="firewall_rule_private_dns_desc" translatable="true"><![CDATA[This connection was blocked because the <i>Private DNS</i> is enabled.<br/><br/> To change this behaviour disable <i>Private DNS</i> from <i>Android Settings</i> screen.]]></string>

<!-- New app install Notification -->
<string name="new_app_bulk_notification_title" translatable="true">Attention</string>
Expand Down

0 comments on commit 07fbd02

Please sign in to comment.