Compare commits
11 Commits
2020073105
...
2020100522
Author | SHA1 | Date | |
---|---|---|---|
92d01ffcba | |||
9607b36305 | |||
7ee290b55f | |||
636c38ac37 | |||
6f1a37e9c8 | |||
a94175521f | |||
6e6e1c5594 | |||
7c58f18503 | |||
7f9927dc93 | |||
f5068de75f | |||
4bb65003e6 |
15
.github/dependabot.yml
vendored
Normal file
15
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
timezone: "Asia/Shanghai"
|
||||
time: "07:00"
|
||||
pull-request-branch-name:
|
||||
separator: "-"
|
98
.github/workflows/build.yml
vendored
Normal file
98
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
name: Generate RULE-SET for Premium Edition of Clash
|
||||
on:
|
||||
schedule:
|
||||
- cron: "30 22 * * *"
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- "**/README.md"
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set variables
|
||||
run: |
|
||||
echo "::set-env name=RELEASE_NAME::Released on $(date +%Y%m%d%H%M)"
|
||||
echo "::set-env name=TAG_NAME::$(date +%Y%m%d%H%M)"
|
||||
echo "::set-env name=v2fly_icloud::https://raw.githubusercontent.com/v2fly/domain-list-community/release/icloud.txt"
|
||||
echo "::set-env name=v2fly_apple::https://raw.githubusercontent.com/v2fly/domain-list-community/release/apple.txt"
|
||||
echo "::set-env name=Loyalsoldier_reject::https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/reject-list.txt"
|
||||
echo "::set-env name=Loyalsoldier_proxy::https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/proxy-list.txt"
|
||||
echo "::set-env name=Loyalsoldier_direct::https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/direct-list.txt"
|
||||
echo "::set-env name=felixonmars_apple::https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf"
|
||||
echo "::set-env name=felixonmars_google::https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf"
|
||||
echo "::set-env name=ipipnet_chinaiplist::https://raw.githubusercontent.com/17mon/china_ip_list/master/china_ip_list.txt"
|
||||
shell: bash
|
||||
|
||||
- name: Checkout the "hidden" branch
|
||||
uses: actions/checkout@v2.3.3
|
||||
with:
|
||||
ref: hidden
|
||||
|
||||
- name: Generate icloud.txt file
|
||||
run: |
|
||||
echo "payload:" > icloud.txt
|
||||
curl -sSL ${v2fly_icloud} | grep -E "^(full|domain):" | awk -F ':' '{printf " - |+.%s|\n", $2}' | sed "s/|/'/g" >> icloud.txt
|
||||
|
||||
- name: Generate google.txt file
|
||||
run: |
|
||||
echo "payload:" > google.txt
|
||||
curl -sSL ${felixonmars_google} | perl -ne '/^server=\/([^\/]+)\// && print " - |+.$1|\n"' | sed "s/|/'/g" >> google.txt
|
||||
|
||||
- name: Generate apple.txt file
|
||||
run: |
|
||||
curl -sSL ${felixonmars_apple} | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > apple.temp
|
||||
curl -sSL ${v2fly_apple} | grep -E "^(full|domain):" | awk -F ':' '{print $2}' >> apple.temp
|
||||
echo "payload:" > apple.txt
|
||||
cat apple.temp | perl -ne '/^([-_a-zA-Z0-9]+(\.[-_a-zA-Z0-9]+)*)/ && print " - |+.$1|\n"' | sed "s/|/'/g" >> apple.txt
|
||||
|
||||
- name: Generate direct.txt file
|
||||
run: |
|
||||
echo "payload:" > direct.txt
|
||||
curl -sSL ${Loyalsoldier_direct} | grep -Ev "^(regex|keyword):" | perl -ne '/^([-_a-zA-Z0-9]+(\.[-_a-zA-Z0-9]+)*)/ && print " - |+.$1|\n"' | sed "s/|/'/g" >> direct.txt
|
||||
|
||||
- name: Generate proxy.txt file
|
||||
run: |
|
||||
echo "payload:" > proxy.txt
|
||||
curl -sSL ${Loyalsoldier_proxy} | grep -Ev "^(regex|keyword):" | perl -ne '/^([-_a-zA-Z0-9]+(\.[-_a-zA-Z0-9]+)*)/ && print " - |+.$1|\n"' | sed "s/|/'/g" >> proxy.txt
|
||||
|
||||
- name: Generate reject.txt file
|
||||
run: |
|
||||
echo "payload:" > reject.txt
|
||||
curl -sSL ${Loyalsoldier_reject} | grep -Ev "^(regex|keyword):" | perl -ne '/^([-_a-zA-Z0-9]+(\.[-_a-zA-Z0-9]+)*)/ && print " - |+.$1|\n"' | sed "s/|/'/g" >> reject.txt
|
||||
|
||||
- name: Generate cncidr.txt file
|
||||
run: |
|
||||
echo "payload:" > cncidr.txt
|
||||
curl -sSL ${ipipnet_chinaiplist} | perl -ne '/^(\d{1,3}(\.\d{1,3}){3}\/\d{1,2})/ && print " - |$1|\n"' | sed "s/|/'/g" >> cncidr.txt
|
||||
|
||||
- name: Move files to publish directory
|
||||
run: |
|
||||
mkdir -p publish
|
||||
install -p {apple,icloud,google,proxy,direct,reject,cncidr,lancidr}.txt ./publish/
|
||||
|
||||
- name: Release and upload assets
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: ${{ env.RELEASE_NAME }}
|
||||
tag_name: ${{ env.TAG_NAME }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
files: |
|
||||
./publish/*
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Git push assets to "release" branch
|
||||
run: |
|
||||
cd publish
|
||||
git init
|
||||
git config --local user.name "actions"
|
||||
git config --local user.email "action@github.com"
|
||||
git checkout -b release
|
||||
git add .
|
||||
git commit -m "${{ env.RELEASE_NAME }}"
|
||||
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
|
||||
git push -f -u origin release
|
158
README.md
158
README.md
@ -1 +1,157 @@
|
||||
# clash-rules
|
||||
# 简介
|
||||
|
||||
本项目生成适用于 [**Clash Premium**](https://github.com/Dreamacro/clash/releases/tag/premium) 的规则集(RULE-SET)。使用 GitHub Actions 北京时间每天早上 6:30 自动构建,保证规则最新。
|
||||
|
||||
## 说明
|
||||
|
||||
本项目的规则集(RULE-SET)主要来源于项目 [@Loyalsoldier/v2ray-rules-dat](https://github.com/Loyalsoldier/v2ray-rules-dat) 和 [@v2fly/domain-list-community](https://github.com/v2fly/domain-list-community);[`Apple`](https://github.com/Loyalsoldier/clash-rules/blob/release/apple.txt) 和 [`Google`](https://github.com/Loyalsoldier/clash-rules/blob/release/google.txt) 列表里的部分域名来源于项目 [@felixonmars/dnsmasq-china-list](https://github.com/felixonmars/dnsmasq-china-list);中国大陆 IPv4 地址数据使用 [@17mon/china_ip_list](https://github.com/17mon/china_ip_list)。
|
||||
|
||||
本项目的规则集(RULE-SET)只适用于 Clash **Premium** 版本。Clash Premium 相对于普通版,增加了 **TUN 增强模式**,能接管设备所有 TCP 和 UDP 流量,类似 [Surge for Mac](https://nssurge.com) 的增强模式。更多高级特性请看[官方 wiki](https://github.com/Dreamacro/clash/wiki/premium-core-features)。
|
||||
|
||||
### Clash 各版本下载地址
|
||||
|
||||
- Clash Premium **命令行**版(兼容 Windows、macOS、Linux、OpenWRT 等多种平台):[https://github.com/Dreamacro/clash/releases/tag/premium](https://github.com/Dreamacro/clash/releases/tag/premium)
|
||||
- Clash Premium **图形用户界面**版(ClashX Pro,兼容 macOS):[https://install.appcenter.ms/users/clashx/apps/clashx-pro/distribution_groups/public](https://install.appcenter.ms/users/clashx/apps/clashx-pro/distribution_groups/public)
|
||||
- Clash Premium **图形用户界面**版(Clash for Windows,兼容 Windows、macOS):[https://github.com/Fndroid/clash_for_windows_pkg/releases](https://github.com/Fndroid/clash_for_windows_pkg/releases)
|
||||
|
||||
## 规则文件地址及使用方式
|
||||
|
||||
### 在线地址(URL)
|
||||
|
||||
> 如果无法访问域名 `raw.githubusercontent.com`,可以使用第二个地址(`cdn.jsdelivr.net`),但是内容更新会有 12 小时的延迟。以下地址填写在 Clash 配置文件里的 `rule-providers` 里的 `url` 配置项中。
|
||||
|
||||
- **直连域名列表 direct.txt**:
|
||||
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/direct.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/direct.txt)
|
||||
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt)
|
||||
- **代理域名列表 proxy.txt**:
|
||||
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/proxy.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/proxy.txt)
|
||||
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt)
|
||||
- **广告域名列表 reject.txt**:
|
||||
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/reject.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/reject.txt)
|
||||
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt)
|
||||
- **Apple 域名列表 apple.txt**:
|
||||
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/apple.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/apple.txt)
|
||||
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt)
|
||||
- **iCloud 域名列表 icloud.txt**:
|
||||
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/icloud.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/icloud.txt)
|
||||
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt)
|
||||
- **Google 域名列表 google.txt**:
|
||||
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/google.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/google.txt)
|
||||
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt)
|
||||
- **局域网 IP 及保留 IP 地址列表 lancidr.txt**:
|
||||
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/lancidr.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/lancidr.txt)
|
||||
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt)
|
||||
- **中国大陆 IPv4 地址列表 cncidr.txt**:
|
||||
- [https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/cncidr.txt](https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/cncidr.txt)
|
||||
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt)
|
||||
|
||||
### 使用方式
|
||||
|
||||
关于 Clash Premium 使用方式,请查看[官方文档](https://github.com/Dreamacro/clash/wiki/premium-core-features) 或 [Lancellc's GitBook](https://lancellc.gitbook.io/clash/)。
|
||||
|
||||
要想使用本项目的规则集,只需要在 Clash 配置文件中添加如下 `rule-providers` 和 `rules`。
|
||||
|
||||
#### Rule Providers 配置方式
|
||||
|
||||
```yaml
|
||||
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
|
||||
|
||||
apple:
|
||||
type: http
|
||||
behavior: domain
|
||||
url: "https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/apple.txt"
|
||||
path: ./ruleset/apple.yaml
|
||||
interval: 86400
|
||||
|
||||
google:
|
||||
type: http
|
||||
behavior: domain
|
||||
url: "https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/google.txt"
|
||||
path: ./ruleset/google.yaml
|
||||
interval: 86400
|
||||
|
||||
proxy:
|
||||
type: http
|
||||
behavior: domain
|
||||
url: "https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/proxy.txt"
|
||||
path: ./ruleset/proxy.yaml
|
||||
interval: 86400
|
||||
|
||||
direct:
|
||||
type: http
|
||||
behavior: domain
|
||||
url: "https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/direct.txt"
|
||||
path: ./ruleset/direct.yaml
|
||||
interval: 86400
|
||||
|
||||
cncidr:
|
||||
type: http
|
||||
behavior: ipcidr
|
||||
url: "https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/cncidr.txt"
|
||||
path: ./ruleset/cncidr.yaml
|
||||
interval: 86400
|
||||
|
||||
lancidr:
|
||||
type: http
|
||||
behavior: ipcidr
|
||||
url: "https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/lancidr.txt"
|
||||
path: ./ruleset/lancidr.yaml
|
||||
interval: 86400
|
||||
```
|
||||
|
||||
#### Rules 配置方式
|
||||
|
||||
- 以下配置中的 `PROCESS-NAME` 规则类型**只能**在 **ClashX Pro** 中使用,其余版本均不能使用,需要手动删除。
|
||||
- 如果希望使用 DNS 来解析未命中域名类型规则的域名,而不是直接走代理,请删除 `cncidr` 行尾的 `,no-resolve`。
|
||||
- 以下配置中,除了 `DIRECT` 和 `REJECT` 是默认存在于 Clash 中的 policy(路由策略/流量处理策略),其余均为自定义 policy,对应配置文件中 `proxies` 或 `proxy-groups` 中的 `name`。如你直接使用下面的 `rules` 规则,则需要在 `proxies` 或 `proxy-groups` 中手动配置一个 `name` 为 `PROXY` 的 policy。
|
||||
- 如你希望 Apple、iCloud 和 Google 列表中的域名使用代理,则把 policy 由 `DIRECT` 改为 `PROXY`,以此类推,举一反三。
|
||||
|
||||
```yaml
|
||||
rules:
|
||||
- PROCESS-NAME,v2ray,DIRECT
|
||||
- PROCESS-NAME,Surge%203,DIRECT
|
||||
- PROCESS-NAME,ss-local,DIRECT
|
||||
- PROCESS-NAME,privoxy,DIRECT
|
||||
- PROCESS-NAME,trojan,DIRECT
|
||||
- PROCESS-NAME,trojan-go,DIRECT
|
||||
- PROCESS-NAME,naive,DIRECT
|
||||
- PROCESS-NAME,Thunder,DIRECT
|
||||
- PROCESS-NAME,DownloadService,DIRECT
|
||||
- PROCESS-NAME,qBittorrent,DIRECT
|
||||
- PROCESS-NAME,Transmission,DIRECT
|
||||
- PROCESS-NAME,fdm,DIRECT
|
||||
- PROCESS-NAME,aria2c,DIRECT
|
||||
- PROCESS-NAME,Folx,DIRECT
|
||||
- PROCESS-NAME,NetTransport,DIRECT
|
||||
- PROCESS-NAME,uTorrent,DIRECT
|
||||
- PROCESS-NAME,WebTorrent,DIRECT
|
||||
- RULE-SET,reject,REJECT
|
||||
- RULE-SET,icloud,DIRECT
|
||||
- RULE-SET,apple,DIRECT
|
||||
- RULE-SET,google,DIRECT
|
||||
- RULE-SET,proxy,PROXY
|
||||
- RULE-SET,direct,DIRECT
|
||||
- RULE-SET,lancidr,DIRECT,no-resolve
|
||||
- RULE-SET,cncidr,DIRECT,no-resolve
|
||||
- MATCH,PROXY
|
||||
```
|
||||
|
||||
## 致谢
|
||||
|
||||
- [@Loyalsoldier/v2ray-rules-dat](https://github.com/Loyalsoldier/v2ray-rules-dat)
|
||||
- [@v2fly/domain-list-community](https://github.com/v2fly/domain-list-community)
|
||||
- [@felixonmars/dnsmasq-china-list](https://github.com/felixonmars/dnsmasq-china-list)
|
||||
- [@17mon/china_ip_list](https://github.com/17mon/china_ip_list)
|
||||
|
Reference in New Issue
Block a user