refactor: 移除独立 hub/proxy/executor/gateway crate,统一为 gateway tunnel 架构

- 删除 aether-hub、aether-proxy 独立项目及其 Dockerfile/配置
- 删除 crates/aether-executor 和 crates/aether-gateway 全部模块
- 新增 apps/ 目录作为应用入口
- 将 hub 概念重构为 gateway tunnel transport
- 将 executor 重构为 execution runtime
- 新增 tunnel.rs 合约定义和 testkit tunnel/execution_runtime 模块
- 更新 Python 服务层和测试适配新架构命名
This commit is contained in:
fawney19
2026-04-03 14:59:58 +08:00
parent ddf18fed9a
commit 8f26e1a31f
983 changed files with 103097 additions and 105836 deletions
@@ -0,0 +1,514 @@
use super::*;
pub(super) fn classify_admin_basic_family_route(
method: &http::Method,
normalized_path: &str,
normalized_path_no_trailing: &str,
) -> Option<ClassifiedRoute> {
if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/management-tokens" | "/api/admin/management-tokens/"
)
{
Some(classified(
"admin_proxy",
"management_tokens_manage",
"list_tokens",
"admin:management_tokens",
false,
))
} else if method == http::Method::GET
&& normalized_path.starts_with("/api/admin/management-tokens/")
{
Some(classified(
"admin_proxy",
"management_tokens_manage",
"get_token",
"admin:management_tokens",
false,
))
} else if method == http::Method::DELETE
&& normalized_path.starts_with("/api/admin/management-tokens/")
{
Some(classified(
"admin_proxy",
"management_tokens_manage",
"delete_token",
"admin:management_tokens",
false,
))
} else if method == http::Method::PATCH
&& normalized_path.starts_with("/api/admin/management-tokens/")
&& normalized_path.ends_with("/status")
{
Some(classified(
"admin_proxy",
"management_tokens_manage",
"toggle_status",
"admin:management_tokens",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/ldap/config" | "/api/admin/ldap/config/"
)
{
Some(classified(
"admin_proxy",
"ldap_manage",
"get_config",
"admin:ldap",
false,
))
} else if method == http::Method::PUT
&& matches!(
normalized_path,
"/api/admin/ldap/config" | "/api/admin/ldap/config/"
)
{
Some(classified(
"admin_proxy",
"ldap_manage",
"set_config",
"admin:ldap",
false,
))
} else if method == http::Method::POST
&& matches!(
normalized_path,
"/api/admin/ldap/test" | "/api/admin/ldap/test/"
)
{
Some(classified(
"admin_proxy",
"ldap_manage",
"test_connection",
"admin:ldap",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/gemini-files/mappings" | "/api/admin/gemini-files/mappings/"
)
{
Some(classified(
"admin_proxy",
"gemini_files_manage",
"list_mappings",
"admin:gemini_files",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/gemini-files/stats" | "/api/admin/gemini-files/stats/"
)
{
Some(classified(
"admin_proxy",
"gemini_files_manage",
"stats",
"admin:gemini_files",
false,
))
} else if method == http::Method::DELETE
&& matches!(
normalized_path,
"/api/admin/gemini-files/mappings" | "/api/admin/gemini-files/mappings/"
)
{
Some(classified(
"admin_proxy",
"gemini_files_manage",
"cleanup_mappings",
"admin:gemini_files",
false,
))
} else if method == http::Method::DELETE
&& normalized_path.starts_with("/api/admin/gemini-files/mappings/")
{
Some(classified(
"admin_proxy",
"gemini_files_manage",
"delete_mapping",
"admin:gemini_files",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/gemini-files/capable-keys" | "/api/admin/gemini-files/capable-keys/"
)
{
Some(classified(
"admin_proxy",
"gemini_files_manage",
"capable_keys",
"admin:gemini_files",
false,
))
} else if method == http::Method::POST
&& matches!(
normalized_path,
"/api/admin/gemini-files/upload" | "/api/admin/gemini-files/upload/"
)
{
Some(classified(
"admin_proxy",
"gemini_files_manage",
"upload",
"admin:gemini_files",
false,
))
} else if method == http::Method::GET && normalized_path == "/api/admin/modules/status" {
Some(classified(
"admin_proxy",
"modules_manage",
"status_list",
"admin:modules",
false,
))
} else if method == http::Method::GET
&& normalized_path.starts_with("/api/admin/modules/status/")
{
Some(classified(
"admin_proxy",
"modules_manage",
"status_detail",
"admin:modules",
false,
))
} else if method == http::Method::PUT
&& normalized_path.starts_with("/api/admin/modules/status/")
&& normalized_path.ends_with("/enabled")
{
Some(classified(
"admin_proxy",
"modules_manage",
"set_enabled",
"admin:modules",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/adaptive/keys" | "/api/admin/adaptive/keys/"
)
{
Some(classified(
"admin_proxy",
"adaptive_manage",
"list_keys",
"admin:adaptive",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/adaptive/summary" | "/api/admin/adaptive/summary/"
)
{
Some(classified(
"admin_proxy",
"adaptive_manage",
"summary",
"admin:adaptive",
false,
))
} else if method == http::Method::GET
&& normalized_path.starts_with("/api/admin/adaptive/keys/")
&& normalized_path.ends_with("/stats")
&& normalized_path.matches('/').count() == 6
{
Some(classified(
"admin_proxy",
"adaptive_manage",
"get_stats",
"admin:adaptive",
false,
))
} else if method == http::Method::PATCH
&& normalized_path.starts_with("/api/admin/adaptive/keys/")
&& normalized_path.ends_with("/mode")
&& normalized_path.matches('/').count() == 6
{
Some(classified(
"admin_proxy",
"adaptive_manage",
"toggle_mode",
"admin:adaptive",
false,
))
} else if method == http::Method::PATCH
&& normalized_path.starts_with("/api/admin/adaptive/keys/")
&& normalized_path.ends_with("/limit")
&& normalized_path.matches('/').count() == 6
{
Some(classified(
"admin_proxy",
"adaptive_manage",
"set_limit",
"admin:adaptive",
false,
))
} else if method == http::Method::DELETE
&& normalized_path.starts_with("/api/admin/adaptive/keys/")
&& normalized_path.ends_with("/learning")
&& normalized_path.matches('/').count() == 6
{
Some(classified(
"admin_proxy",
"adaptive_manage",
"reset_learning",
"admin:adaptive",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/provider-strategy/strategies" | "/api/admin/provider-strategy/strategies/"
)
{
Some(classified(
"admin_proxy",
"provider_strategy_manage",
"list_strategies",
"admin:provider_strategy",
false,
))
} else if method == http::Method::PUT
&& normalized_path.starts_with("/api/admin/provider-strategy/providers/")
&& normalized_path.ends_with("/billing")
{
Some(classified(
"admin_proxy",
"provider_strategy_manage",
"update_provider_billing",
"admin:provider_strategy",
false,
))
} else if method == http::Method::GET
&& normalized_path.starts_with("/api/admin/provider-strategy/providers/")
&& normalized_path.ends_with("/stats")
{
Some(classified(
"admin_proxy",
"provider_strategy_manage",
"get_provider_stats",
"admin:provider_strategy",
false,
))
} else if method == http::Method::DELETE
&& normalized_path.starts_with("/api/admin/provider-strategy/providers/")
&& normalized_path.ends_with("/quota")
&& normalized_path.matches('/').count() == 6
{
Some(classified(
"admin_proxy",
"provider_strategy_manage",
"reset_provider_quota",
"admin:provider_strategy",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/billing/presets" | "/api/admin/billing/presets/"
)
{
Some(classified(
"admin_proxy",
"billing_manage",
"list_presets",
"admin:billing",
false,
))
} else if method == http::Method::POST
&& matches!(
normalized_path,
"/api/admin/billing/presets/apply" | "/api/admin/billing/presets/apply/"
)
{
Some(classified(
"admin_proxy",
"billing_manage",
"apply_preset",
"admin:billing",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/billing/rules" | "/api/admin/billing/rules/"
)
{
Some(classified(
"admin_proxy",
"billing_manage",
"list_rules",
"admin:billing",
false,
))
} else if method == http::Method::GET
&& normalized_path.starts_with("/api/admin/billing/rules/")
&& normalized_path.matches('/').count() == 5
{
Some(classified(
"admin_proxy",
"billing_manage",
"get_rule",
"admin:billing",
false,
))
} else if method == http::Method::POST
&& matches!(
normalized_path,
"/api/admin/billing/rules" | "/api/admin/billing/rules/"
)
{
Some(classified(
"admin_proxy",
"billing_manage",
"create_rule",
"admin:billing",
false,
))
} else if method == http::Method::PUT
&& normalized_path.starts_with("/api/admin/billing/rules/")
&& normalized_path.matches('/').count() == 5
{
Some(classified(
"admin_proxy",
"billing_manage",
"update_rule",
"admin:billing",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/billing/collectors" | "/api/admin/billing/collectors/"
)
{
Some(classified(
"admin_proxy",
"billing_manage",
"list_collectors",
"admin:billing",
false,
))
} else if method == http::Method::GET
&& normalized_path.starts_with("/api/admin/billing/collectors/")
&& normalized_path.matches('/').count() == 5
{
Some(classified(
"admin_proxy",
"billing_manage",
"get_collector",
"admin:billing",
false,
))
} else if method == http::Method::POST
&& matches!(
normalized_path,
"/api/admin/billing/collectors" | "/api/admin/billing/collectors/"
)
{
Some(classified(
"admin_proxy",
"billing_manage",
"create_collector",
"admin:billing",
false,
))
} else if method == http::Method::PUT
&& normalized_path.starts_with("/api/admin/billing/collectors/")
&& normalized_path.matches('/').count() == 5
{
Some(classified(
"admin_proxy",
"billing_manage",
"update_collector",
"admin:billing",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/payments/orders" | "/api/admin/payments/orders/"
)
{
Some(classified(
"admin_proxy",
"payments_manage",
"list_orders",
"admin:payments",
false,
))
} else if method == http::Method::GET
&& normalized_path_no_trailing.starts_with("/api/admin/payments/orders/")
&& normalized_path_no_trailing.matches('/').count() == 5
{
Some(classified(
"admin_proxy",
"payments_manage",
"get_order",
"admin:payments",
false,
))
} else if method == http::Method::POST
&& normalized_path_no_trailing.starts_with("/api/admin/payments/orders/")
&& normalized_path_no_trailing.ends_with("/expire")
&& normalized_path_no_trailing.matches('/').count() == 6
{
Some(classified(
"admin_proxy",
"payments_manage",
"expire_order",
"admin:payments",
false,
))
} else if method == http::Method::POST
&& normalized_path_no_trailing.starts_with("/api/admin/payments/orders/")
&& normalized_path_no_trailing.ends_with("/credit")
&& normalized_path_no_trailing.matches('/').count() == 6
{
Some(classified(
"admin_proxy",
"payments_manage",
"credit_order",
"admin:payments",
false,
))
} else if method == http::Method::POST
&& normalized_path_no_trailing.starts_with("/api/admin/payments/orders/")
&& normalized_path_no_trailing.ends_with("/fail")
&& normalized_path_no_trailing.matches('/').count() == 6
{
Some(classified(
"admin_proxy",
"payments_manage",
"fail_order",
"admin:payments",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/payments/callbacks" | "/api/admin/payments/callbacks/"
)
{
Some(classified(
"admin_proxy",
"payments_manage",
"list_callbacks",
"admin:payments",
false,
))
} else {
None
}
}