Files
ipass__ipass/rust/Cargo.toml
T
admin 0b1d983cac 定位更名:尚数网 统一网关(原「公司统一动态域名解析出口」)
- readme 头部改为统一网关定位,明确两类能力:动态域名、LLM API 路由,预留未来扩展
- CLAUDE.md / compose.yml / Cargo.toml description / lib.rs 模块注释同步更名
2026-09-11 15:58:41 +08:00

53 lines
2.2 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 独立 workspace:vendored 的 ngx-rust 本身是 workspace 根,需显式排除以免歧义
[workspace]
exclude = ["vendor/ngx-rust"]
[package]
name = "ipass-gateway"
version = "2.0.0"
edition = "2021"
publish = false
description = "尚数网 统一网关(iPass 山海关)—— nginx + Rust 扩展模块实现"
[lib]
name = "ipass_gateway"
# cdylib 给 nginx 加载;rlib 便于单元测试
crate-type = ["cdylib", "rlib"]
[features]
default = ["export-modules"]
# 脱离 nginx 构建系统、单独产出动态模块时必须开启(生成 ngx_modules 表)
export-modules = []
[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 依赖:离线可编译、无子模块、版本锁定。
ngx = { path = "vendor/ngx-rust" }
nginx-sys = { path = "vendor/ngx-rust/nginx-sys" }
# 业务层依赖:全部是纯 Rust 实现,不引入任何系统库或常驻依赖
serde = { version = "1", features = ["derive"] }
serde_json = "1" # 替代 cjson;空 Vec/Vec<Map> 天然序列化为 [] / {},与旧版一致
sha2 = "0.10" # 替代 resty.sha256;算法与旧版逐位一致(迭代加盐 SHA-256)
getrandom = "0.2" # 替代 resty.random;不可退化成可预测伪随机(API Key 由它生成)
libc = "0.2" # 仅用于 localtime_r / time(旧版由 os.date / ngx.time 提供)
[profile.release]
opt-level = 3
lto = true
codegen-units = 1
# 模块被加载进 nginx 这个 C 进程,panic 绝不能跨 FFI 边界展开
panic = "abort"
strip = true