diff --git a/.github/workflows/build-gcc.yml b/.github/workflows/build-gcc.yml
index 64f8149..ab593eb 100644
--- a/.github/workflows/build-gcc.yml
+++ b/.github/workflows/build-gcc.yml
@@ -29,7 +29,7 @@ jobs:
- name: Patch ZeroTier for Cross-Compile
run: |
pip3 install toml
- python3 build/build_helper.py
+ python3 build/patch.py
- name: Build for AArch64
run: |
diff --git a/.github/workflows/build-ndk.yml b/.github/workflows/build-ndk.yml
index 5ded3e6..e9f4d9b 100644
--- a/.github/workflows/build-ndk.yml
+++ b/.github/workflows/build-ndk.yml
@@ -34,7 +34,7 @@ jobs:
- name: Patch ZeroTier for Cross-Compile
run: |
pip3 install toml
- python3 build/build_helper.py
+ python3 build/patch.py
- name: Build for AArch64
run: |
diff --git a/README.md b/README.md
index 79609e6..4d354aa 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,9 @@
**Run zerotier in the background after booting!**
-**No conflicts with other android VPN service!**
+**No conflicts with other Android VPN service!**
+
+**Use Android App to control ZeroTier**
## Requirements
@@ -24,39 +26,68 @@ AArch64 suppots ARMv8-A and above; Arm version supports ARMv7-A (compiling with
## Installation
-1. download release from github.
-2. install with magisk.
-3. modify the config file at `/sdcard/Android/zerotier/network_id.txt` and put your 16-character network id in it.
-4. restart and enjoy.
+1. Download magisk module zip file from github release; install.
+2. Download controller app apk file from github release; install.
+3. Reboot your phone.
+4. Open controller app; enter your 16-character network id; join.
+5. Enjoy 😋
-To restart, execute (in root) `sh /data/adb/zerotier/zerotier.sh restart`; An android application to control zerotier (networkid, restart, ...) has been added to the todo list.
+## Usage
-### Files
+### Controller App
+
+Needs root privilege
+
+| Feature | Supported? |
+| :----------------- | :--------- |
+| status | ✅ |
+| start/stop | ✅ |
+| join/leave network | ✅ |
+| join/leave planet | ❎ |
+
+
+

+

+
+
+### Command line tools
+
+Use `zerotier.sh` to start/stop or inspect status.
+
+`Usage: zerotier.sh {start|stop|restart|status}`
+
+Use `zerotier-cli / zerotier-idtool` for ZeroTierOne command line operations.
+
+(`zerotier-one` not copied to `/system/bin`)
+
+## Files
```
-/data/adb/zerotier/
- | - run/
- | | - pipe # pipe to service.sh
- | | - daemon.log # service.sh log
- | ` - zerotier.log # zerotier-one log
- | - home/ # zerotier-one home directory
- | ` - ...
- | - lib/
- | ` - libc++_shared.so # NDK dynamic library
- | - zerotier.sh # tool to communicate with service.sh
- | - zerotier-one # zerotier-one executable
- | - zerotier-cli -> zerotier-one
- ` - zerotier-idtool -> zerotier-one
+/data/adb/zerotier
+├── home # zerotier-one home directory
+│ ├── authtoken.secret # zerotier-one http interface authtoken
+│ ├── zerotier-one.pid # zerotier-one pid
+│ ├── zerotier-one.port # zerotier-one port
+│ └── ...
+├── lib # only in NDK compiled module
+│ └── libc++_shared.so # NDK dynamic library
+├── run
+│ ├── daemon.log # service.sh log
+│ ├── pipe # named pipe to interact with service.sh
+│ ├── zerotier.log # zerotier-one log
+│ └── ...
+├── zerotier-cli -> zerotier-one # zerotier-one command line interface
+├── zerotier-idtool -> zerotier-one # zerotier-one id tool
+├── zerotier-one # zerotier-one executable
+└── zerotier.sh
```
-all the scripts and binaries are placed in `/data/adb/zerotier/`.
+all the scripts and binaries are placed in `/data/adb/zerotier/`, and all copied to `/system/bin` (in PATH) to be executed directly (except `zerotier-one`)
-`zerotier.sh` writes commands to the pipe at `run/pipe` and `service.sh` read from it.
-
-`Usage: sh zerotier.sh {start|stop|restart|join|leave}`
+`zerotier.sh` uses named pipe to communicate with `service.sh`, preventing ZeroTier to start as a subprocess of Shell.
log files are placed in `run`, `daemon.log` for `service.sh` and `zerotier.log` for ZeroTierOne.
-### Build binaries yourself
+## Build binaries yourself
-The binaries are built with Android NDK toolchains on Github Action, see `.github/workflow/build.yml` for detailed information.
+refer to `.github/workflow/build-{gcc|ndk}.yml` for detailed information.
diff --git a/README_ZH.md b/README_ZH.md
index 90ab316..dac56fe 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -8,7 +8,11 @@
-将 ZeroTier 保持后台运行,不与其他 Android VPN 应用程序冲突
+**将 ZeroTier 保持后台运行**
+
+**不与其他 Android VPN 应用程序冲突**
+
+**使用 Android App 进行控制**
## 运行要求
@@ -22,39 +26,68 @@ AArch64 版本支持 ARMv8-A 及以上;Arm 版本均对 ARMv7-A 进行编译 (
## 安装
-1. 从 Release 下载压缩包
-2. 导入 magisk 进行安装
-3. 将你的 16 位 ZeroTier network id 写入 `/sdcard/Android/zerotier/network_id.txt`
-4. 重启
+1. 从 Release 处下载 magisk 模块压缩包,并安装
+2. 从 Release 处下载控制器的 apk 安装包,并安装
+3. 重启
+4. 打开控制器 App,输入 16 位 network id 并加入
+5. 享用 😋
-你可以用 `su` 执行 `sh /data/adb/zerotier/zerotier.sh restart` 来重启,或者干脆重启手机,计划写一个 app 来完成
+## 使用
-### 文件
+### 控制器 App
+
+需要 root 授权
+
+| 功能 | 支持状态 |
+| :--------------- | :------- |
+| 查看运行状态 | ✅ |
+| 启动停止重启 | ✅ |
+| 加入离开 network | ✅ |
+| 加入离开 planet | ❎ |
+
+
+

+

+
+
+### 命令行
+
+查看运行状态,或者启动重启停止,使用 `zerotier.sh`
+
+`Usage: zerotier.sh {start|stop|restart|status}`
+
+ZeroTierOne 支持的所有命令行操作:使用 `zerotier-cli / zerotier-idtool`
+
+(`zerotier-one` 并未导出到 `/system/bin`)
+
+## 目录结构
```
-/data/adb/zerotier/
- | - run/
- | | - pipe # pipe to service.sh
- | | - daemon.log # service.sh log
- | ` - zerotier.log # zerotier-one log
- | - home/ # zerotier-one home directory
- | ` - ...
- | - lib/
- | ` - libc++_shared.so # NDK dynamic library
- | - zerotier.sh # tool to communicate with service.sh
- | - zerotier-one # zerotier-one executable
- | - zerotier-cli -> zerotier-one
- ` - zerotier-idtool -> zerotier-one
+/data/adb/zerotier
+├── home # zerotier-one home directory
+│ ├── authtoken.secret # zerotier-one http interface authtoken
+│ ├── zerotier-one.pid # zerotier-one pid
+│ ├── zerotier-one.port # zerotier-one port
+│ └── ...
+├── lib # only in NDK compiled module
+│ └── libc++_shared.so # NDK dynamic library
+├── run
+│ ├── daemon.log # service.sh log
+│ ├── pipe # named pipe to interact with service.sh
+│ ├── zerotier.log # zerotier-one log
+│ └── ...
+├── zerotier-cli -> zerotier-one # zerotier-one command line interface
+├── zerotier-idtool -> zerotier-one # zerotier-one id tool
+├── zerotier-one # zerotier-one executable
+└── zerotier.sh
```
-ZeroTier 可执行文件和操作的 Shell 脚本放在 `/data/adb/zerotier/`
+ZeroTier 可执行文件和操作的 Shell 脚本放在 `/data/adb/zerotier/` 下,同时复制到 `/system/bin`(PATH 中)以便于直接执行(除了 `zerotier-one`)
-`zerotier.sh` 向管道 `run/pipe` 写入, `service.sh` 读取管道,然后进行操作
+`zerotier.sh` 通过命名管道与 `service.sh` 交互,防止 ZeroTier 作为 Shell 的子进程运行
-`Usage: sh zerotier.sh {start|stop|restart|join|leave}`
+日志存放在 `/data/adb/zerotier/run` 下,`service.sh` 为 `daemon.log`,ZeroTier 为 `zerotier.log`.
-log files are placed in `run`, `daemon.log` for `service.sh` and `zerotier.log` for ZeroTierOne.
+## 自行编译
-### 自行编译
-
-使用 NDK,参考 `.github/workflow/build.yml`
+参考 `.github/workflow/build-{gcc|ndk}.yml`
diff --git a/build/build_helper.py b/build/patch.py
similarity index 100%
rename from build/build_helper.py
rename to build/patch.py
diff --git a/images/app_home.jpg b/images/app_home.jpg
new file mode 100644
index 0000000..630649b
Binary files /dev/null and b/images/app_home.jpg differ
diff --git a/images/app_network.jpg b/images/app_network.jpg
new file mode 100644
index 0000000..9434744
Binary files /dev/null and b/images/app_network.jpg differ
diff --git a/magisk/customize.sh b/magisk/customize.sh
index 9ee202b..610ca6d 100644
--- a/magisk/customize.sh
+++ b/magisk/customize.sh
@@ -19,6 +19,7 @@ ui_print "- link to system"
mkdir -p $MODPATH$SYSBIN
ln -sf $ZTPATH/zerotier.sh $MODPATH$SYSBIN/zerotier.sh
ln -sf $ZTPATH/zerotier-cli $MODPATH$SYSBIN/zerotier-cli
+ln -sf $ZTPATH/zerotier-idtool $MODPATH$SYSBIN/zerotier-idtool
ui_print "- set file permission"
set_perm_recursive $MODPATH 0 0 0755 0644