From 88adcc7c9a01b57e68689da523b384bb11bc5954 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Sat, 11 Jan 2025 11:24:45 +0100 Subject: [PATCH] update default config --- backend/service/setting.go | 3 +-- backend/sub/jsonService.go | 10 --------- frontend/src/components/SubJsonExt.vue | 30 ++++++++++++-------------- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/backend/service/setting.go b/backend/service/setting.go index 3a35533..7a58be7 100644 --- a/backend/service/setting.go +++ b/backend/service/setting.go @@ -26,8 +26,7 @@ var defaultConfig = `{ "protocol": [ "dns" ], - "outbound": "dns-out", - "action": "route" + "action": "hijack-dns" } ] }, diff --git a/backend/sub/jsonService.go b/backend/sub/jsonService.go index 496f8d7..f2c4fbe 100644 --- a/backend/sub/jsonService.go +++ b/backend/sub/jsonService.go @@ -21,7 +21,6 @@ const defaultJson = ` "mtu": 9000, "auto_route": true, "strict_route": false, - "sniff": true, "endpoint_independent_nat": false, "stack": "system", "platform": { @@ -36,7 +35,6 @@ const defaultJson = ` "type": "mixed", "listen": "127.0.0.1", "listen_port": 2080, - "sniff": true, "users": [] } ] @@ -204,14 +202,6 @@ func (j *JsonService) addDefaultOutbounds(outbounds *[]map[string]interface{}, o "type": "direct", "tag": "direct", }, - { - "type": "dns", - "tag": "dns-out", - }, - { - "type": "block", - "tag": "block", - }, } *outbounds = append(outbound, *outbounds...) } diff --git a/frontend/src/components/SubJsonExt.vue b/frontend/src/components/SubJsonExt.vue index 489924a..c74c19b 100644 --- a/frontend/src/components/SubJsonExt.vue +++ b/frontend/src/components/SubJsonExt.vue @@ -153,7 +153,6 @@ export default { "mtu": 9000, "auto_route": true, "strict_route": false, - "sniff": true, "endpoint_independent_nat": false, "stack": "system", "exclude_package": [], @@ -169,7 +168,6 @@ export default { "type": "mixed", "listen": "127.0.0.1", "listen_port": 2080, - "sniff": true, "users": [] } ], @@ -199,24 +197,24 @@ export default { "tag": "local-dns", "address": "local", "detour": "direct" - }, - { - "address": "rcode://success", - "tag": "block" } ], "rules": [ { "clash_mode": "Global", "source_ip_cidr": [ - "172.19.0.0/30" + "172.19.0.0/30", + "fdfe:dcba:9876::1/126" ], + "action": "route", "server": "proxy-dns" }, { "source_ip_cidr": [ - "172.19.0.0/30" + "172.19.0.0/30", + "fdfe:dcba:9876::1/126" ], + "action": "route", "server": "proxy-dns" } ], @@ -319,10 +317,10 @@ export default { if (v) { this.subJsonExt.dns = this.defaultDns if (this.rules == undefined) this.subJsonExt.rules = [] - this.subJsonExt.rules.unshift({ protocol: "dns", outbound: "dns-out" }) + this.subJsonExt.rules.unshift({ protocol: "dns", action: "hijack-dns" }) } else { delete this.subJsonExt.dns - const ruleDnsIndex = this.subJsonExt?.rules?.findIndex((r:any) => r.protocol == "dns" && r.outbound == "dns-out") + const ruleDnsIndex = this.subJsonExt?.rules?.findIndex((r:any) => r.protocol == "dns" && r.action == "hijack-dns") if (ruleDnsIndex >= 0) this.subJsonExt.rules.splice(ruleDnsIndex,1) if (this.rules.length == 0) delete this.subJsonExt.rules } @@ -348,7 +346,7 @@ export default { if (v?.length>0) { if (sIndex === -1) { this.dns.servers.push({ tag: "direct-dns", address: v, detour: "direct" }) - this.dns.rules.push({ clash_mode: "Direct", server: "direct-dns" }) + this.dns.rules.push({ clash_mode: "Direct", action: "route", server: "direct-dns" }) } else { this.dns.servers[sIndex].address = v } @@ -369,7 +367,7 @@ export default { if (ruleIndex >= 0){ this.dns.rules[ruleIndex].rule_set = v } else { - this.dns.rules.push({ rule_set: v, server: "direct-dns" }) + this.dns.rules.push({ rule_set: v, action: "route", server: "direct-dns" }) } } else { if (ruleIndex != -1) this.dns.rules.splice(ruleIndex,1) @@ -395,7 +393,7 @@ export default { this.rules[ruleIndex].rule_set = v } else { if (this.rules == undefined) this.subJsonExt.rules = [] - this.rules.push({ rule_set: v, outbound: "direct" }) + this.rules.push({ rule_set: v, action: "route", outbound: "direct" }) } } else { if (ruleIndex != -1) this.rules.splice(ruleIndex,1) @@ -405,17 +403,17 @@ export default { }, ruleToBlock: { get() :string[] { - const ruleIndex = this.rules?.findIndex((r:any) => r.outbound == "block" && Object.hasOwn(r,'rule_set')) + const ruleIndex = this.rules?.findIndex((r:any) => r.action == "reject" && Object.hasOwn(r,'rule_set')) return ruleIndex >= 0 ? this.rules[ruleIndex].rule_set : [] }, set(v:string[]) { - const ruleIndex = this.rules?.findIndex((r:any) => r.outbound == "block" && Object.hasOwn(r,'rule_set')) + const ruleIndex = this.rules?.findIndex((r:any) => r.action == "reject" && Object.hasOwn(r,'rule_set')) if (v.length>0) { if (ruleIndex >= 0){ this.rules[ruleIndex].rule_set = v } else { if (this.rules == undefined) this.subJsonExt.rules = [] - this.rules.push({ rule_set: v, outbound: "block" }) + this.rules.push({ rule_set: v, action: "reject" }) } } else { if (ruleIndex != -1) this.rules.splice(ruleIndex,1)