Skip to content

Commit 68bff0c

Browse files
committed
feat: Add auto selecting outbounds
1 parent b957505 commit 68bff0c

5 files changed

+26
-16
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,5 @@ dist
173173

174174
test
175175
.editorconfig
176-
.prettierrc
176+
.prettierrc
177+
package-lock.json

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@
2222

2323
## 最近更新
2424

25-
### 29/7
25+
### 30/7
2626

2727
- 简化逆天路由规则
28+
- 修复了一些小问题
2829

2930
### 28/7
3031

src/ClashConfigBuilder.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,15 @@ export class ClashConfigBuilder {
4444
}
4545
});
4646
const proxyList = customProxies.filter(proxy => proxy?.tag !== undefined).map(proxy => proxy?.tag);
47-
proxyList.push('DIRECT', 'REJECT');
47+
this.config['proxy-groups'].push({
48+
name: '⚡ 自动选择',
49+
type: 'url-test',
50+
proxies: DeepCopy(proxyList),
51+
url: 'https://www.gstatic.com/generate_204',
52+
interval: 300,
53+
lazy: false
54+
});
55+
proxyList.push('DIRECT', 'REJECT');
4856
SELECTORS_LIST.forEach(selector => {
4957
if (!this.config['proxy-groups'].some(g => g.name === selector)) {
5058
this.config['proxy-groups'].push({

src/SingboxConfigBuilder.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ export class ConfigBuilder {
4444
}
4545

4646
addSelectors() {
47-
const tagList = this.config.outbounds.filter(outbound => outbound.type != 'selector').map(outbound => outbound?.tag);
47+
const tagList = this.config.outbounds.filter(outbound => outbound?.server != undefined).map(outbound => outbound.tag);
48+
this.config.outbounds.push({
49+
type: "urltest",
50+
tag: "⚡ 自动选择",
51+
outbounds: tagList
52+
});
53+
tagList.push('DIRECT', 'REJECT');
4854
SELECTORS_LIST.forEach(selector => {
4955
this.config.outbounds.push({
5056
type: "selector",

src/config.js

+6-12
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,7 @@ export const SING_BOX_CONFIG = {
109109
{
110110
"type": "dns",
111111
"tag": "dns-out"
112-
},
113-
{
114-
"type": "selector",
115-
"tag": "🐟 漏网之鱼",
116-
"outbounds": ["DIRECT", "REJECT", "🚀 节点选择"]
117112
}
118-
119113
],
120114

121115
"route": {
@@ -232,7 +226,7 @@ export const SING_BOX_CONFIG = {
232226
}
233227
}
234228
}
235-
export const SELECTORS_LIST = ['🚀 节点选择', '📲 电报消息', '💬 OpenAi', '📹 油管视频', '🎥 奈飞视频', '📺 巴哈姆特', '📺 哔哩哔哩国际', '🌍 国外媒体', '🇨🇳 国内服务', '🔍 谷歌服务', '🐱 GitHub', '🛑 广告拦截', '🎥 奈飞节点', 'GLOBAL']
229+
export const SELECTORS_LIST = ['🚀 节点选择', '🛑 广告拦截', '🌍 国外媒体', '🇨🇳 国内服务', '📲 电报消息', '💬 OpenAi', '📹 油管视频', '🎥 奈飞视频', '📺 巴哈姆特', '📺 哔哩哔哩国际', '🔍 谷歌服务', '🐱 GitHub', '🐟 漏网之鱼', 'GLOBAL']
236230

237231
export const CLASH_RULES = `
238232
# - AND,(AND,(DST-PORT,443),(NETWORK,UDP)),(NOT,((GEOSITE,cn))),REJECT # quic
@@ -275,10 +269,10 @@ export const CLASH_CONFIG = {
275269
fallback: ['8.8.8.8', '8.8.4.4', 'tls://1.0.0.1:853', 'tls://dns.google:853'],
276270
},
277271
proxies: [],
278-
'proxy-groups': [{
279-
'name': '🐟 漏网之鱼',
280-
'type': 'select',
281-
'proxies': ['🚀 节点选择','DIRECT','REJECT']
282-
}],
272+
'proxy-groups': [
273+
// 'name': '🐟 漏网之鱼',
274+
// 'type': 'select',
275+
// 'proxies': ['🚀 节点选择','DIRECT','REJECT']
276+
],
283277
rules: parsedRules,
284278
};

0 commit comments

Comments
 (0)