Files
sso/source/rust/gateway/build.rs
T
ssw a988cc3763 refactor: 网关拆分为 ipass-core 内核 + plugin-sso/plugin-domain 插件 + gateway
原 source/rust/src/ 单体 crate 拆为 Cargo workspace:

  crates/ipass-core/    内核:state(共享内存) / store(JSON 原子写) /
                        users(账号唯一写入口) / models(共性字段 + extra 透传) /
                        config(共性常量) / plugin(装配契约) / loc(开关) /
                        session / audit / http / util
  crates/plugin-sso/    身份插件:OAuth2 / OIDC / IAP / TOTP / RSA 等个性代码
  crates/plugin-domain/ 域名插件:企业域名「子域名 → 后端」转发 + 申请/审核
  gateway/              **唯一** cdylib,module 壳 + PLUGINS 装配数组

收窄原则:内核只留共性,个性代码下放插件。收窄后内核不再提供原单体的
bump_window / put_ukey / put_upstream / reload_shm 等,改由插件用 state 泛型
原语自行重建;OAuth 常量与前缀(如 OAUTH_SESSION_COOKIE=sso_sid、
IAP_TOKEN_AUDIENCE=sso-gateway)与历史取值严格一致。

插件一律 crate-type=["rlib"] 由 gateway 静态链入,产出单个
libsso_gateway.dylib —— 不各自出 .so(nginx 动态模块无稳定 ABI,
跨 .so 传 String 即双重 free)。

插件装配点集中在 gateway 5 处:use / PLUGINS 数组 / ModuleConfig 字段 /
Merge / loc_switch 分支,外加指令数组(长度 +1,新增 sso_domain 等开关)。
2026-09-13 10:23:34 +08:00

21 lines
978 B
Rust
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.
//! 构建脚本:让 cdylib 允许「未定义符号」。
//!
//! nginx 动态模块的运行时符号(`ngx_palloc` / `ngx_http_add_variable` /
//! `ngx_shared_memory_add` …)由 nginx 主程序在 `load_module` 时提供,
//! 链接本模块时它们必然是未定义的——这是动态模块的固有属性,不是错误。
//!
//! * Linux:cdylib 默认允许未定义符号,无需处理。
//! * macOS:必须显式 `-undefined dynamic_lookup`,否则 ld 直接报
//! `symbol(s) not found for architecture x86_64`。
//!
//! 注意:vendored 的 `ngx` crate 的 build.rs 也设了这两项,但
//! `rustc-link-arg` 只对「设置它的那个 crate」生效,不会传递给依赖它的
//! crate,所以本 crate 必须自己再设一次。
fn main() {
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") {
println!("cargo::rustc-link-arg=-undefined");
println!("cargo::rustc-link-arg=dynamic_lookup");
}
}