订阅链接无法配合自己配置过的规则使用,即使配置了,当订阅更新后依然会出现自己配置的规则无法使用。可通过proxy-providers解决。

proxy-providers的格式为

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
proxy-providers:
jichang1: # provider的名称,后期会用到
type: http
path: ./profiles/1626513136686.yml # 保存在本地文件的名字,可以随便取
url: https://XXXX # 机场给你的订阅链接
interval: 36000 # 每36000秒更新一次订阅
health-check:
enable: true # 是否自动进行latency-test
url: http://www.gstatic.com/generate_204
interval: 3600

jichang2: # 我们可以同时使用多个订阅链接获取多个proxies
type: http
path: ./profiles/1626513136686.yml # 保存在本地文件的名字,可以随便取
url: https://XXXX # 机场给你的订阅链接
interval: 36000 # 每36000秒更新一次订阅
health-check:
enable: true # 是否自动进行latency-test
url: http://www.gstatic.com/generate_204
interval: 3600

这样我们就可以在后面使用

1
2
3
4
5
6
proxy-groups:
- name: Proxies
type: select
use: # 注意,这里是use而不是普通的proxies
- jichang1 # 这里就是上面proxy-providers中定义的名称
- jichang2

经过上面两个步骤之后,我们就可以在自己定义的配置文件中使用机场提供的节点了,规则完全由我们自己来制定。每次更新只会获取到节点信息,不会覆盖我们本地写的规则。

类似的,也有rule-providers的功能。从指定url处获取别人提供的规则,而不用自己来制定。

使用方法
在clash的配置文件夹中创建一个新的文件,并把下面的内容复制进去。
替换proxy-providers中的url为自己的订阅链接。
在clash中选择使用这个配置文件。

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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
mixed-port: 7890



# Linux 和 macOS 的 redir 代理端口
redir-port: 7892

# 允许局域网的连接
allow-lan: true

# 规则模式:Rule(规则) / Global(全局代理)/ Direct(全局直连)
mode: rule

# 设置日志输出级别 (默认级别:silent,即不输出任何内容,以避免因日志内容过大而导致程序内存溢出)。
# 5 个级别:silent / info / warning / error / debug。级别越高日志输出量越大,越倾向于调试,若需要请自行开启。
log-level: info
# Clash 的 RESTful API
external-controller: '0.0.0.0:9090'

# RESTful API 的口令
secret: ''

dns:
enable: true
ipv6: true
listen: '0.0.0.0:53'
use-hosts: true
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
nameserver:
- 202.120.224.6
- 114.114.114.114
- 223.5.5.5
- 'tcp://223.5.5.5'
fallback:
- 'tls://223.5.5.5:853'
- 'https://223.5.5.5/dns-query'
fallback-filter:
geoip: true
ipcidr:
- 240.0.0.0/4
# proxy provider start here
proxy-providers:
jichang1:
type: http
path: ./profiles/1626513136686.yml
url: https://XXXX
interval: 36000
health-check:
enable: true
url: http://www.gstatic.com/generate_204
interval: 3600
jichang2:
type: http
path: ./profiles/1626513102225.yml
url: https://XXX
interval: 36000
health-check:
enable: true
url: http://www.gstatic.com/generate_204
interval: 3600

jichang3:
type: http
path: ./profiles/1642516276761.yml
url: https://XXXX
interval: 36000
health-check:
enable: true
url: http://www.gstatic.com/generate_204
interval: 3600


# proxy provider end
proxies:
# socks5
- name: windowsServer
type: socks5
server: 10.127.78.177
port: 7890
# username: username
# password: password
# tls: true
# skip-cert-verify: true
# udp: true

- {name: 🇮🇪 中国-爱尔兰 IPLC C04, server: ir04.cathayroute.com, port: 33400, type: ss, cipher: rc4-md5, password: SRCFiB}
- {name: 🇭🇰 香港 油尖旺御金·国峯 名氣通電訊 C02, server: hkhe02.cathayroute.com, port: 33400, type: ss, cipher: rc4-md5, password: SRCFiB}
- {name: 🇮🇪 中国-爱尔兰 IPLC C03, server: ir03.cathayroute.com, port: 33400, type: ss, cipher: rc4-md5, password: SRCFiB}
- {name: 🇭🇰 香港 油尖旺御金·国峯 名氣通電訊 C09, server: hkhe09.cathayroute.com, port: 33400, type: ss, cipher: rc4-md5, password: SRCFiB}
- {name: 🇨🇳 中国-香港 IEPL Equinix HK8 C 02 1Gbps HBO TVB, server: sg12.cathayroute.com, port: 33400, type: ss, cipher: rc4-md5, password: SRCFiB, udp: true}
- {name: 🇨🇳 中国-爱尔兰 IPLC C05, server: ir05.cathayroute.com, port: 33400, type: ss, cipher: rc4-md5, password: SRCFiB, udp: true}
- {name: 🇨🇳 中国-香港 IPLC Equinix HK2 C 06 1Gbps HBO TVB, server: sg06.cathayroute.com, port: 33400, type: ss, cipher: rc4-md5, password: SRCFiB, udp: true}

proxy-groups:
- name: Proxies
type: select
proxies:
- 故障转移
- 自动选择
- 机场节点
- 手动节点

- name: 手动节点
type: select
proxies:
- 🇮🇪 中国-爱尔兰 IPLC C04
- 🇭🇰 香港 油尖旺御金·国峯 名氣通電訊 C02
- 🇮🇪 中国-爱尔兰 IPLC C03
- 🇭🇰 香港 油尖旺御金·国峯 名氣通電訊 C09
- 🇨🇳 中国-香港 IEPL Equinix HK8 C 02 1Gbps HBO TVB
- 🇨🇳 中国-爱尔兰 IPLC C05
- 🇨🇳 中国-香港 IPLC Equinix HK2 C 06 1Gbps HBO TVB

- name: 机场节点
type: select
proxies:
- 机场1
- 第二个机场
- 另一个机场



- name: 机场1
type: select
use:
- jichang1

- name: 第二个机场
type: select
use:
- jichang2


- name: 另一个机场
type: select
use:
- jichang3

- name: 故障转移
type: fallback
url: 'http://www.gstatic.com/generate_204'
interval: 7200
proxies:
- 机场1
- 第二个机场
- 另一个机场


- name: 自动选择
type: url-test
url: 'http://www.gstatic.com/generate_204'
interval: 300
use:
- jichang1
- jichang2
- jichang3



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

greatfire:
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/greatfire.txt"
path: ./ruleset/greatfire.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:
# 这些是自定义规则,想要的可以继续加。
- DOMAIN-SUFFIX,cnki.net,DIRECT
- DOMAIN-SUFFIX,ieee.org,DIRECT
- DOMAIN-SUFFIX,acm.org,DIRECT
- DOMAIN-SUFFIX,imgtu.com,DIRECT
- DOMAIN-SUFFIX,dpdk.org,DIRECT
- DOMAIN-SUFFIX,freenom.com,DIRECT
- DOMAIN-SUFFIX,sciencedirect.com,DIRECT
- DOMAIN-SUFFIX,springer.com,DIRECT
- RULE-SET,applications,DIRECT
- DOMAIN,clash.razord.top,DIRECT
- DOMAIN,yacd.haishan.me,DIRECT
# 下面的规则是通过上面的rule-provider来确定的
- RULE-SET,private,DIRECT
- RULE-SET,reject,REJECT
- RULE-SET,icloud,DIRECT
- RULE-SET,apple,DIRECT
- RULE-SET,google,DIRECT
- RULE-SET,proxy,Proxies
- RULE-SET,direct,DIRECT
- RULE-SET,lancidr,DIRECT
- RULE-SET,cncidr,DIRECT
- RULE-SET,telegramcidr,Proxies
- GEOIP,,DIRECT
- GEOIP,CN,DIRECT
- MATCH,Proxies