Improve: remove loopback block & add allow bypass

This commit is contained in:
kr328 2021-11-14 20:42:52 +08:00
parent 5224fa656c
commit 094815a098
5 changed files with 11 additions and 8 deletions

View File

@ -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,
)

View File

@ -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>

View File

@ -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>

View File

@ -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(

View File

@ -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
)