Automatically generate and publish domain rules for Clash, Surge, Quantumult X, sing-box, and V2Ray GeoSite.
The rule data comes from
v2fly/domain-list-community's publisheddlc.dat_plain.yml, together with the plain-text rules from the officialgfwlist/gfwlist. The following tags are generated:
reject: Combinescategory-ads-all, rules with the@adsattribute from all lists, and manually maintained blocking rulesgfw: Proxy domains from the official GFWListgfw-skip: GFWList whitelist entries and additional direct-connection domainsloc-!cn: Domains outside mainland Chinaloc-cn: Direct-connection rules for mainland China, combininggeolocation-cn, rules with the@cnattribute from all lists, and manually maintained direct-connection rulesstreaming-cn: Mainland China streaming and entertainment services (NetEase Cloud Music, Bilibili, iQIYI, Youku, Tencent Video, Kuaishou, Ximalaya, Kugou, Kuwo), intended for 回国-style routing (Douyin now ships as the dedicateddouyintag)douyin: Douyin (Chinese TikTok) domains plus the shared ByteDance SDK domain (snssdk.com), intended for routing via a dedicated 回国 node/policymicrosoft: Microsoft services (Microsoft 365/Office, Outlook, OneDrive, Xbox, Azure, Bing) plus US school domains (Joliet Junior College: jjc.edu, Lane Community College: lanecc.edu), intended for routing via US nodesads: Ad/tracker blocklist converted from hagezi Multi PRO (wildcard/pro.txt, ~230k domains, recommended)ads-mini: Lightweight ad/tracker blocklist converted from hagezi Multi PRO mini (wildcard/pro.mini.txt, ~60k domains)
The
ads/ads-minirule data comes fromhagezi/dns-blocklists, which is licensed under GPL-3.0. The lists are converted here into proxy-tool formats; the original lists remain available at the upstream repository.
DNS/domain-level blocking stops third-party ads and trackers. It cannot block in-feed ads served from the same first-party domain as the content itself (e.g. Facebook/TikTok feed ads) — blocking those domains would break the app.
The upstream
domain-list-communityfile already includes rule expansion, attribute filtering, and deduplication.
URLs and wildcard rules in the GFWList are converted into domain rules, while whitelist exceptions are written separately to
gfw-skip.
This project extracts, supplements, and converts the rules into formats supported by various clients.
@cnand@adsare matched by their complete attribute names. Other attributes such as@!cnand@!adsare not included. Rules are deduplicated after merging. The@cnattribute does not guarantee that a server is located inside mainland China. Rules containing both@cnand@adsare included in both corresponding tags.
GitHub Actions builds the rules once a day and automatically builds them whenever
mainis updated. Build artifacts are published to therelbranch; that branch is rebuilt on every release and retains only the latest results.
| Path | Format |
|---|---|
<tag>.yaml |
Clash Rule Provider |
<tag>.list |
Surge Domain Set |
<tag>.quanx |
Quantumult X Filter |
<tag>.srs |
sing-box Binary Rule Set |
chnroutes.mmdb |
MaxMind-format China IP database for Surge geoip-maxmind-url |
geosite.dat |
V2Ray GeoSite containing reject, loc-!cn, loc-cn, streaming-cn, microsoft, and douyin |
geosite-cn.dat |
V2Ray GeoSite containing loc-cn |
geosite-gfw.dat |
V2Ray GeoSite containing gfw and gfw-skip |
ext/*.quanx |
Quantumult X Rewrite Rules |
ext/*.sgmodule |
Surge Modules |
⚠️ Do not overwrite your client's officialgeosite.datwith the one above. It only contains the 6 custom tags listed; Xray treats a routing rule that references a missing tag (e.g. the built-ingeosite:cn) as a hard startup error and the core will refuse to start. Instead, save it under a different name (e.g.geosite-dmulle12.dat) next to the official file and reference tags asgeosite:<tag>@geosite-dmulle12.dat.
Download URL format:
https://github.com/dmulle12/rules/raw/rel/<file>
Examples:
https://github.com/dmulle12/rules/raw/rel/loc-cn.srs
https://github.com/dmulle12/rules/raw/rel/ext/bili.quanx
https://github.com/dmulle12/rules/raw/rel/ext/bili.sgmodule
Surge GEOIP database (updated daily from
Loyalsoldier/geoip):
[General]
geoip-maxmind-url = https://github.com/dmulle12/rules/raw/rel/chnroutes.mmdb.
├── main.py # Rule generator
├── tools/mmdb/ # chnroutes.mmdb builder (Go, MaxMind format)
├── source/ # Manually maintained rewrite rules and modules
├── js/ # JavaScript scripts
├── example/ # Client configuration examples
├── tests/ # Rule parsing tests
├── .github/workflows/build.yml
├── pyproject.toml
└── uv.lock
uv sync
uv run python main.pyBuild artifacts are generated in
dist/.