LiuShen revised this gist . Go to revision
1 file changed, 442 insertions
main.js(file created)
@@ -0,0 +1,442 @@ | |||
1 | + | // Define the `main` function | |
2 | + | ||
3 | + | const proxyName = "代理模式"; | |
4 | + | ||
5 | + | function main (params) { | |
6 | + | if (!params.proxies) return params; | |
7 | + | overwriteRules (params); | |
8 | + | overwriteProxyGroups (params); | |
9 | + | overwriteDns (params); | |
10 | + | return params; | |
11 | + | } | |
12 | + | // 覆写规则 | |
13 | + | function overwriteRules (params) { | |
14 | + | const customRules = [ | |
15 | + | // 在此添加自定义规则,最高优先级。 | |
16 | + | // 为了方便区分,可设置 全局代理模式 或 自定义代理组。 | |
17 | + | // 示例 1 :使用 全局代理模式 | |
18 | + | //"DOMAIN-SUFFIX,linux.do," + proxyName, | |
19 | + | // 示例 2 :使用 自定义代理组 1 | |
20 | + | //"DOMAIN-SUFFIX,gstatic.com, 自定义代理组 1", | |
21 | + | // 示例 3 :使用 自定义代理组 2 | |
22 | + | //"DOMAIN-SUFFIX,googleapis.com, 自定义代理组 2", | |
23 | + | ]; | |
24 | + | ||
25 | + | ||
26 | + | const rules = [ | |
27 | + | ...customRules, | |
28 | + | "RULE-SET,reject, 广告拦截", | |
29 | + | "RULE-SET,direct,DIRECT", | |
30 | + | "RULE-SET,cncidr,DIRECT", | |
31 | + | "RULE-SET,private,DIRECT", | |
32 | + | "RULE-SET,lancidr,DIRECT", | |
33 | + | "GEOIP,LAN,DIRECT,no-resolve", | |
34 | + | "GEOIP,CN,DIRECT,no-resolve", | |
35 | + | "RULE-SET,applications,DIRECT", | |
36 | + | "RULE-SET,openai,ChatGPT", | |
37 | + | "RULE-SET,claude,Claude", | |
38 | + | "RULE-SET,spotify,Spotify", | |
39 | + | "RULE-SET,telegramcidr,电报消息,no-resolve", | |
40 | + | "RULE-SET,tld-not-cn," + proxyName, | |
41 | + | "RULE-SET,google," + proxyName, | |
42 | + | "RULE-SET,icloud," + proxyName, | |
43 | + | "RULE-SET,apple," + proxyName, | |
44 | + | "RULE-SET,gfw," + proxyName, | |
45 | + | "RULE-SET,greatfire," + proxyName, | |
46 | + | "RULE-SET,proxy," + proxyName, | |
47 | + | "MATCH, 漏网之鱼", | |
48 | + | ]; | |
49 | + | const ruleProviders = { | |
50 | + | reject: { | |
51 | + | type: "http", | |
52 | + | behavior: "domain", | |
53 | + | url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt", | |
54 | + | path: "./ruleset/reject.yaml", | |
55 | + | interval: 86400, | |
56 | + | }, | |
57 | + | icloud: { | |
58 | + | type: "http", | |
59 | + | behavior: "domain", | |
60 | + | url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt", | |
61 | + | path: "./ruleset/icloud.yaml", | |
62 | + | interval: 86400, | |
63 | + | }, | |
64 | + | apple: { | |
65 | + | type: "http", | |
66 | + | behavior: "domain", | |
67 | + | url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt", | |
68 | + | path: "./ruleset/apple.yaml", | |
69 | + | interval: 86400, | |
70 | + | }, | |
71 | + | google: { | |
72 | + | type: "http", | |
73 | + | behavior: "domain", | |
74 | + | url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt", | |
75 | + | path: "./ruleset/google.yaml", | |
76 | + | interval: 86400, | |
77 | + | }, | |
78 | + | proxy: { | |
79 | + | type: "http", | |
80 | + | behavior: "domain", | |
81 | + | url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt", | |
82 | + | path: "./ruleset/proxy.yaml", | |
83 | + | interval: 86400, | |
84 | + | }, | |
85 | + | openai: { | |
86 | + | type: "http", | |
87 | + | behavior: "classical", | |
88 | + | url: "https://fastly.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/OpenAI/OpenAI.yaml", | |
89 | + | path: "./ruleset/custom/openai.yaml" | |
90 | + | }, | |
91 | + | claude: { | |
92 | + | type: "http", | |
93 | + | behavior: "classical", | |
94 | + | url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Claude/Claude.yaml", | |
95 | + | path: "./ruleset/custom/Claude.yaml" | |
96 | + | }, | |
97 | + | spotify: { | |
98 | + | type: "http", | |
99 | + | behavior: "classical", | |
100 | + | url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Spotify/Spotify.yaml", | |
101 | + | path: "./ruleset/custom/Spotify.yaml" | |
102 | + | }, | |
103 | + | telegramcidr: { | |
104 | + | type: "http", | |
105 | + | behavior: "ipcidr", | |
106 | + | url: "https://fastly.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt", | |
107 | + | path: "./ruleset/custom/telegramcidr.yaml" | |
108 | + | }, | |
109 | + | direct: { | |
110 | + | type: "http", | |
111 | + | behavior: "domain", | |
112 | + | url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt", | |
113 | + | path: "./ruleset/direct.yaml", | |
114 | + | interval: 86400, | |
115 | + | }, | |
116 | + | private: { | |
117 | + | type: "http", | |
118 | + | behavior: "domain", | |
119 | + | url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt", | |
120 | + | path: "./ruleset/private.yaml", | |
121 | + | interval: 86400, | |
122 | + | }, | |
123 | + | gfw: { | |
124 | + | type: "http", | |
125 | + | behavior: "domain", | |
126 | + | url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt", | |
127 | + | path: "./ruleset/gfw.yaml", | |
128 | + | interval: 86400, | |
129 | + | }, | |
130 | + | greatfire: { | |
131 | + | type: "http", | |
132 | + | behavior: "domain", | |
133 | + | url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/greatfire.txt", | |
134 | + | path: "./ruleset/greatfire.yaml", | |
135 | + | interval: 86400, | |
136 | + | }, | |
137 | + | "tld-not-cn": { | |
138 | + | type: "http", | |
139 | + | behavior: "domain", | |
140 | + | url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt", | |
141 | + | path: "./ruleset/tld-not-cn.yaml", | |
142 | + | interval: 86400, | |
143 | + | }, | |
144 | + | telegramcidr: { | |
145 | + | type: "http", | |
146 | + | behavior: "ipcidr", | |
147 | + | url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt", | |
148 | + | path: "./ruleset/telegramcidr.yaml", | |
149 | + | interval: 86400, | |
150 | + | }, | |
151 | + | cncidr: { | |
152 | + | type: "http", | |
153 | + | behavior: "ipcidr", | |
154 | + | url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt", | |
155 | + | path: "./ruleset/cncidr.yaml", | |
156 | + | interval: 86400, | |
157 | + | }, | |
158 | + | lancidr: { | |
159 | + | type: "http", | |
160 | + | behavior: "ipcidr", | |
161 | + | url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt", | |
162 | + | path: "./ruleset/lancidr.yaml", | |
163 | + | interval: 86400, | |
164 | + | }, | |
165 | + | applications: { | |
166 | + | type: "http", | |
167 | + | behavior: "classical", | |
168 | + | url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/applications.txt", | |
169 | + | path: "./ruleset/applications.yaml", | |
170 | + | interval: 86400, | |
171 | + | }, | |
172 | + | }; | |
173 | + | params ["rule-providers"] = ruleProviders; | |
174 | + | params ["rules"] = rules; | |
175 | + | } | |
176 | + | // 覆写代理组 | |
177 | + | function overwriteProxyGroups (params) { | |
178 | + | // 添加自用代理 | |
179 | + | params.proxies.push ( | |
180 | + | // { name: '1 - 香港 - 示例 ', type: *, server: **, port: *, cipher: **, password: **, udp: true } | |
181 | + | ||
182 | + | ); | |
183 | + | ||
184 | + | // 所有代理 | |
185 | + | const allProxies = params ["proxies"].map ((e) => e.name); | |
186 | + | // 自动选择代理组,按地区分组选延迟最低 | |
187 | + | const autoProxyGroupRegexs = [ | |
188 | + | { name: "HK - 自动选择", regex: / 香港 | HK|Hong|🇭🇰/ }, | |
189 | + | { name: "TW - 自动选择", regex: / 台湾 | TW|Taiwan|Wan|🇨🇳|🇹🇼/ }, | |
190 | + | { name: "SG - 自动选择", regex: / 新加坡 | 狮城 | SG|Singapore|🇸🇬/ }, | |
191 | + | { name: "JP - 自动选择", regex: / 日本 | JP|Japan|🇯🇵/ }, | |
192 | + | { name: "US - 自动选择", regex: / 美国 | US|United States|America|🇺🇸/ }, | |
193 | + | { name: "其它 - 自动选择", regex: /(?!.*(?: 剩余 | 到期 | 主页 | 官网 | 游戏 | 关注))(.*)/ }, | |
194 | + | ]; | |
195 | + | ||
196 | + | const autoProxyGroups = autoProxyGroupRegexs | |
197 | + | .map ((item) => ({ | |
198 | + | name: item.name, | |
199 | + | type: "url-test", | |
200 | + | url: "http://www.gstatic.com/generate_204", | |
201 | + | interval: 300, | |
202 | + | tolerance: 50, | |
203 | + | proxies: getProxiesByRegex (params, item.regex), | |
204 | + | hidden: true, | |
205 | + | })) | |
206 | + | .filter ((item) => item.proxies.length > 0); | |
207 | + | ||
208 | + | // 手工选择代理组 | |
209 | + | const manualProxyGroups = [ | |
210 | + | { name: "HK - 手工选择", regex: / 香港 | HK|Hong|🇭🇰/, icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/flags/hk.svg" }, | |
211 | + | { name: "TW - 手工选择", regex: / 台湾 | TW|Taiwan|Wan|🇨🇳|🇹🇼/, icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/flags/tw.svg" }, | |
212 | + | { name: "SG - 手工选择", regex: / 新加坡 | 狮城 | SG|Singapore|🇸🇬/, icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/flags/sg.svg" }, | |
213 | + | { name: "JP - 手工选择", regex: / 日本 | JP|Japan|🇯🇵/, icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/flags/jp.svg" }, | |
214 | + | { name: "US - 手工选择", regex: / 美国 | US|United States|America|🇺🇸/, icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/flags/us.svg" }, | |
215 | + | ]; | |
216 | + | ||
217 | + | const manualProxyGroupsConfig = manualProxyGroups | |
218 | + | .map ((item) => ({ | |
219 | + | name: item.name, | |
220 | + | type: "select", | |
221 | + | proxies: getManualProxiesByRegex (params, item.regex), | |
222 | + | icon: item.icon, | |
223 | + | hidden: false, | |
224 | + | })) | |
225 | + | .filter ((item) => item.proxies.length > 0); | |
226 | + | ||
227 | + | const groups = [ | |
228 | + | { | |
229 | + | name: proxyName, | |
230 | + | type: "select", | |
231 | + | url: "http://www.gstatic.com/generate_204", | |
232 | + | icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/adjust.svg", | |
233 | + | proxies: [ | |
234 | + | "自动选择", | |
235 | + | "手动选择", | |
236 | + | "负载均衡 (散列)", | |
237 | + | "负载均衡 (轮询)", | |
238 | + | "DIRECT", | |
239 | + | ], | |
240 | + | }, | |
241 | + | { | |
242 | + | name: "手动选择", | |
243 | + | type: "select", | |
244 | + | icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/link.svg", | |
245 | + | proxies: allProxies, | |
246 | + | }, | |
247 | + | { | |
248 | + | name: "自动选择", | |
249 | + | type: "select", | |
250 | + | icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/speed.svg", | |
251 | + | proxies: ["ALL - 自动选择"], | |
252 | + | }, | |
253 | + | { | |
254 | + | name: "负载均衡 (散列)", | |
255 | + | type: "load-balance", | |
256 | + | url: "http://www.gstatic.com/generate_204", | |
257 | + | icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/balance.svg", | |
258 | + | interval: 300, | |
259 | + | "max-failed-times": 3, | |
260 | + | strategy: "consistent-hashing", | |
261 | + | lazy: true, | |
262 | + | proxies: allProxies, | |
263 | + | }, | |
264 | + | { | |
265 | + | name: "负载均衡 (轮询)", | |
266 | + | type: "load-balance", | |
267 | + | url: "http://www.gstatic.com/generate_204", | |
268 | + | icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/merry_go.svg", | |
269 | + | interval: 300, | |
270 | + | "max-failed-times": 3, | |
271 | + | strategy: "round-robin", | |
272 | + | lazy: true, | |
273 | + | proxies: allProxies, | |
274 | + | }, | |
275 | + | { | |
276 | + | name: "ALL - 自动选择", | |
277 | + | type: "url-test", | |
278 | + | url: "http://www.gstatic.com/generate_204", | |
279 | + | interval: 300, | |
280 | + | tolerance: 50, | |
281 | + | proxies: allProxies, | |
282 | + | hidden: true, | |
283 | + | }, | |
284 | + | { | |
285 | + | name: "自定义代理组 1", | |
286 | + | type: "select", | |
287 | + | proxies: [proxyName, "HK - 自动选择", "TW - 自动选择", "SG - 自动选择", "JP - 自动选择", "US - 自动选择", "其它 - 自动选择", "HK - 手工选择", "TW - 手工选择", "SG - 手工选择", "JP - 手工选择", "US - 手工选择"], | |
288 | + | "include-all": true, | |
289 | + | icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/ambulance.svg" | |
290 | + | }, | |
291 | + | { | |
292 | + | name: "自定义代理组 2", | |
293 | + | type: "select", | |
294 | + | proxies: [proxyName, "HK - 自动选择", "TW - 自动选择", "SG - 自动选择", "JP - 自动选择", "US - 自动选择", "其它 - 自动选择", "HK - 手工选择", "TW - 手工选择", "SG - 手工选择", "JP - 手工选择", "US - 手工选择"], | |
295 | + | "include-all": true, | |
296 | + | icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/ambulance.svg" | |
297 | + | }, | |
298 | + | { | |
299 | + | name: "电报消息", | |
300 | + | type: "select", | |
301 | + | proxies: [proxyName, "HK - 自动选择", "TW - 自动选择", "SG - 自动选择", "JP - 自动选择", "US - 自动选择", "其它 - 自动选择", "HK - 手工选择", "TW - 手工选择", "SG - 手工选择", "JP - 手工选择", "US - 手工选择"], | |
302 | + | // "include-all": true, | |
303 | + | icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/telegram.svg" | |
304 | + | }, | |
305 | + | { | |
306 | + | name: "ChatGPT", | |
307 | + | type: "select", | |
308 | + | proxies: [proxyName, "HK - 自动选择", "TW - 自动选择", "SG - 自动选择", "JP - 自动选择", "US - 自动选择", "其它 - 自动选择", "HK - 手工选择", "TW - 手工选择", "SG - 手工选择", "JP - 手工选择", "US - 手工选择"], | |
309 | + | // "include-all": true, | |
310 | + | icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/chatgpt.svg" | |
311 | + | }, | |
312 | + | { | |
313 | + | name: "Claude", | |
314 | + | type: "select", | |
315 | + | proxies: [proxyName, "HK - 自动选择", "TW - 自动选择", "SG - 自动选择", "JP - 自动选择", "US - 自动选择", "其它 - 自动选择", "HK - 手工选择", "TW - 手工选择", "SG - 手工选择", "JP - 手工选择", "US - 手工选择"], | |
316 | + | // "include-all": true, | |
317 | + | icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/claude.svg" | |
318 | + | }, | |
319 | + | { | |
320 | + | name: "Spotify", | |
321 | + | type: "select", | |
322 | + | proxies: [proxyName, "HK - 自动选择", "TW - 自动选择", "SG - 自动选择", "JP - 自动选择", "US - 自动选择", "其它 - 自动选择", "HK - 手工选择", "TW - 手工选择", "SG - 手工选择", "JP - 手工选择", "US - 手工选择"], | |
323 | + | // "include-all": true, | |
324 | + | icon: "https://storage.googleapis.com/spotifynewsroom-jp.appspot.com/1/2020/12/Spotify_Icon_CMYK_Green.png" | |
325 | + | }, | |
326 | + | { | |
327 | + | name: "漏网之鱼", | |
328 | + | type: "select", | |
329 | + | proxies: ["DIRECT", proxyName], | |
330 | + | icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/fish.svg" | |
331 | + | }, | |
332 | + | { | |
333 | + | name: "广告拦截", | |
334 | + | type: "select", | |
335 | + | proxies: ["REJECT", "DIRECT", proxyName], | |
336 | + | icon: "https://fastly.jsdelivr.net/gh/clash-verge-rev/clash-verge-rev.github.io@main/docs/assets/icons/block.svg" | |
337 | + | }, | |
338 | + | ]; | |
339 | + | ||
340 | + | autoProxyGroups.length && | |
341 | + | groups [2].proxies.unshift (...autoProxyGroups.map ((item) => item.name)); | |
342 | + | groups.push (...autoProxyGroups); | |
343 | + | groups.push (...manualProxyGroupsConfig); | |
344 | + | params ["proxy-groups"] = groups; | |
345 | + | ||
346 | + | } | |
347 | + | // 防止 dns 泄露 | |
348 | + | function overwriteDns (params) { | |
349 | + | const cnDnsList = [ | |
350 | + | "https://223.5.5.5/dns-query", | |
351 | + | "https://1.12.12.12/dns-query", | |
352 | + | ]; | |
353 | + | const trustDnsList = [ | |
354 | + | 'quic://dns.cooluc.com', | |
355 | + | "https://1.0.0.1/dns-query", | |
356 | + | "https://1.1.1.1/dns-query", | |
357 | + | ]; | |
358 | + | ||
359 | + | const dnsOptions = { | |
360 | + | enable: true, | |
361 | + | "prefer-h3": true, // 如果 DNS 服务器支持 DoH3 会优先使用 h3 | |
362 | + | "default-nameserver": cnDnsList, // 用于解析其他 DNS 服务器、和节点的域名,必须为 IP, 可为加密 DNS。注意这个只用来解析节点和其他的 dns,其他网络请求不归他管 | |
363 | + | nameserver: trustDnsList, // 其他网络请求都归他管 | |
364 | + | ||
365 | + | // 这个用于覆盖上面的 nameserver | |
366 | + | "nameserver-policy": { | |
367 | + | //[combinedUrls]: notionDns, | |
368 | + | "geosite:cn": cnDnsList, | |
369 | + | "geosite:geolocation-!cn": trustDnsList, | |
370 | + | // 如果你有一些内网使用的 DNS,应该定义在这里,多个域名用英文逗号分割 | |
371 | + | // '+. 公司域名.com, www.4399.com, +.baidu.com': '10.0.0.1' | |
372 | + | }, | |
373 | + | fallback: trustDnsList, | |
374 | + | "fallback-filter": { | |
375 | + | geoip: true, | |
376 | + | // 除了 geoip-code 配置的国家 IP, 其他的 IP 结果会被视为污染 geoip-code 配置的国家的结果会直接采用,否则将采用 fallback 结果 | |
377 | + | "geoip-code": "CN", | |
378 | + | //geosite 列表的内容被视为已污染,匹配到 geosite 的域名,将只使用 fallback 解析,不去使用 nameserver | |
379 | + | geosite: ["gfw"], | |
380 | + | ipcidr: ["240.0.0.0/4"], | |
381 | + | domain: ["+.google.com", "+.facebook.com", "+.youtube.com"], | |
382 | + | }, | |
383 | + | }; | |
384 | + | ||
385 | + | // GitHub 加速前缀 | |
386 | + | const githubPrefix = "https://fastgh.lainbo.com/"; | |
387 | + | ||
388 | + | // GEO 数据 GitHub 资源原始下载地址 | |
389 | + | const rawGeoxURLs = { | |
390 | + | geoip: | |
391 | + | "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.dat", | |
392 | + | geosite: | |
393 | + | "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat", | |
394 | + | mmdb: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country-lite.mmdb", | |
395 | + | }; | |
396 | + | ||
397 | + | // 生成带有加速前缀的 GEO 数据资源对象 | |
398 | + | const accelURLs = Object.fromEntries ( | |
399 | + | Object.entries (rawGeoxURLs).map (([key, githubUrl]) => [ | |
400 | + | key, | |
401 | + | `${githubPrefix}${githubUrl}`, | |
402 | + | ]) | |
403 | + | ); | |
404 | + | ||
405 | + | const otherOptions = { | |
406 | + | "unified-delay": true, | |
407 | + | "tcp-concurrent": true, | |
408 | + | profile: { | |
409 | + | "store-selected": true, | |
410 | + | "store-fake-ip": true, | |
411 | + | }, | |
412 | + | sniffer: { | |
413 | + | enable: true, | |
414 | + | sniff: { | |
415 | + | TLS: { | |
416 | + | ports: [443, 8443], | |
417 | + | }, | |
418 | + | HTTP: { | |
419 | + | ports: [80, "8080-8880"], | |
420 | + | "override-destination": true, | |
421 | + | }, | |
422 | + | }, | |
423 | + | }, | |
424 | + | "geodata-mode": true, | |
425 | + | "geox-url": accelURLs, | |
426 | + | }; | |
427 | + | ||
428 | + | params.dns = { ...params.dns, ...dnsOptions }; | |
429 | + | Object.keys (otherOptions).forEach ((key) => { | |
430 | + | params [key] = otherOptions [key]; | |
431 | + | }); | |
432 | + | } | |
433 | + | ||
434 | + | function getProxiesByRegex (params, regex) { | |
435 | + | const matchedProxies = params.proxies.filter ((e) => regex.test (e.name)).map ((e) => e.name); | |
436 | + | return matchedProxies.length > 0 ? matchedProxies : ["手动选择"]; | |
437 | + | } | |
438 | + | ||
439 | + | function getManualProxiesByRegex (params, regex) { | |
440 | + | const matchedProxies = params.proxies.filter ((e) => regex.test (e.name)).map ((e) => e.name); | |
441 | + | return matchedProxies.length > 0 ? matchedProxies : ["DIRECT", "手动选择", proxyName]; | |
442 | + | } |
Newer
Older