Skip to content

Commit

Permalink
Improve: remove loopback block & add allow bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
Kr328 committed Nov 14, 2021
1 parent 5224fa6 commit 094815a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ class NetworkSettingsDesign(
)

switch(
value = srvStore::blockLoopback,
title = R.string.block_loopback,
summary = R.string.block_loopback_summary,
value = srvStore::allowBypass,
title = R.string.allow_bypass,
summary = R.string.allow_bypass_summary,
configure = vpnDependencies::add,
)

Expand Down
2 changes: 2 additions & 0 deletions design/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,6 @@
<string name="block_loopback">阻止本地回环</string>
<string name="block_loopback_summary">阻止本地回环连接</string>
<string name="geoip_fallback_code">GeoIP Fallback 区域代码</string>
<string name="allow_bypass">允许应用绕过</string>
<string name="allow_bypass_summary">允许其他应用绕过 VPN</string>
</resources>
2 changes: 2 additions & 0 deletions design/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@
<string name="dns_hijacking_summary">Handle all dns packet</string>
<string name="block_loopback">Block Loopback</string>
<string name="block_loopback_summary">Block loopback connections</string>
<string name="allow_bypass">Allow Bypass</string>
<string name="allow_bypass_summary">Allows all apps to bypass this VPN connection</string>
<string name="system_proxy">System Proxy</string>
<string name="system_proxy_summary">Attach http proxy to VpnService</string>
<string name="access_control_mode">Access Control Mode</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,8 @@ class TunService : VpnService(), CoroutineScope by CoroutineScope(Dispatchers.De
}
}

val blocking = mutableListOf("$TUN_GATEWAY/$TUN_SUBNET_PREFIX")
if (store.blockLoopback) {
blocking.add(NET_SUBNET_LOOPBACK)
if (store.allowBypass) {
allowBypass()
}

TunModule.TunDevice(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class ServiceStore(context: Context) {
defaultValue = true
)

var blockLoopback by store.boolean(
key = "block_loopback",
var allowBypass by store.boolean(
key = "allow_bypass",
defaultValue = true
)

Expand Down

0 comments on commit 094815a

Please sign in to comment.