Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
bd4cfbfe
Commit
bd4cfbfe
authored
Feb 04, 2020
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update doc and guide
parent
c7ef0e3a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
26 deletions
+29
-26
plugin/CHANGES.md
plugin/CHANGES.md
+1
-0
plugin/README.md
plugin/README.md
+26
-25
plugin/doc.md
plugin/doc.md
+2
-1
No files found.
plugin/CHANGES.md
View file @
bd4cfbfe
*
1.3.4:
*
Please use
`android:path`
instead of
`android:pathPrefix`
, sample code in documentations have been updated to reflect this recommendation.
*
Fix occasional crash in
`AlertDialogFragment`
.
*
Translation updates.
*
Dependency updates:
...
...
plugin/README.md
View file @
bd4cfbfe
...
...
@@ -10,13 +10,12 @@ Support library for easier development on [shadowsocks
These are some plugins ready to use on shadowsocks-android.
*
[
simple-obfs
](
https://github.com/shadowsocks/simple-obfs-android/releases
)
*
[
v2ray
](
https://github.com/shadowsocks/v2ray-plugin-android
)
*
[
kcptun
](
https://github.com/shadowsocks/kcptun-android/releases
)
*
[
simple-obfs
](
https://github.com/shadowsocks/simple-obfs-android/releases
)
## Developer's guide
WARNING: This library is still in beta (0.x) and its content is subject to massive changes.
This library is designed with Java interoperability in mind so theoretically you can use this
library with other languages and/or build tools but there isn't documentation for that yet. This
guide is written for Scala + SBT. Contributions are welcome.
...
...
@@ -32,11 +31,11 @@ There are no arbitrary restrictions/requirements on package name, component name
### Add dependency
First you need to add this library to your dependencies.
This library is written mostly in Scala
and it's most convenient to use it with SBT
:
First you need to add this library to your dependencies.
This library is written mostly in Kotlin but can also work with Java-only projects
:
```
scala
libraryDependencies
+=
"com.github.shadowsocks"
%%
"plugin"
%
"0.0.4"
```
gradle
implementation
'com.github.shadowsocks:plugin:$LATEST_VERSION'
```
### Native binary configuration
...
...
@@ -44,7 +43,7 @@ libraryDependencies += "com.github.shadowsocks" %% "plugin" % "0.0.4"
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/
kcptun-android/tree/41f42077e177618553417c16559784a51e9d8c4c
)
.
*
[
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:
...
...
@@ -56,25 +55,23 @@ In addition to functionalities of a normal plugin, it has to support these addit
### Implement a binary provider
It's super easy. You just need to implement two or three methods. For example for
`obfs-local
`
:
You just need to implement two or three methods. For example for
`v2ray
`
:
```
scala
final
class
BinaryProvider
extends
NativePluginProvider
{
override
protected
def
populateFiles
(
provider
:
PathProvider
)
{
provider
.
addPath
(
"obfs-local"
,
"755"
)
// add additional files here
}
```
kotlin
class
BinaryProvider
:
NativePluginProvider
()
{
override
fun
populateFiles
(
provider
:
PathProvider
)
{
provider
.
addPath
(
"v2ray"
,
0b111101101
)
// add additional files here
}
// remove this method to disable fast mode, read more in the documentation
override
def
getExecutable
:
String
=
getContext
.
getApplicationInfo
.
nativeLibraryDir
+
"/libobfs-local.so"
override
def
openFile
(
uri
:
Uri
)
:
ParcelFileDescriptor
=
uri
.
getPath
match
{
case
"/obfs-local"
=>
ParcelFileDescriptor
.
open
(
new
File
(
getExecutable
),
ParcelFileDescriptor
.
MODE_READ_ONLY
)
// handle additional files here
case
_
=>
throw
new
FileNotFoundException
()
}
override
fun
getExecutable
()
=
context
!!
.
applicationInfo
.
nativeLibraryDir
+
"/libv2ray.so"
override
fun
openFile
(
uri
:
Uri
):
ParcelFileDescriptor
=
when
(
uri
.
path
)
{
"/v2ray"
->
ParcelFileDescriptor
.
open
(
File
(
getExecutable
()),
ParcelFileDescriptor
.
MODE_READ_ONLY
)
// handle additional files here
else
->
throw
FileNotFoundException
()
}
}
```
...
...
@@ -95,12 +92,16 @@ Then add it to your manifest:
<action
android:name=
"com.github.shadowsocks.plugin.ACTION_NATIVE_PLUGIN"
/>
<data
android:scheme=
"plugin"
android:host=
"com.github.shadowsocks"
android:path
Prefix
=
"/$PLUGIN_ID"
/>
android:path=
"/$PLUGIN_ID"
/>
</intent-filter>
<meta-data
android:name=
"com.github.shadowsocks.plugin.id"
android:value=
"$PLUGIN_ID"
/>
<!-- Optional: default is empty -->
<meta-data
android:name=
"com.github.shadowsocks.plugin.default_config"
android:value=
"dummy=default;plugin=options"
/>
<!-- Optional: remove to disable faster mode, read more in the documentation -->
<meta-data
android:name=
"com.github.shadowsocks.plugin.executable_path"
android:value=
"$PATH_TO_EXECUTABLE_RELATIVE_TO_NATIVE_LIB_DIR"
/>
</provider>
...
</application>
...
...
plugin/doc.md
View file @
bd4cfbfe
...
...
@@ -164,7 +164,7 @@ This corresponds to `com.github.shadowsocks.plugin.NativePluginProvider` in the
<action
android:name=
"com.github.shadowsocks.plugin.ACTION_NATIVE_PLUGIN"
/>
<data
android:scheme=
"plugin"
android:host=
"com.github.shadowsocks"
android:path
Prefix
=
"/$PLUGIN_ID"
/>
android:path=
"/$PLUGIN_ID"
/>
</intent-filter>
<meta-data
android:name=
"com.github.shadowsocks.plugin.id"
android:value=
"$PLUGIN_ID"
/>
...
...
@@ -202,6 +202,7 @@ This allows the host app to launch your plugin without ever launching your app.
## JVM mode
This feature hasn't been implemented yet.
Please open an issue if you need this.
# Plugin security
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment