MCPcopy Create free account
hub / github.com/Moli-X/Resources / overwriteProxyGroups

Function overwriteProxyGroups

Clash/Script/Configure.js:68–169  ·  view source on GitHub ↗
(params)

Source from the content-addressed store, hash-verified

66
67//覆写代理组
68function overwriteProxyGroups(params) {
69 // 所有代理
70 const allProxies = params["proxies"].map((e) => e.name);
71
72 // 延迟最低代理组,按地区分组选延迟最低
73 const autoProxyGroupRegexs = [
74 { name: "香港节点" , regex: /香港|HK|Hong|🇭🇰/ , icon: "https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/Hong_Kong.png " },
75 { name: "台湾节点" , regex: /台湾|TW|Taiwan|Wan|🇨🇳|🇹🇼/ , icon: "https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/Taiwan.png" },
76 { name: "日本节点" , regex: /日本|JP|Japan|🇯🇵/ , icon: "https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/Japan.png " },
77 { name: "美国节点" , regex: /美国|US|United States|America|🇺🇸/ , icon: "https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/United_States.png" },
78 { name: "新加坡节点" , regex: /新加坡|狮城|SG|Singapore|🇸🇬/ , icon: "https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/Singapore.png " },
79 ];
80
81 const autoProxyGroups = autoProxyGroupRegexs
82 .map((item) => ({
83 name: item.name,
84 type: "url-test",
85 url: "http://www.gstatic.com/generate_204",
86 interval: 300,
87 tolerance: 50,
88 proxies: getProxiesByRegex(params, item.regex),
89 icon: item.icon,
90 hidden: false,
91 }))
92 // 过滤掉没有可用代理的组,只保留有代理的组
93 .filter((item) => item.proxies.length > 0);
94
95
96 const groups = [
97
98 {
99 name: "海外服务",
100 type: "select",
101 url: "http://www.gstatic.com/generate_204",
102 icon: "https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/Global.png",
103 proxies: [ "香港节点", "台湾节点", "新加坡节点", "日本节点", "美国节点", "全球节点"],
104 },
105
106 {
107 name: "电报消息",
108 type: "select",
109 proxies: ["海外服务", "香港节点", "台湾节点", "新加坡节点", "日本节点", "美国节点", "全球节点"],
110 // "include-all": true,
111 icon: "https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color//Telegram_X.png"
112 },
113 {
114 name: "人工智能",
115 type: "select",
116 proxies: ["海外服务", "香港节点", "台湾节点", "新加坡节点", "日本节点", "美国节点", "全球节点"],
117 // "include-all": true,
118 icon: "https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/ChatGPT.png "
119 },
120 {
121 name: "中国媒体",
122 type: "select",
123 proxies: ["PASS","海外服务", "DIRECT"],
124 // "include-all": true,
125 icon: "https://fastly.jsdelivr.net/gh/Koolson/Qure@master/IconSet/Color/StreamingCN.png"

Callers 1

mainFunction · 0.70

Calls 2

getProxiesByRegexFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected