Convert Figma logo to code with AI

Loyalsoldier logoclash-rules

🦄️ 🎃 👻 Clash Premium 规则集(RULE-SET),兼容 ClashX Pro、Clash for Windows 等基于 Clash Premium 内核的客户端。

18,291
1,633
18,291
1

Top Related Projects

3,266

SSR 去广告ACL规则/SS完整GFWList规则/Clash规则碎片,Telegram频道订阅地址

搜集、整理、维护 Surge / Quantumult (X) / Shadowrocket / Surfboard / clash (Premium) 实用规则。

分流规则、重写写规则及脚本。

Quick Overview

Loyalsoldier/clash-rules is a GitHub repository that provides a collection of rule sets for the Clash proxy tool. It offers various pre-configured rule lists to enhance network traffic control and improve user experience when using Clash for network management and filtering.

Pros

  • Comprehensive rule sets covering various categories like direct connections, proxy routing, and ad blocking
  • Regular updates to maintain effectiveness against evolving network patterns
  • Easy integration with Clash configuration files
  • Community-driven project with contributions from multiple users

Cons

  • May require manual updates to stay current with the latest rules
  • Some rule sets might be too broad or restrictive for specific use cases
  • Potential for false positives or negatives in traffic classification
  • Requires basic understanding of Clash configuration to implement effectively

Getting Started

To use these rule sets with Clash:

  1. Add the desired rule set URLs to your Clash configuration file:
rule-providers:
  reject:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/reject.txt"
    path: ./ruleset/reject.yaml
    interval: 86400

  icloud:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/icloud.txt"
    path: ./ruleset/icloud.yaml
    interval: 86400

rules:
  - RULE-SET,reject,REJECT
  - RULE-SET,icloud,DIRECT
  1. Restart Clash or reload the configuration to apply the new rules.

  2. Monitor your network traffic to ensure the rules are working as expected.

Competitor Comparisons

3,266

SSR 去广告ACL规则/SS完整GFWList规则/Clash规则碎片,Telegram频道订阅地址

Pros of ACL4SSR

  • More comprehensive rule sets, including specialized lists for different purposes
  • Frequent updates and active community contributions
  • Includes additional tools and scripts for rule management

Cons of ACL4SSR

  • Larger file sizes due to more extensive rule sets
  • May require more configuration and customization
  • Potentially higher resource usage when processing rules

Code Comparison

ACL4SSR:

# 内容:Telegram
# 数量:14条
DOMAIN-SUFFIX,t.me
DOMAIN-SUFFIX,tdesktop.com
DOMAIN-SUFFIX,telegra.ph
DOMAIN-SUFFIX,telegram.me
DOMAIN-SUFFIX,telegram.org

clash-rules:

# Telegram
DOMAIN-SUFFIX,comments.app
DOMAIN-SUFFIX,contest.com
DOMAIN-SUFFIX,graph.org
DOMAIN-SUFFIX,quiz.directory
DOMAIN-SUFFIX,t.me

Both repositories provide rule sets for popular networking tools and services. ACL4SSR offers more extensive and detailed rules, while clash-rules focuses on a more streamlined approach. The code comparison shows that ACL4SSR includes additional domain suffixes for Telegram, potentially providing more comprehensive coverage. However, clash-rules' concise format may be easier to manage for some users.

搜集、整理、维护 Surge / Quantumult (X) / Shadowrocket / Surfboard / clash (Premium) 实用规则。

Pros of SS-Rule-Snippet

  • More comprehensive rule sets, including specific rules for various streaming services and social media platforms
  • Includes additional configuration files for different proxy tools (e.g., Surge, Quantumult)
  • Provides more detailed documentation and usage instructions in multiple languages

Cons of SS-Rule-Snippet

  • Less frequent updates compared to clash-rules
  • Larger file sizes due to more extensive rule sets, which may impact performance on some devices
  • Some rule sets may be overly specific, potentially leading to false positives or negatives

Code Comparison

SS-Rule-Snippet:

DOMAIN-SUFFIX,googleapis.cn,🍎 Only
DOMAIN-SUFFIX,mzstatic.com,🍎 Only
DOMAIN-SUFFIX,itunes.apple.com,🍎 Only
DOMAIN-SUFFIX,icloud.com,🍎 Only
DOMAIN-SUFFIX,icloud-content.com,🍎 Only

clash-rules:

DOMAIN-SUFFIX,apple.com
DOMAIN-SUFFIX,icloud.com
DOMAIN-SUFFIX,itunes.com
DOMAIN-SUFFIX,me.com
DOMAIN-SUFFIX,mzstatic.com

Both repositories provide rule sets for popular proxy tools, but they differ in their approach to rule organization and specificity. SS-Rule-Snippet offers more detailed rules and configurations for various services, while clash-rules focuses on a more streamlined and frequently updated set of rules.

分流规则、重写写规则及脚本。

Pros of ios_rule_script

  • More comprehensive rule sets covering a wider range of applications and services
  • Includes scripts for iOS automation and customization beyond just network rules
  • Frequent updates and active community contributions

Cons of ios_rule_script

  • Larger file sizes and potentially higher resource usage due to extensive rule sets
  • May require more configuration and customization for optimal performance
  • Some rules might be overly specific or redundant for general use cases

Code Comparison

clash-rules:

payload:
  - DOMAIN-SUFFIX,google.com
  - DOMAIN-SUFFIX,googleapis.com
  - DOMAIN-SUFFIX,gstatic.com

ios_rule_script:

DOMAIN-SUFFIX,google.com
DOMAIN-SUFFIX,googleapis.com
DOMAIN-SUFFIX,gstatic.com
DOMAIN-SUFFIX,google-analytics.com
DOMAIN-SUFFIX,googletagmanager.com

Both repositories provide rule sets for network filtering and proxy configuration. clash-rules focuses primarily on Clash-compatible rules, offering a streamlined approach for users of Clash clients. ios_rule_script, on the other hand, provides a more extensive collection of rules and scripts, catering to a broader range of use cases and platforms, particularly iOS devices.

While clash-rules may be more straightforward to implement for Clash users, ios_rule_script offers greater flexibility and customization options. However, this increased versatility comes at the cost of potentially higher complexity and resource requirements.

Users should choose between the two based on their specific needs, device ecosystem, and desired level of customization.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

简介

本项目生成适用于 Clash Premium 内核的规则集(RULE-SET),同时适用于所有使用 Clash Premium 内核的 Clash 图形用户界面(GUI)客户端。使用 GitHub Actions 北京时间每天早上 6:30 自动构建,保证规则最新。

说明

本项目规则集(RULE-SET)的数据主要来源于项目 @Loyalsoldier/v2ray-rules-dat 和 @v2fly/domain-list-community;Apple 和 Google 列表里的域名来源于项目 @felixonmars/dnsmasq-china-list;中国大陆 IPv4 地址数据使用 @17mon/china_ip_list。

本项目的规则集(RULE-SET)只适用于 Clash Premium 版本。Clash Premium 相对于普通版,增加了 TUN 增强模式,能接管设备所有 TCP 和 UDP 流量。

Clash Premium 各版本下载地址

⚠️ 由于 Clash 及其部分周边生态项目于 2023 年 11 月上旬删库跑路,现提供部分官方原版安装包、可执行文件,详情见 hidden 分支。

  • Clash Premium 命令行版:
    • 官方版(适用于 Windows、macOS、Linux、OpenWRT 等多种平台)
    • 衍生版 Clash.Meta(适用于 Windows、macOS、Linux、OpenWRT 等多种平台)
  • Clash Premium **图形用户界面**版:

规则文件地址及使用方式

在线地址(URL)

如果无法访问域名 raw.githubusercontent.com,可以使用第二个地址(cdn.jsdelivr.net),但是内容更新会有 12 小时的延迟。以下地址填写在 Clash 配置文件里的 rule-providers 里的 url 配置项中。

使用方式

要想使用本项目的规则集,只需要在 Clash 配置文件中添加如下 rule-providers 和 rules。

Rule Providers 配置方式

rule-providers:
  reject:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt"
    path: ./ruleset/reject.yaml
    interval: 86400

  icloud:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt"
    path: ./ruleset/icloud.yaml
    interval: 86400

  apple:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt"
    path: ./ruleset/apple.yaml
    interval: 86400

  google:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt"
    path: ./ruleset/google.yaml
    interval: 86400

  proxy:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt"
    path: ./ruleset/proxy.yaml
    interval: 86400

  direct:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt"
    path: ./ruleset/direct.yaml
    interval: 86400

  private:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt"
    path: ./ruleset/private.yaml
    interval: 86400

  gfw:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt"
    path: ./ruleset/gfw.yaml
    interval: 86400

  tld-not-cn:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt"
    path: ./ruleset/tld-not-cn.yaml
    interval: 86400

  telegramcidr:
    type: http
    behavior: ipcidr
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt"
    path: ./ruleset/telegramcidr.yaml
    interval: 86400

  cncidr:
    type: http
    behavior: ipcidr
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt"
    path: ./ruleset/cncidr.yaml
    interval: 86400

  lancidr:
    type: http
    behavior: ipcidr
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt"
    path: ./ruleset/lancidr.yaml
    interval: 86400

  applications:
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/applications.txt"
    path: ./ruleset/applications.yaml
    interval: 86400

白名单模式 Rules 配置方式(推荐)

  • 白名单模式,意为「没有命中规则的网络流量,统统使用代理」,适用于服务器线路网络质量稳定、快速,不缺服务器流量的用户。
  • 以下配置中,除了 DIRECT 和 REJECT 是默认存在于 Clash 中的 policy(路由策略/流量处理策略),其余均为自定义 policy,对应配置文件中 proxies 或 proxy-groups 中的 name。如你直接使用下面的 rules 规则,则需要在 proxies 或 proxy-groups 中手动配置一个 name 为 PROXY 的 policy。
  • 如你希望 Apple、iCloud 和 Google 列表中的域名使用代理,则把 policy 由 DIRECT 改为 PROXY,以此类推,举一反三。
  • 如你不希望进行 DNS 解析,可在 GEOIP 规则的最后加上 ,no-resolve,如 GEOIP,CN,DIRECT,no-resolve。
rules:
  - RULE-SET,applications,DIRECT
  - DOMAIN,clash.razord.top,DIRECT
  - DOMAIN,yacd.haishan.me,DIRECT
  - RULE-SET,private,DIRECT
  - RULE-SET,reject,REJECT
  - RULE-SET,icloud,DIRECT
  - RULE-SET,apple,DIRECT
  - RULE-SET,google,PROXY
  - RULE-SET,proxy,PROXY
  - RULE-SET,direct,DIRECT
  - RULE-SET,lancidr,DIRECT
  - RULE-SET,cncidr,DIRECT
  - RULE-SET,telegramcidr,PROXY
  - GEOIP,LAN,DIRECT
  - GEOIP,CN,DIRECT
  - MATCH,PROXY

黑名单模式 Rules 配置方式

  • 黑名单模式,意为「只有命中规则的网络流量,才使用代理」,适用于服务器线路网络质量不稳定或不够快,或服务器流量紧缺的用户。通常也是软路由用户、家庭网关用户的常用模式。
  • 以下配置中,除了 DIRECT 和 REJECT 是默认存在于 Clash 中的 policy(路由策略/流量处理策略),其余均为自定义 policy,对应配置文件中 proxies 或 proxy-groups 中的 name。如你直接使用下面的 rules 规则,则需要在 proxies 或 proxy-groups 中手动配置一个 name 为 PROXY 的 policy。
rules:
  - RULE-SET,applications,DIRECT
  - DOMAIN,clash.razord.top,DIRECT
  - DOMAIN,yacd.haishan.me,DIRECT
  - RULE-SET,private,DIRECT
  - RULE-SET,reject,REJECT
  - RULE-SET,tld-not-cn,PROXY
  - RULE-SET,gfw,PROXY
  - RULE-SET,telegramcidr,PROXY
  - MATCH,DIRECT

致谢

项目 Star 数增长趋势

Stargazers over time