TopGit
GitHub Repo Review

clash-rules: a Clash Premium rule set for routing

Loyalsoldier/clash-rules
CTopGit review image for Loyalsoldier/clash-rules
Review by Topgit.dev for Loyalsoldier/clash-rules, with GitHub repository stats and README context.
Quick verdict

clash-rules solves one narrow problem well: it keeps Clash Premium's domain and IP rule files current without you hand-editing a regex block. A GitHub Actions job rebuilds every list each morning, so where most homemade Clash rule sets rot within weeks, this one doesn't. The catch: it only works on Premium-kernel clients — mihomo, Clash Meta for Android, OpenClash, clash-verge-rev — so plain Clash gets nothing from it.

Stars
★ 29.4k
Forks
⑂ 2.2k
Language
—
License
GPL-3.0
Topic
—
Updated
Nov 2026
Homepage
—
GitHub

What clash-rules is and what it provides

clash-rules is a repository of domain and IP rule files — not an app — built for Clash's Premium kernel and its TUN mode. It ships 13 plain-text lists (direct, proxy, reject, private, apple, icloud, google, gfw, tld-not-cn, telegramcidr, lancidr, cncidr, applications) that you point Clash's rule-providers config at directly from GitHub, and a scheduled Actions run refreshes them daily.

The 13 rule files clash-rules maintains

  • ✓direct.txt / proxy.txt — the core two-way split for everyday domains that need a direct connection versus ones that need the proxy.
  • ✓reject.txt — an ad and tracker domain list you can route straight to the REJECT policy.
  • ✓private.txt — internal and private-network domains kept out of the proxy entirely.
  • ✓apple.txt / icloud.txt / google.txt — Apple, iCloud, and Google domains reachable directly from mainland China; the README flags google.txt specifically for cautious use since its accuracy is less certain.
  • ✓gfw.txt — the GFWList-derived domain list for sites blocked by China's Great Firewall.
  • ✓tld-not-cn.txt — non-China top-level domains, used in the blacklist-mode rules block.
  • ✓telegramcidr.txt / cncidr.txt / lancidr.txt — IP-CIDR lists for Telegram's IP ranges, mainland China's IPv4 space, and LAN/reserved addresses.
  • ✓applications.txt — a classical-behavior list of local software that should always connect directly, not through the proxy.
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history ↗

Adding clash-rules to your Clash config

Configuring clash-rules means editing two blocks in your Clash config, not installing anything. First, a rule-providers block: for every list you want (reject, icloud, apple, google, proxy, direct, private, gfw, tld-not-cn, telegramcidr, cncidr, lancidr, applications) you set type: http, point url at either the raw.githubusercontent.com or the cdn.jsdelivr.net address from the README (jsdelivr is slower to update, roughly 12 hours behind), give it a local path to cache to, and set interval: 86400 so Clash refetches it once a day. The behavior field has to match the list — domain for the domain-list files, ipcidr for telegramcidr/cncidr/lancidr, classical for applications.txt. Second, a rules block that references each provider by name with RULE-SET,<name>,<policy>, ending in either MATCH,PROXY (whitelist mode — everything that doesn't match any rule goes through the proxy) or MATCH,DIRECT (blacklist mode — only matched traffic goes through the proxy). Either way, you need a proxy or proxy-group literally named PROXY for the RULE-SET entries pointing at it to resolve.

Why you need a rule set for Clash Premium

Clash Premium's TUN mode can capture every TCP and UDP packet on a device, but the kernel itself has no idea which domains are China-local, which are blocked by the Great Firewall, and which need to stay off the proxy entirely — like Apple's push-notification servers or iCloud sync. Left with just a MATCH,PROXY catch-all, every domain routes through the proxy, including ones that work better direct or ones a proxy accidentally blocks. Someone has to maintain that domain-to-policy mapping. That's the gap clash-rules fills, and it does the unglamorous work of tracking which of thousands of domains belongs in which bucket so you don't have to.

clash-rules vs other Clash rule collections

Loyalsoldier/geoip — the same author's compiled GeoSite/GeoIP database; mihomo and other Premium-kernel clients can reference it directly with geosite:/geoip: rule syntax instead of subscribing to these separate rule-provider text files.v2ray-rules-dat — the upstream project clash-rules pulls its domain data from, packaged for V2Ray/Xray's geosite format rather than Clash's rule-provider text lists.gfwlist/gfwlist — the raw GFWList PAC source that clash-rules' gfw.txt is derived from; usable directly in other proxy tools that read GFWList format instead of Clash rule-providers.

Limitations and caveats

  • △Two clients named in the README — ClashX Pro and Clash for Windows — are marked as no longer updated, so newcomers need clash-verge-rev, clash-party, or a Premium-kernel client like mihomo instead.
  • △The cdn.jsdelivr.net mirror lags the canonical GitHub URL by up to 12 hours, so switching to it for reliability costs you same-day freshness.
  • △The google.txt list is explicitly flagged for cautious use in the README, meaning the maintainer doesn't stand behind its accuracy the way the other lists are presented.
  • △No changelog or version tags are documented — you get whatever the latest daily build contains, with no way to pin or diff a specific release.
  • △Everything here only works with Clash's Premium kernel and TUN mode; standard, non-Premium Clash builds can't use these rule-provider files at all.
View on GitHub ↗

Frequently asked questions

Is clash-rules compatible with mihomo or Clash Meta?

clash-rules is built specifically for the Clash Premium kernel, and mihomo — the actively maintained fork the README lists as the current command-line client — is fully compatible, as is Clash Meta for Android. Any Premium-kernel client that supports rule-providers can load these files directly.

What is the difference between whitelist and blacklist mode in Clash?

Whitelist mode routes any traffic that doesn't match a rule through the proxy, and the clash-rules README recommends it for stable, fast proxy lines with no data cap. Blacklist mode does the opposite — only traffic matching a rule goes through the proxy — and suits unstable connections or limited proxy bandwidth, common on routers.

How often does clash-rules update its rule files?

clash-rules rebuilds all of its rule files automatically once a day, at 6:30 Beijing time, via a scheduled GitHub Actions job. There's no manual release process to wait on — every file at the release-branch URLs reflects that day's automated build.

Can I use clash-rules with Clash for Windows or OpenClash?

clash-rules works with OpenClash out of the box, since OpenClash runs the Clash Premium kernel on OpenWrt routers and is named directly in the README's client list. Clash for Windows also appears in that list, but the README marks it as no longer updated, so treat it as a fallback rather than a first choice.

Why are some Google domains in a separate list in clash-rules?

clash-rules ships google.txt as its own file, separate from apple.txt and icloud.txt, because it covers Google domains that are reachable directly from mainland China without a proxy. The README explicitly marks this list for cautious use, since Google's routing there is less predictable than the other lists in the collection.

Does clash-rules work with Surge or Shadowrocket configs?

clash-rules doesn't document Surge or Shadowrocket compatibility — the README's rule-providers syntax (behavior: domain, ipcidr, classical) is written for the Clash Premium kernel specifically, even though the repo carries a "surge" topic tag on GitHub. Loading the plain-text domain and IP lists into Surge's own ruleset format isn't covered in the docs.

Best use cases

  • •Setting up a mihomo or Clash Meta for Android config that needs mainland-China-aware routing, with CN IPs and domains going direct and everything else proxied.
  • •Building an OpenClash config on an OpenWrt router where every device on the LAN needs the same routing policy.
  • •Keeping Apple, iCloud, and Google traffic off the proxy so region-locked services and push notifications keep working while other domains route through the proxy.
  • •Blocking ads and trackers at the rule level via reject.txt instead of installing a separate blocker.

Who should try it — and who should skip

Anyone running a Premium-kernel Clash client — mihomo, Clash Meta for Android, clash-verge-rev, OpenClash — and tired of hand-maintaining a rules block should try clash-rules; pointing rule-providers at these URLs replaces a DIY GFWList regex with one that's already maintained. Skip it if you're on a non-Premium Clash build, a different proxy client entirely such as Shadowrocket or Surge, or you'd rather use mihomo's built-in geosite/geoip database from the same author instead of fetching separate text files.

Related repositories

Source & attribution

GitHub repository Loyalsoldier/clash-rules (https://github.com/Loyalsoldier/clash-rules).

GitHub data · last synced Aug 15, 2026Reviewed by Henry
← Back to TopGit

Still deciding about clash-rules?

One click hands the question to an AI along with this page — see what it says about clash-rules.

GitHub