Skip to content

Commit

Permalink
Switch to __android_vpn
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed Oct 4, 2020
1 parent 3f70a47 commit cd6a1f1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
this.configFile = configFile
val config = profile.toJson()
plugin?.let { (path, opts, isV2) ->
if (service.isVpnService) opts["V"] = if (isV2) "" else "true"
if (service.isVpnService) {
if (isV2) opts["__android_vpn"] = "" else config.put("plugin_arg", "-V")
}
config.put("plugin", path).put("plugin_opts", opts.toString())
}
config.put("local_address", DataStore.listenAddress)
Expand Down
2 changes: 1 addition & 1 deletion plugin/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
* 2.0.0:
* Deprecated passing `-V` and `--fast-open` to plugin.
Please find `V` option passed via plugin options.
Please find `__android_vpn` option passed via plugin options.
* Dependency updates:
- `androidx.core:core-ktx:1.3.2`;
- `androidx.drawerlayout:drawerlayout:1.1.1`;
Expand Down
8 changes: 3 additions & 5 deletions plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ First you need to get your native binary compiling on Android platform.
* [Sample project for C](https://github.com/shadowsocks/simple-obfs-android/tree/4f82c4a4e415d666e70a7e2e60955cb0d85c1615);
* [Sample project for Go](https://github.com/shadowsocks/v2ray-plugin-android/tree/172bd4cec0276112828614482fb646b79dbf1540).

In addition to functionalities of a normal plugin, it has to support these additional flags that
may get passed through arguments:
In addition to functionalities of a normal plugin, it has to support these additional options:

* `-V`: VPN mode. In this case, the plugin should pass all file descriptors that needs protecting
from VPN connections (i.e. its traffic will not be forwarded through the VPN) through an
ancillary message to `./protect_path`.
* `__android_vpn`: VPN mode.
In this case, the plugin should pass all file descriptors that needs protecting from VPN connections (i.e. its traffic will not be forwarded through the VPN) through an ancillary message to `./protect_path`.

### Implement a binary provider

Expand Down

0 comments on commit cd6a1f1

Please sign in to comment.