- 从本仓移除 ipass-core / plugin-domain / plugin-llm / plugin-apix / gateway / vendor/ngx-rust(这些属主项目 ipass/ipass) - 添加 git submodule deps/ipass -> http://192.168.1.18:13300/ipass/ipass(提供 core/gateway/ngx-rust/其他插件用于编译 cache 插件) - rust/Cargo.toml workspace 仅含 plugin-cache,依赖经 ../deps/ipass/rust/... 解析 - 移除根 tests/run.sh(主项目通用回归入口,非 cache 专用) - 修复 .gitignore:所有 tests/cache/.run-* 运行时目录均不入库(此前 .run-auth/.run-cap 被误提交,已解除跟踪) - 新增/更新 AGENTS.md 与 docs/plugins.md:明确本仓只含 cache 插件、core 从主项目取、submodule 升级方式、构建/接线说明
58 lines
3.0 KiB
TOML
58 lines
3.0 KiB
TOML
# iPass workspace:内核(crates/ipass-core)+ 唯一 cdylib(gateway)。
|
||
# 插件(plugin-domain / plugin-llm / plugin-apix)按 docs/plugin/PLUGINIZATION_PLAN.md 逐步迁入。
|
||
#
|
||
# ⚠️ [profile.release] 只能放 workspace 根:member 里写会被 cargo 静默忽略,
|
||
# panic="abort" 丢了就意味着 panic 可能跨 FFI 边界展开进 nginx。
|
||
[workspace]
|
||
resolver = "2"
|
||
members = ["crates/plugin-cache"]
|
||
# 独立 workspace:主项目 ipass/ipass 经 submodule 引入到仓库根的 deps/ipass,
|
||
# 需显式排除(路径相对本 Cargo.toml 所在目录 rust/,故是 ../deps/ipass),
|
||
# 以免与主项目自身的 workspace 冲突;target 也排除。
|
||
exclude = ["../deps/ipass", "target"]
|
||
|
||
[workspace.package]
|
||
edition = "2021"
|
||
publish = false
|
||
# vendored nginx-sys 的 build 脚本要读 CARGO_PKG_RUST_VERSION,而 cargo 只在
|
||
# 声明了 rust-version 时才注入该环境变量 —— 缺了会在构建期直接 panic。
|
||
rust-version = "1.81.0"
|
||
|
||
[workspace.dependencies]
|
||
# ⚠️ 依赖必须用 vendored 源码,不能走 crates.io,也不能走 git:
|
||
#
|
||
# 1) `ngx = "0.5"`(crates.io 0.5.1)只发布了配置阶段接口(HttpModule),
|
||
# 请求阶段 API(add_phase_handler / HttpPhase / HttpRequestHandler)尚未发版,
|
||
# 实测直接编译失败:unresolved imports `ngx::http::HttpPhase`
|
||
#
|
||
# 2) git 依赖会永久挂起:ngx-rust 挂了一个指向完整 nginx 仓库的 submodule
|
||
# [submodule "nginx-src/nginx"] url = https://github.com/nginx/nginx.git
|
||
# cargo 解析 git 依赖时会 update_submodules,去克隆几十 MB 的 nginx 仓库,
|
||
# 国内网络下卡死(实测 cargo 5 分钟 0% CPU,调用栈停在
|
||
# GitCheckout::update_submodules -> fetch -> wait4)。
|
||
#
|
||
# 因此 vendor 到 vendor/ngx-rust/,用 path 依赖:离线可编译、无子模块、版本锁定。
|
||
# 本仓只含 cache 插件,ipass-core / gateway / ngx-rust 全部从主项目 ipass/ipass
|
||
# (http://192.168.1.18:13300/ipass/ipass)经 submodule deps/ipass 引入。
|
||
ngx = { path = "../deps/ipass/rust/vendor/ngx-rust" }
|
||
nginx-sys = { path = "../deps/ipass/rust/vendor/ngx-rust/nginx-sys" }
|
||
|
||
# 业务层依赖:全部是纯 Rust 实现,不引入任何系统库或常驻依赖
|
||
serde = { version = "1", features = ["derive"] }
|
||
serde_json = "1" # 序列化为紧凑 JSON;空 Vec/Vec<Map> 自动产出 [] / {}
|
||
sha2 = "0.10" # 迭代加盐 SHA-256;hash_password 算法已用独立 Python 实现逐位核对过
|
||
getrandom = "0.2" # 不可退化成可预测伪随机(API Key / salt 由它生成)
|
||
libc = "0.2" # 仅用于 localtime_r(取本地时区)
|
||
|
||
# 内核 crate:从主项目 ipass/ipass 经 submodule deps/ipass 引入;方向只能是 plugin → core
|
||
ipass-core = { path = "../deps/ipass/rust/crates/ipass-core" }
|
||
plugin-cache = { path = "crates/plugin-cache" }
|
||
|
||
[profile.release]
|
||
opt-level = 3
|
||
lto = true
|
||
codegen-units = 1
|
||
# 模块被加载进 nginx 这个 C 进程,panic 绝不能跨 FFI 边界展开
|
||
panic = "abort"
|
||
strip = true
|