Providers (proxy-providers, rule-providers, inbound-providers)¶
Providers load proxies, rules, or inbound listeners dynamically from remote HTTP endpoints, local files (with automatic OS filesystem hot-reload watching), or inline definitions.
All local file and cache path values resolve relative to -d and are validated against Safe Paths.
Proxy Providers (proxy-providers)¶
Supports http and file types (inline is not supported for proxy-providers).
type: http¶
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
type |
"http" |
Yes | — | Remote HTTP provider. |
url |
string |
Yes | — | Valid HTTP(S) URL (fetched directly; proxy and custom header fields are not implemented). |
path |
string |
No | proxy_providers/<md5(url)>.yaml |
Local cache file path (relative to -d). |
interval |
u64 (seconds) |
No | 86400 (24 hours) |
Auto-refresh interval (0 disables scheduled fetches). |
health-check |
object | No | See below | Health-check configuration. |
type: file¶
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
type |
"file" |
Yes | — | Local file provider (auto-reloads on file edits via OS watcher with 50 ms debounce). |
path |
string |
Yes | — | Local YAML path (relative to -d). |
interval |
u64 (seconds) |
No | 0 (disabled) |
Optional polling interval. |
health-check |
object | No | See below | Health-check configuration. |
health-check¶
| Key | Type | Default | Description |
|---|---|---|---|
enable |
bool |
— | Important: ClashRS currently does not check enable; automatic health checks run whenever interval != 0. Set interval: 0 explicitly to disable automatic checks. |
url |
string |
"http://www.gstatic.com/generate_204" |
Latency test URL. |
interval |
u64 (seconds) |
300 |
Check interval (0 disables automatic checks). |
lazy |
bool |
true |
Defer checks until traffic uses the provider. |
Provider File Format¶
The YAML payload must contain a top-level proxies: list (invalid individual entries log a warning and are skipped):
proxies:
- name: hk-01
type: ss
server: hk01.example.com
port: 8388
cipher: aes-256-gcm
password: "password"
proxy-providers:
remote-sub:
type: http
url: "https://sub.example.com/proxies.yaml"
path: ./providers/remote-sub.yaml
interval: 3600
health-check:
enable: true
url: http://www.gstatic.com/generate_204
interval: 300
lazy: true
local-nodes:
type: file
path: ./providers/nodes.yaml
health-check:
interval: 0
Unsupported Mihomo proxy-providers Fields
proxy, header, filter, exclude-filter, exclude-type, override, payload, size-limit, dialer-proxy, health-check.expected-status, and health-check.timeout are not defined.
Rule Providers (rule-providers)¶
Supports http, file, and inline types; initialized asynchronously in the background.
Behaviors & Formats¶
behavior(required):domain— compiled into a compactDomainSetsupporting exact domains,*.example.com(single-level wildcard),.example.com(subdomains only), and+.example.com(domain and all subdomains).ipcidr— compiled into aCidrTrieof IPv4/IPv6 CIDRs.classical— targetless routing rules (TYPE,PAYLOAD[,OPTIONS], nestedRULE-SETforbidden), with fast indexes forDOMAIN,DOMAIN-SUFFIX,DOMAIN-KEYWORD, andIP-CIDR(withoutno-resolve).format(optional, defaultyaml):yaml— YAML object with apayload: [...]list.text— line-delimited plain text (ignores blank lines and#///comments).mrs— Mihomo Rule Set binary v1 (Zstandard compressed,MRS\x01); supported fordomainandipcidronly (classicalreturns an error).
Fields by Type¶
| Type | Required Keys | Optional Keys & Defaults |
|---|---|---|
http |
type: http, url, behavior |
interval (0), path (rules/<md5(url)>), format (yaml), inline-rules / payload (merged for yaml/text) |
file |
type: file, path, behavior |
interval (None; uses OS file watcher), format (yaml), inline-rules / payload (merged for yaml/text) |
inline |
type: inline, behavior, inline-rules (alias payload) |
path (rules/<md5(name)>, unused at runtime) |
rule-providers:
ad-domains:
type: http
behavior: domain
format: mrs
url: "https://rules.example.com/ads.mrs"
path: ./rules/ads.mrs
interval: 86400
lan-cidrs:
type: file
behavior: ipcidr
format: text
path: ./rules/lan.txt
custom-inline:
type: inline
behavior: classical
payload:
- DOMAIN-SUFFIX,internal.example.com
- IP-CIDR,198.51.100.0/24,no-resolve
Inbound Providers (inbound-providers)¶
Dynamically loads additional listeners from a local YAML file or remote HTTP endpoint. The payload must contain a top-level listeners: list.
| Type | Required Keys | Optional Keys & Defaults |
|---|---|---|
http |
type: http, url |
interval (86400 seconds), path (inbound_providers/<md5(url)>.yaml) |
file |
type: file, path |
interval (0, disables polling; uses file watcher) |
For shadowsocks, anytls, and hysteria2 listeners, updating users inside an inbound provider refreshes user credentials in place without closing the listening socket.