Skip to content

Commit f0d7882

Browse files
committed
feat: 新增自动选择、负载均衡策略组
1 parent 597747d commit f0d7882

3 files changed

Lines changed: 53 additions & 11 deletions

File tree

Config/mihomoConfig.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ group_common_auto:
341341
lazy: true,
342342
tolerance: 100,
343343
include-all: true,
344+
exclude-type: 'DIRECT',
344345
icon: 'https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/Auto.png',
345346
hidden: true,
346347
}
@@ -355,6 +356,7 @@ group_common_load:
355356
lazy: true,
356357
strategy: 'sticky-sessions',
357358
include-all: true,
359+
exclude-type: 'DIRECT',
358360
icon: 'https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/Round_Robin.png',
359361
hidden: true,
360362
}
@@ -365,6 +367,8 @@ prox_common:
365367
proxies:
366368
[
367369
'默认代理',
370+
'自动选择',
371+
'负载均衡',
368372
'香港',
369373
'日本',
370374
'美国',
@@ -389,10 +393,18 @@ proxy-groups:
389393
'台湾省',
390394
'低倍率节点',
391395
'高倍率节点',
396+
'自动选择',
397+
'负载均衡',
392398
'其他节点',
393399
]
394400
icon: 'https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/Proxy.png'
395401

402+
- name: '自动选择'
403+
<<: *group_common_auto
404+
405+
- name: '负载均衡'
406+
<<: *group_common_load
407+
396408
- name: 'AI'
397409
<<: [*group_common_select, *proxies]
398410
icon: 'https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/ChatGPT.png'
@@ -414,6 +426,8 @@ proxy-groups:
414426
'台湾省',
415427
'低倍率节点',
416428
'高倍率节点',
429+
'自动选择',
430+
'负载均衡',
417431
'其他节点',
418432
]
419433
icon: 'https://fastly.jsdelivr.net/gh/MiToverG422/Qure@master/IconSet/Color/fcm.png'
@@ -439,6 +453,8 @@ proxy-groups:
439453
'台湾省',
440454
'低倍率节点',
441455
'高倍率节点',
456+
'自动选择',
457+
'负载均衡',
442458
'其他节点',
443459
]
444460
icon: 'https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/Microsoft.png'
@@ -456,6 +472,8 @@ proxy-groups:
456472
'台湾省',
457473
'低倍率节点',
458474
'高倍率节点',
475+
'自动选择',
476+
'负载均衡',
459477
'其他节点',
460478
]
461479
icon: 'https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/Apple.png'
@@ -501,6 +519,8 @@ proxy-groups:
501519
'台湾省',
502520
'低倍率节点',
503521
'高倍率节点',
522+
'自动选择',
523+
'负载均衡',
504524
'其他节点',
505525
]
506526
icon: 'https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/Spotify.png'

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ https://raw.githubusercontent.com/AIsouler/MyClash/refs/heads/main/Script/mihomo
4949

5050
## 内置策略组
5151

52-
> - _若不需要某个策略组,可在脚本中将对应开关设为 `false`_
52+
> - _若不需要某个分流策略组,可在脚本中将对应开关设为 `false`_
5353
5454
- `默认代理`
55+
- `自动选择`
56+
- `负载均衡`
5557
- `AI`
5658
- `YouTube`
5759
- `FCM`

Script/mihomoScript.js

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -681,19 +681,39 @@ function main(config) {
681681

682682
// 定义分流策略组对应的策略组成员
683683
const proxyModes = {
684-
default: ['默认代理', ...groupNamesOfSelect],
685-
direct: ['默认代理', '直连', ...groupNamesOfSelect],
686-
directfirst: ['直连', '默认代理', ...groupNamesOfSelect],
684+
default: ['默认代理', '自动选择', '负载均衡', ...groupNamesOfSelect],
685+
direct: ['默认代理', '直连', '自动选择', '负载均衡', ...groupNamesOfSelect],
686+
directfirst: [
687+
'直连',
688+
'默认代理',
689+
'自动选择',
690+
'负载均衡',
691+
...groupNamesOfSelect,
692+
],
687693
reject: ['REJECT', 'REJECT-DROP', 'PASS'],
688694
};
689695

690-
// 生成默认代理策略组
691-
functionalGroups.push({
692-
...selectBaseOption,
693-
name: '默认代理',
694-
proxies: [...groupNamesOfSelect],
695-
icon: 'https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/Proxy.png',
696-
});
696+
// 生成基础策略组
697+
functionalGroups.push(
698+
{
699+
...selectBaseOption,
700+
name: '默认代理',
701+
proxies: [...groupNamesOfSelect, '自动选择', '负载均衡'],
702+
icon: 'https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/Proxy.png',
703+
},
704+
{
705+
...urlTestBaseOption,
706+
name: '自动选择',
707+
'include-all': true,
708+
'exclude-type': 'DIRECT',
709+
},
710+
{
711+
...loadBalanceBaseOption,
712+
name: '负载均衡',
713+
'include-all': true,
714+
'exclude-type': 'DIRECT',
715+
},
716+
);
697717

698718
// 构建分流策略组
699719
for (const svc of serviceConfigs) {

0 commit comments

Comments
 (0)