Provider
provider 是代理订阅实体:从 source 获取 → 解析 → pre_rename → filter → rename → 按 template 渲染 → 写入 filename。
字段总览
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 否 | 显示名,未指定时用键名 |
type | string | 是 | 输入配置格式,见下表 |
source | string | 是 | URL(http(s):// 开头)或本地文件路径 |
template | string | 是 | 主输出模板(相对模板目录) |
filename | string 列表 | 否 | 渲染结果写入的文件列表 |
pre_rename | 规则名列表 | 否 | 解析后、过滤前应用(引用 rename.yaml) |
filter | 规则名列表 | 否 | 过滤阶段应用(引用 filter.yaml) |
rename | 规则名列表 | 否 | 过滤后应用(引用 rename.yaml),应用前后均检查重名 |
emoji | bool | true | 是否执行 emoji 逻辑 |
default_output | bool | 回退 p.default_output | 是否同时写默认路径文件 |
ext | string | 回退 p.ext | 默认输出文件的扩展名 |
outputs | mapping | 否 | 具名输出,见下文 |
p | 任意 YAML | {} | 自定义参数,模板中以 p.* 访问 |
type
输入配置格式:
clash— Clash YAMLmeta— Clash.Meta YAMLv2rayn— V2RayN 分享链接(Base64 JSON)sip002— SIP002 URI(逐行)surge— Surge 配置[Proxy]段qx/loon/singbox/sip008/ssdtelegram— TG 类 HTTP/SOCKS5 代理链接(tg://http/tg://socks/t.me/*)
auto不是合法的 providertype——它只用于渲染侧tpl=auto的 UA 自适应模板选择;输入格式必须显式指定。
source
untagged 枚举,纯字符串:
"https://..."或"http://..."— 远程 URL- 其余 — 本地文件路径(相对配置文件所在目录解析)
outputs(具名输出)
同一份代理列表经不同模板投影为多种格式。每个输出可独立指定:
example:
type: clash
source: "prov/example.yaml"
template: clash_list.tpl # 主输出
filename:
- prod/list/example.yaml
outputs:
base64_sub: # 具名输出 1
template: base64_sub.tpl
filename:
- prod/example_base64.txt
plain_list: # 具名输出 2
template: plain_list.tpl
filename:
- prod/example_plain.txt
p:
note: "human-readable" # 每个输出有自己的 p
- 输出渲染上下文与主输出一致:
l绑定所属 provider。 - 输出名跨所有 provider 全局唯一——重名在构建期报配置错误。
- 每个输出的
default_output/ext未设置时回退到自己的p同名键。
default_output 与 ext
默认输出路径 = <目录>/<item 名>.<ext>,其中目录取 setting.output 中“该 item 自己的 target 桶 + 自己模板名“对应条目(详见 setting.output)。未配置对应目录时不写默认输出。
example
provider.yaml
example:
name: example
type: clash
pre_rename:
- us
filter:
- us
rename:
- rm_brackets
source: "prov/example.yaml"
emoji: true
template: clash_list.tpl
filename:
- prod/list/example.yaml
p:
one: one
two: two