- source/rust → rust/ - source/conf → conf/ - source/www → www/ - source/data-seed → data-seed/ - source/data → data/ - scripts/ 保留(语义不对应 ipass deploy/) - /build/ 加入 .gitignore(本机 nginx 源码树) - README.md 目录树同步 + build 路径 /tmp/sso-build → ./build - Cargo.toml path 依赖 '../../deps/ipass' → '../deps/ipass' - CLAUDE.md 同步路径示例 cargo check 通过(52s);release build 通过(1m26s),产物 libsso_gateway.dylib
64 lines
3.1 KiB
TOML
64 lines
3.1 KiB
TOML
# iPass SSO 网关 —— Cargo workspace
|
||
#
|
||
# 结构(参考 ipass/cache 的插件化拆分思路):
|
||
# 本仓库只持有「SSO 身份网关」自身:
|
||
# crates/plugin-sso —— 身份插件:OAuth2/OIDC 签发与校验、IAP 身份注入
|
||
# gateway —— 装配层:module 壳 + 插件注册表 → 产出单个 .so
|
||
#
|
||
# 通用框架(内核 ipass-core / 唯一 cdylib 装配 / vendored ngx-rust / 其它子系统)
|
||
# 全部来自主项目 ipass/ipass,经仓库根 `deps/ipass` git submodule 引入,
|
||
# 不在此仓库重复维护(避免与上游内核 fork 漂移)。
|
||
#
|
||
# 为什么是「单 .so + crate 级插件」而不是「多 .so 运行时插件」:
|
||
# nginx 动态模块没有稳定 ABI,Rust 侧更是如此(每个 cdylib 各链一份 std)。
|
||
# 跨 .so 共享状态要自己造 C ABI 契约,且 zone tag / 同名变量都会冲突
|
||
# (详见 docs/plugin-architecture-analysis.md)。
|
||
#
|
||
# ⚠️ deps/ipass 是独立 workspace,必须 exclude,否则 cargo 报歧义。
|
||
[workspace]
|
||
members = ["crates/plugin-sso", "gateway"]
|
||
exclude = ["../deps/ipass", "target"]
|
||
|
||
[workspace.package]
|
||
version = "1.0.0"
|
||
edition = "2021"
|
||
publish = false
|
||
|
||
# ---------------------------------------------------------------------------
|
||
# ⚠️ 依赖必须用 vendored 源码(deps/ipass 子模块内的 ngx-rust),不能走 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,调用栈停在
|
||
# GitSource::block_until_ready -> GitCheckout::update_submodules -> fetch -> wait4)。
|
||
#
|
||
# 因此 vendor 到 deps/ipass/rust/vendor/ngx-rust/,用 path 依赖:
|
||
# 离线可编译、无子模块、版本锁定。
|
||
# ---------------------------------------------------------------------------
|
||
[workspace.dependencies]
|
||
ngx = { path = "../deps/ipass/rust/vendor/ngx-rust" }
|
||
nginx-sys = { path = "../deps/ipass/rust/vendor/ngx-rust/nginx-sys" }
|
||
ipass-core = { path = "../deps/ipass/rust/crates/ipass-core" }
|
||
plugin-sso = { path = "crates/plugin-sso" }
|
||
|
||
# 业务层依赖:全部是纯 Rust 实现,不引入任何系统库或常驻依赖
|
||
serde = { version = "1", features = ["derive"] }
|
||
serde_json = "1" # 空 Vec / Vec<Map> 天然序列化为 [] / {},前后端契约简单
|
||
sha2 = "0.10" # 口令哈希 + JWT 的 HMAC-SHA256 + PKCE S256
|
||
getrandom = "0.2" # 会话 token / 授权码 / 客户端密钥;不可退化成可预测伪随机
|
||
libc = "0.2" # 仅用于 localtime_r / time / strftime
|
||
|
||
[profile.release]
|
||
opt-level = 3
|
||
lto = true
|
||
codegen-units = 1
|
||
# 模块被加载进 nginx 这个 C 进程,panic 绝不能跨 FFI 边界展开
|
||
panic = "abort"
|
||
strip = true
|