Files
Vole/docs/cli.md
T
yiguodev dcbd7dd277 Add the Vole CLI, config-driven TUN, and unified releases (#6)
* Add mixed-port inbound and allow unauthenticated LAN access

* Remove Invoke API and configuration version fields

* Unify CLI and native lifecycle through Invoke

Share Invoke dispatch across CLI, C ABI and JNI, make startup configuration-owned, and select Windows TUN backends at build time. Add fixed-name CLI tag releases and document scoped validation.

* Rename project and public interfaces to Vole

Rename crates, CLI and native libraries, C ABI and JNI symbols, environment variables, Windows identities and release assets consistently. Update repository references while preserving third-party code, fixed protocol vectors and historical validation evidence.

* Unify CLI and FFI builds and tag releases

* Simplify release packaging and fix Windows script tests

Windows CI fixtures assumed LF bytes and a POSIX host, while a global subprocess mock also intercepted Windows platform detection. Preserve actual notice bytes, set the Android fixture platform explicitly, and mock native build boundaries for packaging tests.

Remove internal build manifests, source snapshots, artifact hashes, delivery mode, and repeated archive inspection. Reuse platform builders, upload only the fixed archives, and assemble the complete CLI/FFI set once.

Validated 56 script tests, 58 simulated Windows-condition regressions, Ruff checks, and a native macOS ARM64 CLI release build with offline flag and configuration checks.

* Streamline build scripts, tests, and documentation

Consolidate CLI/FFI packaging and license collection, reuse native Cargo build setup, and shorten CI job names. Remove duplicate audits, binary parsers, redundant script tests, and development-history documentation.

Validation: 9 Python tests and Ruff passed; native macOS ARM64 CLI and FFI builds passed, including offline CLI checks and an Invoke version call. Resolved production feature graphs are unchanged.

* Separate UWP headers from the shared FFI API

Move VoleWindowsVpnInvoke into a UWP-only header and ship it only with the UWP backend. Include matching Windows build headers, keep Apple frameworks limited to shared headers, and update the UWP example.

Clarify that dns-hijack ignores arbitrary scheme prefixes to match Mihomo without adding validation.

Validation: 9 script tests, Ruff, and C/C++ header compilation for Windows x64 and ARM64 passed. Windows native builds were not run.

* Fix Windows release metadata decoding and timeouts

Decode Cargo and rustc output explicitly as UTF-8 instead of the Windows CP1252 default. Remove the fixed 60-second subprocess timeout that interrupted cold BoringSSL dependency downloads; release jobs already have a 90-minute limit.

Add a regression using a real subprocess under a simulated CP1252 locale. Validation: 10 script tests and Ruff passed, all six Windows feature/target metadata combinations parsed, and CLI/Wintun/UWP notice collection passed. A 61-second subprocess failed before the fix and completed afterward. Windows native builds have not been rerun.

* Validate UWP TUN settings and preserve absolute CLI paths

* Parallelize Apple FFI builds and remove embedded licenses
2026-10-08 23:24:07 +08:00

2.4 KiB
Raw Blame History

CLI

vole 是前台入口。CLI 解析参数并调用 Invoke;配置读取、初始化、信号与清理由 Invoke 的 foreground 操作处理,运行时复用同一个内核。

vole -f /path/to/config.yaml
vole -d /path/to/data -f ./config.yaml
vole -t -f ./config.yaml
cat config.yaml | vole -f -
参数 作用
-d <dir> 配置及数据目录,默认用户目录下的 .config/vole
-f <file> 配置路径;默认 <data-dir>/config.yaml,-f - 从标准输入读取
-t 校验配置后退出,不初始化数据、联网或启动 TUN
-v 输出内核版本及构建身份
-h 输出帮助

语法与 Mihomo 的 Go flag 一致:支持 -f file、-f=file、--f=file 和 -t=true; 遇到位置参数或 -- 停止解析。-h/--help 立即输出帮助,-v 优先于 -t。 参数错误返回 2,配置、启动或运行失败返回 1。

-d 与 -f 独立。与 Mihomo 一致,相对路径从启动工作目录解析并折叠 ./..; 绝对路径原样交给文件系统,保留符号链接后的 .. 语义。路径支持空格及平台原生字符。 VOLE_HOME_DIR、VOLE_CONFIG_FILE 提供环境默认值,显式参数优先。 Unix 用户目录取 HOME,Windows 取 USERPROFILE,缺失时使用工作目录。 默认 .config/vole 不存在或不可访问时,若设置 XDG_CONFIG_HOME,使用其中的 vole 目录。 配置文件必须是普通文件,文件和标准输入上限均为 256 KiB,CLI 不写回配置。

正常运行执行 initialize → createInstance → start(configYaml),等待退出后 stop → destroyInstance。Unix 支持 SIGINT/SIGTERM,Windows 支持 Ctrl+C/Ctrl+Break; 退出等待内核清理完成。诊断写入有界 stderr,不包含配置正文或凭据。 具体请求格式见 Invoke API。

TUN 与发布

TUN 完全由 YAML 配置。Unix 的 tun.file-descriptor > 0 借用宿主 fd,内核只关闭自己的副本; 省略或为 0 时 Linux/macOS 可根据 tun.device 创建或打开原生 TUN。 Windows CLI 固定使用 Wintun,DLL 由宿主提供;Windows FFI 编译时可选择 Wintun 或 UWP。 接口地址、DNS、系统路由及物理出口隔离由宿主管理,CLI 直接把配置交给内核。 平台接入见 TUN 和 Windows VPN。

构建命令、tag 发布矩阵和归档内容统一见 编译与发布。