是否考虑保留原配置文件运行
测了一下不论是远程或者本地导入完整sing-box完整配置文件都被改的只剩节点。 是否可以保留原配置文件的DNS服务器、规则及路由规则运行
进入开发者选项页面-打开日志-配置模板
模板内容请参考 https://github.com/OneOhCloud/conf-template/tree/beta/conf/1.12/zh-cn
感谢回复,前几天和刚刚用最新稳定版试了一下都不可以。 主要试了[mixed-rules]版 按照说明只修改能修改的(如dns地址,可修改部分规则等),其余不动;都不能按原文件执行,都是被改的只剩节点 1、作为本地配置文件添加执行。 2、放到服务器上作为订阅配置文件添加执行。 另外按照说明修改模板放到服务器上修改软件模板地址做为远程模板无法加载。
提供脱敏后的模板内容
{ "log": { "disabled": false, "level": "debug", "timestamp": false }, "dns": { "servers": [ { "tag": "system", // 🚫 禁止修改 tag 名称 "type": "udp", "server": "223.5.5.5", "server_port": 53, "connect_timeout": "5s" }, { "tag": "dns_proxy", // 🚫 禁止修改 tag 名称 "type": "tcp", "server": "8.8.8.8", "server_port": 53, "detour": "ExitGateway", "connect_timeout": "5s" } ], "rules": [ { "query_type": [ "SVCB", "HTTPS" ], "action": "reject" }, { "domain_suffix": [ "x.x", ".oneoh.cloud" ], "server": "system" }, { "rule_set": [ "apple", "cn-site" ], "server": "system" }, { "rule_set": [ "apple", "cn-site" ], "invert": true, "server": "dns_proxy" } ], "final": "system", // 🚫 禁止修改 "strategy": "prefer_ipv4", "independent_cache": true }, "inbounds": [ { "tag": "mixed", "type": "mixed", "listen": "127.0.0.1", "listen_port": 6789, // 🚫 禁止修改 "reuse_addr": true, "tcp_fast_open": true, "set_system_proxy": false // 🚫 禁止修改 } ], "route": { "rules": [ // 不可更改区域开始 { "action": "sniff" }, { "type": "logical", "mode": "or", "rules": [ { "protocol": "dns" }, { "port": 53 } ], "action": "hijack-dns" }, { "protocol": "quic", "action": "reject" }, { "ip_is_private": true, "outbound": "direct" }, { "domain": [ "direct-tag.oneoh.cloud" ], "domain_suffix": [], "ip_cidr": [], "outbound": "direct" }, { "domain": [ "proxy-tag.oneoh.cloud" ], "domain_suffix": [], "ip_cidr": [], "outbound": "ExitGateway" }, // 不可更改区域结束 { "rule_set": [ "cn-ip", "apple", "cn-site" ], "outbound": "direct" } ], "final": "ExitGateway", // 🚫 禁止修改 "auto_detect_interface": true, "rule_set": [ { "tag": "apple", "type": "remote", "format": "binary", "url": "https://x.x/apple.srs", "download_detour": "direct" }, { "tag": "cn-ip", "type": "remote", "format": "binary", "url": "https://x.x/cn-ip.srs", "download_detour": "direct" }, { "tag": "cn-site", "type": "remote", "format": "binary", "url": "https://x.x/cn-site.srs", "download_detour": "direct" } ] }, "experimental": { "clash_api": {}, // 此字段将被忽略 "cache_file": {} // 此字段将被忽略 }, // ------------------ Outbounds ------------------ // OneBox 会自动追加远程配置或者本地配置内容中的服务节点 // 到 outbounds 以及 ExitGateway["outbounds"] 和 auto["outbounds"] 中 // 如果需要添加自定义的出站,可以在此处添加,但请不要有重复的 tag 名称以及修改以下三个出站的 tag 名称 // 记住一个修改原则:只追加,不修改,不删除,不重复 "outbounds": [ { "tag": "direct", "type": "direct", "domain_resolver": "system" }, { "tag": "ExitGateway", "type": "selector", "outbounds": [ "auto" ], "interrupt_exist_connections": true }, { "tag": "auto", "type": "urltest", "url": "http://www.google.com/generate_204", "outbounds": [] } ] } 修改后的模板 执行配置文件只是加入了节点和去除注释,并且节点中已加入"domain_resolver": "system"处理解析节点域名解析dns 其余试了dns不同类型(如tcp、udp、DoH等)都是一样的结果,哪怕把执行的配置文件复制只修改dns地址也不行,最终都会被修改的只剩节点 保证配置文件符合sing-box1.12.X版本规范,使用官方客户端或纯内核可执行;https://x.x/apple.srs中的域名不是实际域名,但保证直连能正常下载srs
是否可以考虑只修改配置文件中的inbounds模块tun和系统代理部分来适配(虚拟网卡)和(系统代理)模式,以及追加clash_api等需要的字段而保持其余配置。 全局模式可以考虑使用clash_mode来实现。
无法复现,特殊需求请使用 sing-box 官方的 GUI 或者第三方客户端。