-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
41 lines (36 loc) · 963 Bytes
/
main.js
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
function main(params) {
let proxies = params.proxies.map(x => x.name);
let la = {
name: "均衡负载-散列",
type: "load-balance",
proxies: proxies,
url: 'https://www.gstatic.com/generate_204',
interval: 300,
strategy: "consistent-hashing"
}
let lb = {
name: "均衡负载-轮询",
type: "load-balance",
proxies: proxies,
url: 'https://www.gstatic.com/generate_204',
interval: 300,
strategy: "round-robin"
}
let lc = {
name: "自动选择",
type: "url-test",
proxies:proxies,
url: 'https://www.gstatic.com/generate_204',
interval: 300,
tolerance: 50
}
for (i in params["proxy-groups"]) {
params["proxy-groups"][i].proxies.unshift(la.name)
params["proxy-groups"][i].proxies.unshift(lb.name)
params["proxy-groups"][i].proxies.unshift(lc.name)
}
params["proxy-groups"].push(la)
params["proxy-groups"].push(lb)
params["proxy-groups"].push(lc)
return params;
}