update readme

This commit is contained in:
eventlOwOp
2024-05-19 01:33:05 +08:00
parent b7cbef91c5
commit 53e2fca297
8 changed files with 120 additions and 55 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ jobs:
- name: Patch ZeroTier for Cross-Compile - name: Patch ZeroTier for Cross-Compile
run: | run: |
pip3 install toml pip3 install toml
python3 build/build_helper.py python3 build/patch.py
- name: Build for AArch64 - name: Build for AArch64
run: | run: |
+1 -1
View File
@@ -34,7 +34,7 @@ jobs:
- name: Patch ZeroTier for Cross-Compile - name: Patch ZeroTier for Cross-Compile
run: | run: |
pip3 install toml pip3 install toml
python3 build/build_helper.py python3 build/patch.py
- name: Build for AArch64 - name: Build for AArch64
run: | run: |
+57 -26
View File
@@ -10,7 +10,9 @@
**Run zerotier in the background after booting!** **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 ## Requirements
@@ -24,39 +26,68 @@ AArch64 suppots ARMv8-A and above; Arm version supports ARMv7-A (compiling with
## Installation ## Installation
1. download release from github. 1. Download magisk module zip file from github release; install.
2. install with magisk. 2. Download controller app apk file from github release; install.
3. modify the config file at `/sdcard/Android/zerotier/network_id.txt` and put your 16-character network id in it. 3. Reboot your phone.
4. restart and enjoy. 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 | ❎ |
<div>
<img alt="ZeroTier for Magisk Icon" src="https://github.com/eventlOwOp/zerotier-magisk/blob/master/images/app_home.jpg" width="192" />
<img alt="ZeroTier for Magisk Icon" src="https://github.com/eventlOwOp/zerotier-magisk/blob/master/images/app_network.jpg" width="192" />
</div>
### 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/ /data/adb/zerotier
| - run/ ├── home # zerotier-one home directory
| | - pipe # pipe to service.sh │   ├── authtoken.secret # zerotier-one http interface authtoken
| | - daemon.log # service.sh log │   ├── zerotier-one.pid # zerotier-one pid
| ` - zerotier.log # zerotier-one log │   ├── zerotier-one.port # zerotier-one port
| - home/ # zerotier-one home directory │   └── ...
| ` - ... ├── lib # only in NDK compiled module
| - lib/ │   └── libc++_shared.so # NDK dynamic library
| ` - libc++_shared.so # NDK dynamic library ├── run
| - zerotier.sh # tool to communicate with service.sh │   ├── daemon.log # service.sh log
| - zerotier-one # zerotier-one executable │   ├── pipe # named pipe to interact with service.sh
| - zerotier-cli -> zerotier-one │   ├── zerotier.log # zerotier-one log
` - zerotier-idtool -> zerotier-one │   └── ...
├── 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. `zerotier.sh` uses named pipe to communicate with `service.sh`, preventing ZeroTier to start as a subprocess of Shell.
`Usage: sh zerotier.sh {start|stop|restart|join|leave}`
log files are placed in `run`, `daemon.log` for `service.sh` and `zerotier.log` for ZeroTierOne. 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.
+60 -27
View File
@@ -8,7 +8,11 @@
</div> </div>
将 ZeroTier 保持后台运行,不与其他 Android VPN 应用程序冲突 **将 ZeroTier 保持后台运行**
**不与其他 Android VPN 应用程序冲突**
**使用 Android App 进行控制**
## 运行要求 ## 运行要求
@@ -22,39 +26,68 @@ AArch64 版本支持 ARMv8-A 及以上;Arm 版本均对 ARMv7-A 进行编译 (
## 安装 ## 安装
1. 从 Release 下载压缩包 1. 从 Release 下载 magisk 模块压缩包,并安装
2. 导入 magisk 进行安装 2. 从 Release 处下载控制器的 apk 安装包,并安装
3. 将你的 16 位 ZeroTier network id 写入 `/sdcard/Android/zerotier/network_id.txt` 3. 重启
4. 重启 4. 打开控制器 App,输入 16 位 network id 并加入
5. 享用 😋
你可以用 `su` 执行 `sh /data/adb/zerotier/zerotier.sh restart` 来重启,或者干脆重启手机,计划写一个 app 来完成 ## 使用
### 文件 ### 控制器 App
需要 root 授权
| 功能 | 支持状态 |
| :--------------- | :------- |
| 查看运行状态 | ✅ |
| 启动停止重启 | ✅ |
| 加入离开 network | ✅ |
| 加入离开 planet | ❎ |
<div>
<img alt="ZeroTier for Magisk Icon" src="https://github.com/eventlOwOp/zerotier-magisk/blob/master/images/app_home.jpg" width="192" />
<img alt="ZeroTier for Magisk Icon" src="https://github.com/eventlOwOp/zerotier-magisk/blob/master/images/app_network.jpg" width="192" />
</div>
### 命令行
查看运行状态,或者启动重启停止,使用 `zerotier.sh`
`Usage: zerotier.sh {start|stop|restart|status}`
ZeroTierOne 支持的所有命令行操作:使用 `zerotier-cli / zerotier-idtool`
`zerotier-one` 并未导出到 `/system/bin`
## 目录结构
``` ```
/data/adb/zerotier/ /data/adb/zerotier
| - run/ ├── home # zerotier-one home directory
| | - pipe # pipe to service.sh │   ├── authtoken.secret # zerotier-one http interface authtoken
| | - daemon.log # service.sh log │   ├── zerotier-one.pid # zerotier-one pid
| ` - zerotier.log # zerotier-one log │   ├── zerotier-one.port # zerotier-one port
| - home/ # zerotier-one home directory │   └── ...
| ` - ... ├── lib # only in NDK compiled module
| - lib/ │   └── libc++_shared.so # NDK dynamic library
| ` - libc++_shared.so # NDK dynamic library ├── run
| - zerotier.sh # tool to communicate with service.sh │   ├── daemon.log # service.sh log
| - zerotier-one # zerotier-one executable │   ├── pipe # named pipe to interact with service.sh
| - zerotier-cli -> zerotier-one │   ├── zerotier.log # zerotier-one log
` - zerotier-idtool -> zerotier-one │   └── ...
├── 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. ## 自行编译
### 自行编译 参考 `.github/workflow/build-{gcc|ndk}.yml`
使用 NDK,参考 `.github/workflow/build.yml`
Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

+1
View File
@@ -19,6 +19,7 @@ ui_print "- link to system"
mkdir -p $MODPATH$SYSBIN mkdir -p $MODPATH$SYSBIN
ln -sf $ZTPATH/zerotier.sh $MODPATH$SYSBIN/zerotier.sh ln -sf $ZTPATH/zerotier.sh $MODPATH$SYSBIN/zerotier.sh
ln -sf $ZTPATH/zerotier-cli $MODPATH$SYSBIN/zerotier-cli ln -sf $ZTPATH/zerotier-cli $MODPATH$SYSBIN/zerotier-cli
ln -sf $ZTPATH/zerotier-idtool $MODPATH$SYSBIN/zerotier-idtool
ui_print "- set file permission" ui_print "- set file permission"
set_perm_recursive $MODPATH 0 0 0755 0644 set_perm_recursive $MODPATH 0 0 0755 0644