refactor(clash): 按流量特征重构分流配置

代理组重构:
- 流媒体: YouTube/Netflix/Disney+/Spotify/Twitch...
- 大文件下载: GitHub/Docker/npm/PyPI/HuggingFace/Steam (不含byWave)
- 社交通讯: Discord/Twitter/Reddit/Telegram/Facebook...
- 日系站点: DLsite/Pixiv/DMM/Niconico/Booth/Fantia...
- Exhentai: 独立组 (避开日本节点)
- PT站点: 网页+Tracker走代理, BT下载走直连
- Apple/Google/Microsoft: 独立平台组
- AI/Tailscale: 固定组

新增规则集: streaming, social, jp-content, tailscale
修复: rule-provider path冲突, Gemini规则重复
优化: applications规则移到pt-custom之后确保PT tracker走代理
This commit is contained in:
2026-04-29 11:13:26 +08:00
parent a3ef42d92c
commit 4c6b64b1c4
6 changed files with 370 additions and 182 deletions
+226 -177
View File
@@ -10,14 +10,13 @@ geox-url:
geosite: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat"
mmdb: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.metadb"
geo-auto-update: true # 是否自动更新 geodata
geo-update-interval: 24 # 更新间隔,单位:小时
geo-auto-update: true
geo-update-interval: 24
dns:
enable: true
listen: 0.0.0.0:53
ipv6: false
default-nameserver:
- 223.5.5.5
- 1.0.0.1
@@ -48,7 +47,6 @@ sniffer:
ports: [ 443, 8443 ]
QUIC:
ports: [ 443, 8443 ]
# force-domain:
skip-domain:
- Mijia Cloud
@@ -63,6 +61,9 @@ sniffer:
alt7-mtalk.google.com 142.250.112.188
alt8-mtalk.google.com 172.217.197.188
# ══════════════════════════════════════════════════════════
# 节点订阅源
# ══════════════════════════════════════════════════════════
proxy-providers:
self-proxies:
type: http
@@ -96,105 +97,126 @@ proxy-providers:
lazy: true
url: http://www.gstatic.com/generate_204
# ══════════════════════════════════════════════════════════
# 代理组 — 按流量特征分类
# ══════════════════════════════════════════════════════════
proxy-groups:
# ── 节点池 ──
- name: "自动选择"
type: url-test
use: [self-proxies, byWave, liangyuandian]
url: http://www.gstatic.com/generate_204
interval: 300
tolerance: 50
- name: "PROXY"
type: select
use:
- self-proxies
- byWave
- liangyuandian
- name: "大流量"
type: select
use:
- self-proxies
- liangyuandian
- name: "Telegram"
type: select
use:
- self-proxies
- byWave
- liangyuandian
proxies:
- 大流量
- PROXY
- name: "DLsite"
type: select
use:
- self-proxies
- byWave
- liangyuandian
proxies:
- 大流量
- PROXY
- name: "Exhentai"
type: select
use:
- self-proxies
- byWave
- liangyuandian
proxies:
- 大流量
- PROXY
- name: "PT"
type: select
use:
- self-proxies
- byWave
- liangyuandian
proxies:
- 大流量
- DIRECT
- PROXY
- name: "Microsoft"
type: select
use:
- self-proxies
- byWave
proxies:
- DIRECT
- PROXY
- name: "YouTube"
type: select
use:
- self-proxies
- byWave
- liangyuandian
proxies:
- 大流量
- PROXY
- name: "Google"
type: select
use:
- self-proxies
- byWave
proxies:
- PROXY
- 大流量
- name: "Steam"
type: select
use:
- self-proxies
- byWave
- liangyuandian
proxies:
- 大流量
- PROXY
- name: "Others"
type: select
use:
- self-proxies
proxies:
- DIRECT
- PROXY
- "自动选择"
use: [self-proxies, byWave, liangyuandian]
# ── 固定组 ──
- name: "AI"
type: select
use:
- self-proxies
- byWave
proxies:
- PROXY
use: [self-proxies, byWave]
# Tailscale 流量必须直连,否则打洞失败
- name: "Tailscale"
type: select
proxies:
- DIRECT
# ── 按流量特征分组 ──
# 流媒体: 视频/音频串流,高带宽持续连接 (YouTube, Netflix, Spotify, Twitch...)
- name: "流媒体"
type: select
proxies:
- PROXY
- "大文件下载"
use: [self-proxies, byWave, liangyuandian]
# 大文件下载: GitHub/Docker/npm/PyPI/HuggingFace/Steam/模型 等批量下载
# 不含 byWave (流量贵)
- name: "大文件下载"
type: select
proxies:
- PROXY
use: [self-proxies, liangyuandian]
# 社交通讯: Discord/Twitter/Reddit/Telegram/Facebook 等社交平台
- name: "社交通讯"
type: select
proxies:
- PROXY
use: [self-proxies, byWave, liangyuandian]
# 日系站点: DLsite/Pixiv/DMM/Niconico/Booth 等 (美国节点内容不全,建议选日本节点)
- name: "日系站点"
type: select
proxies:
- PROXY
use: [self-proxies, byWave, liangyuandian]
# Exhentai: 日本节点大量内容不可见,荷兰节点能看全部 (避开日本节点!)
- name: "Exhentai"
type: select
proxies:
- PROXY
use: [self-proxies, byWave, liangyuandian]
# PT站点: 网页浏览+Tracker握手走代理,BT文件下载走直连
# (applications规则在pt-custom之后,域名优先匹配代理,纯IP的peer连接走DIRECT)
- name: "PT站点"
type: select
proxies:
- PROXY
- DIRECT
use: [self-proxies]
# ── 平台组 ──
# Apple: iCloud/App Store/Apple Music 等,默认直连
- name: "Apple"
type: select
proxies:
- DIRECT
- PROXY
use: [self-proxies, byWave, liangyuandian]
# Google: Search/Maps/Gmail 等 (Drive/Photos 在大文件下载组)
- name: "Google"
type: select
proxies:
- PROXY
use: [self-proxies, byWave, liangyuandian]
# Microsoft: Office/Azure 等,默认直连
- name: "Microsoft"
type: select
proxies:
- DIRECT
- PROXY
use: [self-proxies, byWave]
# 漏网之鱼: 未匹配任何规则的流量
- name: "漏网之鱼"
type: select
proxies:
- PROXY
- DIRECT
use: [self-proxies]
# ══════════════════════════════════════════════════════════
# 规则集
# ══════════════════════════════════════════════════════════
rule-providers:
# ── 外部规则集 (Loyalsoldier) ──
reject:
type: http
behavior: domain
@@ -223,47 +245,7 @@ rule-providers:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt"
path: ./ruleset/google.yaml
interval: 86400
timeout: 50000
microsoft:
type: http
behavior: classical
url: "https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Microsoft/Microsoft.yaml"
path: ./ruleset/microsoft.yaml
interval: 86400
timeout: 50000
bing:
type: http
behavior: classical
url: "https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Bing/Bing.yaml"
path: ./ruleset/bing.yaml
interval: 86400
timeout: 50000
copilot:
type: http
behavior: classical
url: "https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Copilot/Copilot.yaml"
path: ./ruleset/copilot.yaml
interval: 86400
timeout: 50000
openai:
type: http
behavior: classical
url: "https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/OpenAI/OpenAI.yaml"
path: ./ruleset/openai.yaml
interval: 86400
timeout: 50000
youtube:
type: http
behavior: classical
url: "https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/YouTube/YouTube.yaml"
path: ./ruleset/youtube.yaml
path: ./ruleset/google-ls.yaml
interval: 86400
timeout: 50000
@@ -271,7 +253,7 @@ rule-providers:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt"
path: ./ruleset/proxy.yaml
path: ./ruleset/proxy-ls.yaml
interval: 86400
timeout: 50000
@@ -279,7 +261,7 @@ rule-providers:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt"
path: ./ruleset/direct.yaml
path: ./ruleset/direct-ls.yaml
interval: 86400
timeout: 50000
@@ -339,6 +321,40 @@ rule-providers:
interval: 86400
timeout: 50000
# ── 外部规则集 (blackmatrix7) ──
microsoft:
type: http
behavior: classical
url: "https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Microsoft/Microsoft.yaml"
path: ./ruleset/microsoft-bm7.yaml
interval: 86400
timeout: 50000
copilot:
type: http
behavior: classical
url: "https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Copilot/Copilot.yaml"
path: ./ruleset/copilot.yaml
interval: 86400
timeout: 50000
openai:
type: http
behavior: classical
url: "https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/OpenAI/OpenAI.yaml"
path: ./ruleset/openai.yaml
interval: 86400
timeout: 50000
youtube:
type: http
behavior: classical
url: "https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/YouTube/YouTube.yaml"
path: ./ruleset/youtube.yaml
interval: 86400
timeout: 50000
# ── 自托管规则集 (Gitea) ──
ai-services:
type: http
behavior: classical
@@ -363,12 +379,6 @@ rule-providers:
url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/exhentai.yaml
path: ./ruleset/exhentai.yaml
dlsite-custom:
type: http
behavior: classical
url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/dlsite.yaml
path: ./ruleset/dlsite.yaml
pt-custom:
type: http
behavior: classical
@@ -385,72 +395,111 @@ rule-providers:
type: http
behavior: classical
url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/microsoft.yaml
path: ./ruleset/microsoft.yaml
path: ./ruleset/microsoft-custom.yaml
google-custom:
type: http
behavior: classical
url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/google.yaml
path: ./ruleset/google.yaml
path: ./ruleset/google-custom.yaml
direct-custom:
type: http
behavior: classical
url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/direct.yaml
path: ./ruleset/direct.yaml
path: ./ruleset/direct-custom.yaml
proxy-custom:
type: http
behavior: classical
url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/proxy.yaml
path: ./ruleset/proxy.yaml
path: ./ruleset/proxy-custom.yaml
tailscale-custom:
type: http
behavior: classical
url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/tailscale.yaml
path: ./ruleset/tailscale.yaml
streaming-custom:
type: http
behavior: classical
url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/streaming.yaml
path: ./ruleset/streaming.yaml
social-custom:
type: http
behavior: classical
url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/social.yaml
path: ./ruleset/social.yaml
jp-content:
type: http
behavior: classical
url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/jp-content.yaml
path: ./ruleset/jp-content.yaml
# ══════════════════════════════════════════════════════════
# 分流规则 (按优先级从高到低)
# ══════════════════════════════════════════════════════════
rules:
# DIRECT
# - RULE-SET,direct,DIRECT
# ─── Tailscale 强制直连 (最高优先,防止打洞失败) ───
- RULE-SET,tailscale-custom,Tailscale
# ─── 广告拦截 ───
- RULE-SET,reject,REJECT
# ─── 直连 (局域网、国内) ───
- RULE-SET,private,DIRECT
- RULE-SET,lancidr,DIRECT
- RULE-SET,cncidr,DIRECT
- RULE-SET,applications,DIRECT
- RULE-SET,icloud,DIRECT
- RULE-SET,apple,DIRECT
- RULE-SET,direct,DIRECT
- RULE-SET,direct-custom,DIRECT
# Gemini: keep Google session IP consistent to reduce verification
- DOMAIN-SUFFIX,gemini.google.com,Google
- DOMAIN-SUFFIX,bard.google.com,Google
- DOMAIN,ai.google.dev,Google
- DOMAIN-SUFFIX,google.dev,Google
- DOMAIN-SUFFIX,makersuite.google.com,Google
- DOMAIN-SUFFIX,generativelanguage.googleapis.com,Google
- DOMAIN-SUFFIX,aistudio.google.com,Google
- DOMAIN-SUFFIX,notebooklm.google.com,Google
- DOMAIN,notebooklm.google,Google
# AI服务 (统一) - 最高优先级
# ─── AI 服务 ───
- RULE-SET,ai-services,AI
- RULE-SET,openai,AI
- RULE-SET,copilot,AI
# 高优先级
- RULE-SET,youtube,YouTube
- RULE-SET,dlsite-custom,DLsite
# ─── 流媒体 (视频/音频串流) ───
- RULE-SET,youtube,流媒体
- RULE-SET,streaming-custom,流媒体
# ─── 日系站点 (DLsite/Pixiv/DMM/Niconico,建议选日本节点) ───
- RULE-SET,jp-content,日系站点
# ─── Exhentai (避开日本节点,荷兰最佳) ───
- RULE-SET,exhentai-custom,Exhentai
# 大流量服务
- RULE-SET,high-traffic,大流量
- RULE-SET,huggingface,大流量
# ─── 大文件下载 (GitHub/Docker/npm/Steam/HuggingFace...) ───
- RULE-SET,high-traffic,大文件下载
- RULE-SET,huggingface,大文件下载
- RULE-SET,steam-custom,大文件下载
# 其他服务
- RULE-SET,pt-custom,PT
- RULE-SET,steam-custom,Steam
- RULE-SET,microsoft-custom,Microsoft
# ─── 社交通讯 (Discord/Twitter/Reddit/Telegram...) ───
- RULE-SET,social-custom,社交通讯
- RULE-SET,telegramcidr,社交通讯
# ─── PT站点 (网页+Tracker域名走代理) ───
- RULE-SET,pt-custom,PT站点
# ─── BT客户端进程直连 (放在PT之后!PT域名先匹配代理,剩余BT流量走直连) ───
- RULE-SET,applications,DIRECT
# ─── 平台服务 ───
- RULE-SET,icloud,Apple
- RULE-SET,apple,Apple
- RULE-SET,google,Google
- RULE-SET,google-custom,Google
- RULE-SET,microsoft-custom,Microsoft
- RULE-SET,microsoft,Microsoft
# ─── 通用代理 ───
- RULE-SET,proxy-custom,PROXY
- RULE-SET,telegramcidr,Telegram
- RULE-SET,tld-not-cn,PROXY
- RULE-SET,proxy,PROXY
- RULE-SET,reject,REJECT
- RULE-SET,gfw,PROXY
- MATCH,Others
# ─── 兜底 ───
- MATCH,漏网之鱼