Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provider

provider 是代理订阅实体:从 source 获取 → 解析 → pre_renamefilterrename → 按 template 渲染 → 写入 filename

字段总览

字段类型必填说明
namestring显示名,未指定时用键名
typestring输入配置格式,见下表
sourcestringURL(http(s):// 开头)或本地文件路径
templatestring主输出模板(相对模板目录)
filenamestring 列表渲染结果写入的文件列表
pre_rename规则名列表解析后、过滤前应用(引用 rename.yaml
filter规则名列表过滤阶段应用(引用 filter.yaml
rename规则名列表过滤后应用(引用 rename.yaml),应用前后均检查重名
emojibooltrue是否执行 emoji 逻辑
default_outputbool回退 p.default_output是否同时写默认路径文件
extstring回退 p.ext默认输出文件的扩展名
outputsmapping具名输出,见下文
p任意 YAML{}自定义参数,模板中以 p.* 访问

type

输入配置格式:

  • clash — Clash YAML
  • meta — Clash.Meta YAML
  • v2rayn — V2RayN 分享链接(Base64 JSON)
  • sip002 — SIP002 URI(逐行)
  • surge — Surge 配置 [Proxy]
  • qx / loon / singbox / sip008 / ssd
  • telegram — TG 类 HTTP/SOCKS5 代理链接(tg://http / tg://socks / t.me/*

auto 不是合法的 provider type——它只用于渲染侧 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