This commit is contained in:
riglen
2026-04-21 16:56:06 +08:00
parent 05e0355e14
commit d5cfae22ea
14 changed files with 1404 additions and 15 deletions

View File

@@ -40,6 +40,11 @@ sub-provider/
rules.py
subscriptions.py
config/
conf/
base.conf
profiles/
default.conf
lite.conf
sources.yaml
rules/
reject.yaml
@@ -90,10 +95,14 @@ docker compose up -d --build
`https://YOUR_DOMAIN/<PUBLIC_PATH>/clients/mihomo.yaml?sources=airport-a,airport-b,airport-c`
- Stash 薄壳入口:
`https://YOUR_DOMAIN/<PUBLIC_PATH>/clients/stash.yaml?sources=airport-a,airport-b,airport-c`
- Conf 薄壳入口:
`https://YOUR_DOMAIN/<PUBLIC_PATH>/conf/clients/mihomo/default.yaml`
- Mihomo/OpenClash bundle
`https://YOUR_DOMAIN/<PUBLIC_PATH>/bundle/mihomo.yaml?sources=airport-a,airport-b,airport-c`
- Stash bundle
`https://YOUR_DOMAIN/<PUBLIC_PATH>/bundle/stash.yaml?sources=airport-a,airport-b,airport-c`
- Conf bundle
`https://YOUR_DOMAIN/<PUBLIC_PATH>/conf/bundle/mihomo/default.yaml`
---
@@ -152,6 +161,77 @@ HEAD /<PUBLIC_PATH>/bundle/stash.yaml?sources=airport-a,airport-b,airport-c
- 上游订阅原始内容也会按 TTL 落盘缓存到 `data/fetch-cache/`,默认 900 秒
- 如果你想固定使用本地文件订阅,可以把文件放到 `data/sources/`,再把 `AIRPORT_*_URL` 指向 `/app/data/sources/xxx.txt`
### 5. Conf 配置入口
```text
GET /<PUBLIC_PATH>/conf/clients/{client_type}/{profile_key}.yaml
GET /<PUBLIC_PATH>/conf/bundle/{client_type}/{profile_key}.yaml
GET /<PUBLIC_PATH>/conf/providers/{profile_key}/{name}.yaml
GET /<PUBLIC_PATH>/conf/rules/{profile_key}/{name}.yaml
```
特点:
-`sources.yaml` 路由保持不变conf 路由独立存在
- 新链路读取 `config/conf/base.conf``config/conf/profiles/*.conf`
- 可以并行对比旧输出和 conf 输出,不影响日常使用
- conf 路由按请求懒加载配置conf 写坏时不会影响旧接口启动
---
## Conf 配置说明
当前已落地一套 ACL4SSR-like 的 `.conf` 配置链路:
- `config/conf/base.conf`
负责 `source``selector``group``module``builtin` 等全局定义
- `config/conf/profiles/*.conf`
负责 `sources``include_modules``include_builtins`
以及 `override_policy``prepend_rule``append_rule`
这条链路目前的目标不是替换旧接口,而是:
- 保持旧 YAML 配置和旧路由继续可用
- 用新 conf 路由做并行验证
- 逐步把输出收敛到和旧链路一致
### 示例
`base.conf` 里一条规则模块:
```ini
module = apple,../rules/acl4ssr/Apple.yaml,🍎 苹果服务,80,true
```
`default.conf` 里启用模块:
```ini
include_modules = apple,openai
include_builtins = geoip_cn,final
```
---
## 对比脚本
项目内置了一个本地对比脚本:
```bash
python scripts/compare_conf_outputs.py
```
它会:
- 启动本地 `TestClient`
- 同时请求旧路由和 conf 路由
- 输出 `proxy-providers``rule-providers``proxy-groups``rules` 的差异摘要
如果要指定样例源文件:
```bash
python scripts/compare_conf_outputs.py --sample-source C:\path\to\sample.yaml
```
---
## 默认策略结构