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( switch(
value = srvStore::blockLoopback, value = srvStore::allowBypass,
title = R.string.block_loopback, title = R.string.allow_bypass,
summary = R.string.block_loopback_summary, summary = R.string.allow_bypass_summary,
configure = vpnDependencies::add, configure = vpnDependencies::add,
) )

View file

@ -214,4 +214,6 @@
<string name="block_loopback">阻止本地回环</string> <string name="block_loopback">阻止本地回环</string>
<string name="block_loopback_summary">阻止本地回环连接</string> <string name="block_loopback_summary">阻止本地回环连接</string>
<string name="geoip_fallback_code">GeoIP Fallback 区域代码</string> <string name="geoip_fallback_code">GeoIP Fallback 区域代码</string>
<string name="allow_bypass">允许应用绕过</string>
<string name="allow_bypass_summary">允许其他应用绕过 VPN</string>
</resources> </resources>

View file

@ -122,6 +122,8 @@
<string name="dns_hijacking_summary">Handle all dns packet</string> <string name="dns_hijacking_summary">Handle all dns packet</string>
<string name="block_loopback">Block Loopback</string> <string name="block_loopback">Block Loopback</string>
<string name="block_loopback_summary">Block loopback connections</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">System Proxy</string>
<string name="system_proxy_summary">Attach http proxy to VpnService</string> <string name="system_proxy_summary">Attach http proxy to VpnService</string>
<string name="access_control_mode">Access Control Mode</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.allowBypass) {
if (store.blockLoopback) { allowBypass()
blocking.add(NET_SUBNET_LOOPBACK)
} }
TunModule.TunDevice( TunModule.TunDevice(

View file

@ -46,8 +46,8 @@ class ServiceStore(context: Context) {
defaultValue = true defaultValue = true
) )
var blockLoopback by store.boolean( var allowBypass by store.boolean(
key = "block_loopback", key = "allow_bypass",
defaultValue = true defaultValue = true
) )