用 Clash 的时候有个需求:不同业务要走不同国家的节点。
比如某些场景要走日本、某些要走美国,混在一起不好管理。
于是搞了一个按国家拆分的配置,每个国家分成 Select(手动选)、UrlTest(自动选最快)、LoadBalance(负载均衡)三种模式。
同时给每个国家开了独立的 listener 端口,这样不同程序指向不同端口就能走不同国家的线路了。
配置比较长,但结构是重复的,改改国家名和过滤关键词就行。
完整配置
# 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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
| port: 7890
allow-lan: true
mode: Rule
log-level: error
external-controller: :9090
tcp-concurrent: true
geodata-mode: true
geodata-loader: standard
sniffer:
enable: true
force-dns-mapping: true
parse-pure-ip: true
dns:
enabled: true
prefer-h3: false
ipv6: false
default-nameserver:
["https://223.6.6.6/dns-query", "https://120.53.53.53/dns-query"]
proxy-server-nameserver:
["https://223.6.6.6/dns-query", "https://120.53.53.53/dns-query"]
nameserver: ["https://cloudflare-dns.com/dns-query"]
listeners:
- name: 香港[Select]
type: mixed
port: 10001
listen: 0.0.0.0
proxy: 香港[Select]
- name: 香港[UrlTest]
type: mixed
port: 10002
listen: 0.0.0.0
proxy: 香港[UrlTest]
- name: 香港[LoadBalance]
type: mixed
port: 10003
listen: 0.0.0.0
proxy: 香港[LoadBalance]
- name: 台湾[Select]
type: mixed
port: 10004
listen: 0.0.0.0
proxy: 台湾[Select]
- name: 台湾[UrlTest]
type: mixed
port: 10005
listen: 0.0.0.0
proxy: 台湾[UrlTest]
- name: 台湾[LoadBalance]
type: mixed
port: 10006
listen: 0.0.0.0
proxy: 台湾[LoadBalance]
- name: 新加坡[Select]
type: mixed
port: 10007
listen: 0.0.0.0
proxy: 新加坡[Select]
- name: 新加坡[UrlTest]
type: mixed
port: 10008
listen: 0.0.0.0
proxy: 新加坡[UrlTest]
- name: 新加坡[LoadBalance]
type: mixed
port: 10009
listen: 0.0.0.0
proxy: 新加坡[LoadBalance]
- name: 韩国[Select]
type: mixed
port: 10010
listen: 0.0.0.0
proxy: 韩国[Select]
- name: 韩国[UrlTest]
type: mixed
port: 10011
listen: 0.0.0.0
proxy: 韩国[UrlTest]
- name: 韩国[LoadBalance]
type: mixed
port: 10012
listen: 0.0.0.0
proxy: 韩国[LoadBalance]
- name: 日本[Select]
type: mixed
port: 10013
listen: 0.0.0.0
proxy: 日本[Select]
- name: 日本[UrlTest]
type: mixed
port: 10014
listen: 0.0.0.0
proxy: 日本[UrlTest]
- name: 日本[LoadBalance]
type: mixed
port: 10015
listen: 0.0.0.0
proxy: 日本[LoadBalance]
- name: 美国[Select]
type: mixed
port: 10016
listen: 0.0.0.0
proxy: 美国[Select]
- name: 美国[UrlTest]
type: mixed
port: 10017
listen: 0.0.0.0
proxy: 美国[UrlTest]
- name: 美国[LoadBalance]
type: mixed
port: 10018
listen: 0.0.0.0
proxy: 美国[LoadBalance]
- name: 俄罗斯[Select]
type: mixed
port: 10019
listen: 0.0.0.0
proxy: 俄罗斯[Select]
- name: 俄罗斯[UrlTest]
type: mixed
port: 10020
listen: 0.0.0.0
proxy: 俄罗斯[UrlTest]
- name: 俄罗斯[LoadBalance]
type: mixed
port: 10021
listen: 0.0.0.0
proxy: 俄罗斯[LoadBalance]
- name: 澳大利亚[Select]
type: mixed
port: 10022
listen: 0.0.0.0
proxy: 澳大利亚[Select]
- name: 澳大利亚[UrlTest]
type: mixed
port: 10023
listen: 0.0.0.0
proxy: 澳大利亚[UrlTest]
- name: 澳大利亚[LoadBalance]
type: mixed
port: 10024
listen: 0.0.0.0
proxy: 澳大利亚[LoadBalance]
- name: 加拿大[Select]
type: mixed
port: 10025
listen: 0.0.0.0
proxy: 加拿大[Select]
- name: 加拿大[UrlTest]
type: mixed
port: 10026
listen: 0.0.0.0
proxy: 加拿大[UrlTest]
- name: 加拿大[LoadBalance]
type: mixed
port: 10027
listen: 0.0.0.0
proxy: 加拿大[LoadBalance]
- name: 德国[Select]
type: mixed
port: 10028
listen: 0.0.0.0
proxy: 德国[Select]
- name: 德国[UrlTest]
type: mixed
port: 10029
listen: 0.0.0.0
proxy: 德国[UrlTest]
- name: 德国[LoadBalance]
type: mixed
port: 10030
listen: 0.0.0.0
proxy: 德国[LoadBalance]
- name: 英国[Select]
type: mixed
port: 10031
listen: 0.0.0.0
proxy: 英国[Select]
- name: 英国[UrlTest]
type: mixed
port: 10032
listen: 0.0.0.0
proxy: 英国[UrlTest]
- name: 英国[LoadBalance]
type: mixed
port: 10033
listen: 0.0.0.0
proxy: 英国[LoadBalance]
# 代理机场写这里
proxy-providers:
nexitally:
type: http
url: https://XXXXXXXXX
interval: 3600
health-check:
enable: true
url: https://www.gstatic.com/generate_204
interval: 600
timeout: 5000
lazy: true
expected-status: 204
Tag:
type: http
url: https://XXXXXXXXX
interval: 3600
health-check:
enable: true
url: https://www.gstatic.com/generate_204
interval: 600
timeout: 5000
lazy: true
expected-status: 204
proxy-groups:
- name: Proxies
type: select
proxies:
- All[Select]
- All[UrlTest]
- All[LoadBalance]
- 香港[Select]
- 香港[UrlTest]
- 香港[LoadBalance]
- 台湾[Select]
- 台湾[UrlTest]
- 台湾[LoadBalance]
- 新加坡[Select]
- 新加坡[UrlTest]
- 新加坡[LoadBalance]
- 韩国[Select]
- 韩国[UrlTest]
- 韩国[LoadBalance]
- 日本[Select]
- 日本[UrlTest]
- 日本[LoadBalance]
- 美国[Select]
- 美国[UrlTest]
- 美国[LoadBalance]
- 俄罗斯[Select]
- 俄罗斯[UrlTest]
- 俄罗斯[LoadBalance]
- 澳大利亚[Select]
- 澳大利亚[UrlTest]
- 澳大利亚[LoadBalance]
- 加拿大[Select]
- 加拿大[UrlTest]
- 加拿大[LoadBalance]
- 德国[Select]
- 德国[UrlTest]
- 德国[LoadBalance]
- 英国[Select]
- 英国[UrlTest]
- 英国[LoadBalance]
# 上面加了多少家就添加多少个
- name: Base[不要动]
type: select
use: &Use
- nexitally
- Tag
- name: All[Select]
type: select
use: *Use
- name: All[UrlTest]
type: url-test
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
- name: All[LoadBalance]
type: load-balance
strategy: round-robin
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
# 香港的节点过滤
# Hongkong|香港|Hong Kong|HongKong|HONG KONG|深港|沪港|呼港|穗港|京港|港
- name: 香港[Select]
type: select
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Hongkong|香港|Hong Kong|HongKong|HONG KONG|深港|沪港|呼港|穗港|京港|港"
- name: 香港[UrlTest]
type: url-test
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Hongkong|香港|Hong Kong|HongKong|HONG KONG|深港|沪港|呼港|穗港|京港|港"
- name: 香港[LoadBalance]
type: load-balance
strategy: round-robin
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Hongkong|香港|Hong Kong|HongKong|HONG KONG|深港|沪港|呼港|穗港|京港|港"
# 台湾 的节点过滤
# Taiwan|台湾|臺灣|台灣|中華民國|中华民国|台北|台中|新北|彰化|台|臺|Taipei
- name: 台湾[Select]
type: select
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Taiwan|台湾|臺灣|台灣|中華民國|中华民国|台北|台中|新北|彰化|台|臺|Taipei"
- name: 台湾[UrlTest]
type: url-test
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Taiwan|台湾|臺灣|台灣|中華民國|中华民国|台北|台中|新北|彰化|台|臺|Taipei"
- name: 台湾[LoadBalance]
type: load-balance
strategy: round-robin
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Taiwan|台湾|臺灣|台灣|中華民國|中华民国|台北|台中|新北|彰化|台|臺|Taipei"
# 新加坡
# Singapore|新加坡|狮城|沪新|京新|中新|泉新|穗新|深新|杭新|广新|廣新|滬新
- name: 新加坡[Select]
type: select
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Singapore|新加坡|狮城|沪新|京新|中新|泉新|穗新|深新|杭新|广新|廣新|滬新"
- name: 新加坡[UrlTest]
type: url-test
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Singapore|新加坡|狮城|沪新|京新|中新|泉新|穗新|深新|杭新|广新|廣新|滬新"
- name: 新加坡[LoadBalance]
type: load-balance
strategy: round-robin
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Singapore|新加坡|狮城|沪新|京新|中新|泉新|穗新|深新|杭新|广新|廣新|滬新"
# 韩国
# Korea|韩国|韓國|韩|韓|首尔|春川|Chuncheon|Seoul
- name: 韩国[Select]
type: select
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Korea|韩国|韓國|韩|韓|首尔|春川|Chuncheon|Seoul"
- name: 韩国[UrlTest]
type: url-test
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Korea|韩国|韓國|韩|韓|首尔|春川|Chuncheon|Seoul"
- name: 韩国[LoadBalance]
type: load-balance
strategy: round-robin
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Korea|韩国|韓國|韩|韓|首尔|春川|Chuncheon|Seoul"
# 日本
# Japan|日本|东京|大阪|埼玉|沪日|穗日|川日|中日|泉日|杭日|深日|辽日|广日|大坂|Osaka|Tokyo
- name: 日本[Select]
type: select
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Japan|日本|东京|大阪|埼玉|沪日|穗日|川日|中日|泉日|杭日|深日|辽日|广日|大坂|Osaka|Tokyo"
- name: 日本[UrlTest]
type: url-test
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Japan|日本|东京|大阪|埼玉|沪日|穗日|川日|中日|泉日|杭日|深日|辽日|广日|大坂|Osaka|Tokyo"
- name: 日本[LoadBalance]
type: load-balance
strategy: round-robin
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Japan|日本|东京|大阪|埼玉|沪日|穗日|川日|中日|泉日|杭日|深日|辽日|广日|大坂|Osaka|Tokyo"
# 美国
# United States|美国|America|美|京美|波特兰|达拉斯|俄勒冈|凤凰城|费利蒙|硅谷|矽谷|拉斯维加斯|洛杉矶|圣何塞|圣克拉拉|西雅图|芝加哥|沪美|哥伦布|纽约|Los Angeles|San Jose|Sillicon Valley|Michigan
- name: 美国[Select]
type: select
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "United States|美国|America|美|京美|波特兰|达拉斯|俄勒冈|凤凰城|费利蒙|硅谷|矽谷|拉斯维加斯|洛杉矶|圣何塞|圣克拉拉|西雅图|芝加哥|沪美|哥伦布|纽约|Los Angeles|San Jose|Sillicon Valley|Michigan"
- name: 美国[UrlTest]
type: url-test
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "United States|美国|America|美|京美|波特兰|达拉斯|俄勒冈|凤凰城|费利蒙|硅谷|矽谷|拉斯维加斯|洛杉矶|圣何塞|圣克拉拉|西雅图|芝加哥|沪美|哥伦布|纽约|Los Angeles|San Jose|Sillicon Valley|Michigan"
- name: 美国[LoadBalance]
type: load-balance
strategy: round-robin
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "United States|美国|America|美|京美|波特兰|达拉斯|俄勒冈|凤凰城|费利蒙|硅谷|矽谷|拉斯维加斯|洛杉矶|圣何塞|圣克拉拉|西雅图|芝加哥|沪美|哥伦布|纽约|Los Angeles|San Jose|Sillicon Valley|Michigan"
# 俄罗斯
# Russia|俄罗斯|俄国|俄羅斯|伯力|莫斯科|圣彼得堡|西伯利亚|京俄|杭俄|廣俄|滬俄|广俄|沪俄|Moscow
- name: 俄罗斯[Select]
type: select
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Russia|俄罗斯|俄国|俄羅斯|伯力|莫斯科|圣彼得堡|西伯利亚|京俄|杭俄|廣俄|滬俄|广俄|沪俄|Moscow"
- name: 俄罗斯[UrlTest]
type: url-test
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Russia|俄罗斯|俄国|俄羅斯|伯力|莫斯科|圣彼得堡|西伯利亚|京俄|杭俄|廣俄|滬俄|广俄|沪俄|Moscow"
- name: 俄罗斯[LoadBalance]
type: load-balance
strategy: round-robin
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Russia|俄罗斯|俄国|俄羅斯|伯力|莫斯科|圣彼得堡|西伯利亚|京俄|杭俄|廣俄|滬俄|广俄|沪俄|Moscow"
# 澳大利亚
# Australia|澳大利亚|澳洲|墨尔本|悉尼|土澳|京澳|廣澳|滬澳|沪澳|广澳|Sydney
- name: 澳大利亚[Select]
type: select
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Australia|澳大利亚|澳洲|墨尔本|悉尼|土澳|京澳|廣澳|滬澳|沪澳|广澳|Sydney"
- name: 澳大利亚[UrlTest]
type: url-test
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Australia|澳大利亚|澳洲|墨尔本|悉尼|土澳|京澳|廣澳|滬澳|沪澳|广澳|Sydney"
- name: 澳大利亚[LoadBalance]
type: load-balance
strategy: round-robin
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Australia|澳大利亚|澳洲|墨尔本|悉尼|土澳|京澳|廣澳|滬澳|沪澳|广澳|Sydney"
# 加拿大
# Canada|加拿大|蒙特利尔|温哥华|楓葉|枫叶|滑铁卢|多伦多|Waterloo
- name: 加拿大[Select]
type: select
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Canada|加拿大|蒙特利尔|温哥华|楓葉|枫叶|滑铁卢|多伦多|Waterloo"
- name: 加拿大[UrlTest]
type: url-test
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Canada|加拿大|蒙特利尔|温哥华|楓葉|枫叶|滑铁卢|多伦多|Waterloo"
- name: 加拿大[LoadBalance]
type: load-balance
strategy: round-robin
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Canada|加拿大|蒙特利尔|温哥华|楓葉|枫叶|滑铁卢|多伦多|Waterloo"
# 德国
# German|德国|德國|京德|滬德|廣德|沪德|广德|法兰克福|Frankfurt|德意志
- name: 德国[Select]
type: select
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "German|德国|德國|京德|滬德|廣德|沪德|广德|法兰克福|Frankfurt|德意志"
- name: 德国[UrlTest]
type: url-test
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "German|德国|德國|京德|滬德|廣德|沪德|广德|法兰克福|Frankfurt|德意志"
- name: 德国[LoadBalance]
type: load-balance
strategy: round-robin
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "German|德国|德國|京德|滬德|廣德|沪德|广德|法兰克福|Frankfurt|德意志"
# 英国
# Great Britain|英国|England|United Kingdom|伦敦|英|London
- name: 英国[Select]
type: select
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Great Britain|英国|England|United Kingdom|伦敦|英|London"
- name: 英国[UrlTest]
type: url-test
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Great Britain|英国|England|United Kingdom|伦敦|英|London"
- name: 英国[LoadBalance]
type: load-balance
strategy: round-robin
use: *Use
url: http://www.gstatic.com/generate_204
interval: 60
lazy: true
timeout: 5000
expected-status: 200/302
filter: "Great Britain|英国|England|United Kingdom|伦敦|英|London"
rule-providers:
LocalAreaNetwork:
behavior: classical
type: http
url: "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Providers/LocalAreaNetwork.yaml"
interval: 86400
path: ./ACL4SSR/LocalAreaNetwork.yaml
rules:
- RULE-SET,LocalAreaNetwork,DIRECT # 绕过局域网
- MATCH,Proxies # 代理全部
|