Skip to content

Commit

Permalink
Pass a value with the VPN option, if plugin version < 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
madeye committed Oct 19, 2020
1 parent 52d0d7e commit f38d828
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro

this.configFile = configFile
val config = profile.toJson()
plugin?.let { (path, opts) ->
if (service.isVpnService) opts["V"] = ""
plugin?.let { (path, opts, isV2) ->
if (service.isVpnService) if (isV2) opts["__android_vpn"] = "" else opts["V"] = "true"
config.put("plugin", path).put("plugin_opts", opts.toString())
}
config.put("local_address", DataStore.listenAddress)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ object PluginManager {
}
val provider = providers.single().providerInfo
val options = configuration.getOptions { provider.loadString(PluginContract.METADATA_KEY_DEFAULT_CONFIG) }
val isV2 = (provider.applicationInfo.metaData?.getString(PluginContract.METADATA_KEY_VERSION)
val isV2 = provider.applicationInfo.metaData?.getString(PluginContract.METADATA_KEY_VERSION
?.substringBefore('.')?.toIntOrNull() ?: 0) >= 2
var failure: Throwable? = null
try {
Expand Down

0 comments on commit f38d828

Please sign in to comment.