Rule Providers
Similar to proxy providers, rule-providers let you dynamically fetch a rule file from an online URL, referenced in your rules with RULE-SET — no need to hand-write hundreds of rules into rules yourself.
Example Config
rule-providers: google: type: http path: ./rule1.yaml url: "https://raw.githubusercontent.com/.../Google.yaml" interval: 600 behavior: classical format: yaml rules: - RULE-SET,google,PROXY
Field Reference
google)RequiredThe provider's name — must be unique.
typeRequiredOptional: http/file/inline.
urlRequired when type is httpThe rule file's URL.
pathOptionalThe save path; if omitted, the URL's MD5 hash is used as the filename, restricted to within HomeDir (extendable via SAFE_PATHS).
intervalOptionalThe update interval, in seconds.
proxyOptionalDownload/update through a specified proxy.
behaviorRequiredThe rule provider's behavior type, which determines how each line in the file is interpreted: domain (a domain list) / ipcidr (an IP range list) / classical (full rule syntax, supporting nearly every type). This must match the actual file format — see Rule Provider Content for the syntax.
formatDefault: yamlThe file format — choose yaml/text/mrs. mrs is a compressed binary format that's smaller and loads faster, but currently only supports the domain/ipcidr behaviors; you can convert to it with mihomo convert-ruleset domain/ipcidr yaml/text XXX.yaml XXX.mrs.
path-in-bundleOptionalIf the local file doesn't exist, mihomo will first try extracting the corresponding file from BundleMRS.7z in HomeDir — you can download this archive from meta-rules-dat.
size-limitDefault: 0The maximum download file size, in bytes; 0 means no limit.
headerOptionalCustom HTTP request headers.
payloadRequired when type is inlineThe rule content defined inline.