How snapei/clash-pro-rules works
1. This repository is not an application runtime; it is a curated data distribution repo for Clash / Mihomo rule-provider lists. Its “product” is a set of plain-text rule files that external Clash clients fetch over HTTP and convert into routing decisions.
2. The core assets are the .txt lists in the repo root. They fall into two broad data types:
• domain-based lists such as apple.txt, google.txt, youtube.txt, telegram.txt, tiktok.txt, ai.txt, github.txt, workspace.txt, multimedia.txt, proxy.txt
• IP-CIDR-based lists such as cncidr.txt, netflixcidr.txt, telegramcidr.txt, metacidr.txt, applecidr.txt, youtubecidr.txt, lancidr.txt, microsoft.txt’s domain counterpart only, etc.
3. Each list is a separately consumable boundary. In Clash terms, these map to rule-providers with different behavior settings:
• behavior: domain for hostname/domain matching
• behavior: ipcidr for IP range matching
That separation is important because the client treats domain and IP rules differently in both matching and resolution behavior.
4. The repository’s routing model is policy-driven. The lists are not “actions” by themselves; they are inputs that select a policy name in the consumer’s Clash config, such as DIRECT, PROXY, or custom groups like GOOGLE, YOUTUBE, NETFLIX. The README explicitly shows service-specific policy wiring rather than hardcoded behavior in the repo.
5. Rule precedence is part of the architecture. The recommended consumer rule order is:
• process-name exclusions first
• local/LAN IP ranges next
• reject lists
• service-specific direct rules (icloud, apple)
• service-specific proxy groups (google, youtube, netflix, telegram, tiktok, proxy)
• generic direct lists
• final GEOIP,CN,DIRECT
• default catch-all MATCH,PROXY
So the repo is designed to feed a layered routing pipeline, not a flat list.
6. There are three major rule families represented by the filenames:
• “major platforms” and vendors: Apple, Google, Microsoft, Amazon, GitHub, Meta, Android
• “traffic destinations” and apps: YouTube, Netflix, Telegram, TikTok, X, socials, workspace, multimedia
• “network policy” and catch-all control lists: direct.txt, reject.txt, gfw.txt, greatfire.txt, proxy.txt, tld-not-cn.txt
These families imply different downstream routing intents: bypass, proxy, block, or classification.
7. The repo has a clear upstream-data boundary. The README names the sources used to assemble the lists, including:
• Loyalsoldier v2ray-rules-dat and clash-rules
• v2fly/domain-list-community
• felixonmars/dnsmasq-china-list
• 17mon/china_ip_list
This means the repo is a consolidation layer over multiple external datasets rather than a primary source of truth.
8. The delivery boundary is GitHub raw hosting and jsDelivr CDN. The README instructs consumers to fetch files from raw.githubusercontent.com or cdn.jsdelivr.net, so the repo acts as a static origin for rule-provider URLs, with CDN fallback for availability.
9. The consumer boundary is the Clash/Mihomo client configuration. Nothing in the repo runs server-side; all logic happens in the client after download. The repo’s role is to supply stable URLs and file contents that the client periodically refreshes, typically on a 24-hour interval.
10. The repo also encodes platform-specific constraints in the README:
• it is intended for Clash and Mihomo
• PROCESS-NAME rules are only supported in ClashX Pro
• no-resolve is used selectively on some CIDR rules to avoid DNS resolution
These details matter for architecture because they affect which client capabilities the data set assumes.
11. The maintenance/tooling surface is minimal. clash-format.yaml suggests formatting or linting support for the rule files, and config.yaml likely holds generation or packaging configuration. But there is no evidence of a build service, API layer, database, or dynamic backend in the repository itself.
12. In diagram terms, the repository is best modeled as a static rule-data publisher:
upstream community lists and curated sources feed this repo’s text artifacts, which are hosted via GitHub/CDN, which are then consumed by Clash rule-providers to drive routing decisions across direct, proxy, and reject paths.
Main entry points: README.md README
Components 15
Upstream sources
External community datasets consolidated into the repo.
- Community sources · External rule and IP datasets used to assemble the lists.
Repository assets
Static rule files and lightweight packaging/formatting support.
- README · Documents rule-provider usage, precedence, delivery URLs, and client assumptions.
README.md - Tooling · Minimal repo tooling for formatting and generation/packaging support.
- Domain lists · Hostname/domain-based rule-provider lists such as major platforms and services.
- CIDR lists · IP-CIDR rule-provider lists for network ranges and geo/IP matching.
- Platform lists · Vendor and platform coverage such as Apple, Google, Microsoft, Amazon, GitHub, Meta, Android.
- App lists · Traffic destinations and app-oriented lists such as YouTube, Netflix, Telegram, TikTok, X, socials, workspace, multimedia.
- Control lists · Direct, proxy, reject, GFW, greatfire, and tld-not-cn control inputs for routing precedence.
Consumer side
GitHub/CDN delivery and Clash/Mihomo rule-provider consumption.
- GitHub raw · Primary static origin used by consumers to fetch rule files.
- jsDelivr CDN · Fallback delivery path for the same static rule files.
- Rule providers · Clash/Mihomo rule-provider entries that point at the hosted text files.
- Clash/Mihomo · External client that refreshes rule-provider files and applies match behavior.
- DIRECT · Bypass path selected by direct-oriented rule lists.
- PROXY · Proxy path selected by proxy-oriented service lists.
- REJECT · Block path selected by reject and block-oriented lists.
Connections 22
- Community sources → Domain lists: feed · Community datasets are consolidated into domain-based rule files.
- Community sources → CIDR lists: feed · Community datasets are consolidated into IP-CIDR rule files.
- Community sources → Control lists: feed · Upstream lists inform direct, proxy, reject, and block controls.
- README → Rule providers: documents · README explains the provider URLs, behaviors, and usage patterns.
- README → Clash/Mihomo: documents · README describes client capabilities and rule precedence assumptions.
- Tooling → Domain lists: supports · Formatting/configuration helps keep the text artifacts consistent.
- Tooling → CIDR lists: supports · Formatting/configuration helps keep the CIDR artifacts consistent.
- Domain lists → Platform lists: contains · Domain-based lists include platform and vendor coverage.
- Domain lists → App lists: contains · Domain-based lists include app and destination coverage.
- CIDR lists → Platform lists: pairs with · Some services also have CIDR companions for IP-based matching.
- Control lists → DIRECT: routes to · Direct-oriented lists select bypass behavior in consumer configs.
- Control lists → PROXY: routes to · Proxy-oriented lists select upstream proxy groups in consumer configs.
- Control lists → REJECT: routes to · Reject and block-oriented lists select deny behavior.
- Domain lists → Rule providers: published as · Domain rule files are exposed as Clash/Mihomo rule providers.
- CIDR lists → Rule providers: published as · CIDR rule files are exposed as Clash/Mihomo rule providers.
- Control lists → Rule providers: published as · Control lists are also consumed through rule-provider entries.
- GitHub raw → Rule providers: fetches from · Primary consumer URL pattern is GitHub raw hosting.
- jsDelivr CDN → Rule providers: fetches from · jsDelivr mirrors the same static files as a CDN fallback.
- Rule providers → Clash/Mihomo: refreshes · The client periodically downloads and refreshes provider contents.
- Clash/Mihomo → DIRECT: matches · Rule evaluation can terminate on direct routing decisions.
- Clash/Mihomo → PROXY: matches · Rule evaluation can terminate on proxy routing decisions.
- Clash/Mihomo → REJECT: matches · Rule evaluation can terminate on reject routing decisions.