clash-verge-rev 完全配置

最近 clash-verge-rev 升级到了 v2.0,借此机会进行一次完整的配置。

1.情况说明

我一直是装了 v2raya 和 clash-verge-rev 这两个代理工具的,因为平时经常使用 BT 下载,而 v2raya 官方文档提供了 BT 下载直连的配置示例(qbittorrent 单独使用一个直连端口),但是 clash-verge-rev 官方文档并没有细说,所以之前一直在用 v2raya。

以这次更新为契机,我踏上了探索 clash-verge-rev 配置的道路。

2.clash-verge-rev 配置文件加载流程

  1. 选择并加载一个订阅文件(sub.yaml)
  2. 加载全局扩展配置文件(Merge.yaml)
  3. 加载全局扩展脚本文件(Script.js)
  4. 加载订阅专有的扩展配置文件(rules.yaml、proxies.yaml、proxy-groups.yaml、extend_config.yaml)
  5. 加载订阅专有的扩展脚本文件(script_config.js)

我只使用扩展配置,所以忽略 3 和 5 两个步骤,如下图:

3.我的选择

分流规则使用Loyalsoldier/clash-rules,白名单模式(大部分时间都在使用白嫖的订阅,不缺流量),删除机场提供的所有规则

之前困扰我的 BT 下载直连问题也由 RULE-SET,applications,DIRECT 这条规则通过匹配进程名(qbittorrent)得到了解决🥰

我的相关配置也全部贴在下面:

  • 全局扩展配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Profile Enhancement Merge Template for Clash Verge
profile:
store-selected: true

# Custom DIRECT rules below
rules:
- 'DOMAIN,api.eehk.net,DIRECT'
- 'DOMAIN,proc.xn--l9qyaz082a.cn,DIRECT'
- 'DOMAIN,api.chatanywhere.tech,DIRECT'
- 'DOMAIN-REGEX,^dl-[A-Za-z0-9-]+\.mypikpak\.com$,DIRECT'
- 'RULE-SET,applications,DIRECT'
- 'RULE-SET,private,DIRECT'
- 'RULE-SET,reject,REJECT'
- 'RULE-SET,icloud,DIRECT'
- 'RULE-SET,apple,DIRECT'
- 'RULE-SET,direct,DIRECT'
- 'RULE-SET,lancidr,DIRECT'
- 'RULE-SET,cncidr,DIRECT'
- 'GEOIP,LAN,DIRECT'
- 'GEOIP,CN,DIRECT'

# From https://github.com/Loyalsoldier/clash-rules
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

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

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

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

telegramcidr:
type: http
behavior: ipcidr
url: "https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/telegramcidr.txt"
path: ./ruleset/telegramcidr.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

applications:
type: http
behavior: classical
url: "https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/applications.txt"
path: ./ruleset/applications.yaml
interval: 86400
  • 订阅专有规则配置

机场提供的订阅中的 proxy groups 不尽相同,所以添加在订阅专有配置而不是全局扩展配置,而 DIRECT 和 REJECT 已经存在于 clash 的 policy(路由策略/流量处理策略)中,与订阅无关,所以加在上面的全局扩展配置中

1
2
3
4
5
6
7
8
prepend: []
append:
- 'RULE-SET,google,[订阅提供的代理组]'
- 'RULE-SET,proxy,[订阅提供的代理组]'
- 'RULE-SET,telegramcidr,[订阅提供的代理组]'
- 'MATCH,[订阅提供的代理组]'
delete:
# all rules provided by subscription

clash-verge-rev 完全配置
https://lilinzta.github.io/2024/11/26/clash-verge-rev-完全配置/
作者
Haotian Li
发布于
2024年11月26日
许可协议