Skip to content

Commit b21a449

Browse files
committed
feat: Update SingboxConfigBuilder to add default rules and auto detect interface
1 parent be7ca31 commit b21a449

File tree

2 files changed

+6
-26
lines changed

2 files changed

+6
-26
lines changed

src/SingboxConfigBuilder.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,15 @@ export class ConfigBuilder extends BaseConfigBuilder {
6060
}));
6161

6262
// Add any default rules that should always be present
63-
this.config.route.rules.push(
64-
{ protocol: 'dns', port: 53, outbound: 'dns-out' },
63+
this.config.route.rules.unshift(
64+
{ protocol: 'dns', outbound: 'dns-out' },
6565
{ clash_mode: 'direct', outbound: 'DIRECT' },
6666
{ clash_mode: 'global', outbound: 'GLOBAL' }
6767
);
6868

69+
this.config.route.auto_detect_interface = true;
70+
this.config.route.final = '🐟 漏网之鱼';
71+
6972
return this.config;
7073
}
7174
}

src/config.js

+1-24
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export function generateRuleSets(selectedRuleNames = []) {
144144
download_detour: '⚡ 自动选择'
145145
}))
146146
};
147-
}
147+
}
148148

149149
// Singbox configuration
150150
export const SING_BOX_CONFIG = {
@@ -191,29 +191,6 @@ export const SING_BOX_CONFIG = {
191191
{ type: 'dns', tag: 'dns-out' }
192192
],
193193
route : {
194-
rules: [
195-
{ protocol: 'dns', port: 53, outbound: 'dns-out' },
196-
{ clash_mode: 'direct', outbound: 'DIRECT' },
197-
{ clash_mode: 'global', outbound: 'GLOBAL' },
198-
],
199-
auto_detect_interface: true,
200-
final: '🐟 漏网之鱼',
201-
rule_set: [
202-
...Object.entries(SITE_RULE_SETS).map(([tag, filename]) => ({
203-
tag,
204-
type: 'remote',
205-
format: 'binary',
206-
url: `${SITE_RULE_SET_BASE_URL}${filename}`,
207-
download_detour: '⚡ 自动选择'
208-
})),
209-
...Object.entries(IP_RULE_SETS).map(([tag, filename]) => ({
210-
tag: `${tag}-ip`,
211-
type: 'remote',
212-
format: 'binary',
213-
url: `${IP_RULE_SET_BASE_URL}${filename}`,
214-
download_detour: '⚡ 自动选择'
215-
}))
216-
]
217194
},
218195
experimental: {
219196
cache_file: {

0 commit comments

Comments
 (0)