Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 生成sing-box配置中,路由规则 { "protocol": "dns", "outbound": "dns-out" }应放在第一条 #767

Open
2 tasks done
fengted opened this issue Jul 17, 2024 · 0 comments

Comments

@fengted
Copy link

fengted commented Jul 17, 2024

确认版本最新

  • 我已经确认在最新Action编译的版本中复现

检索issue

  • 我已经确认之前没有issue涉及此BUG

subconverter版本

v0.9.0

转换过程

clash转换为singbox配置

转换设置

"clash_mode": "Global"
"clash_mode": "Direct"

复现步骤

默认配置下,singbox配置生成会添加clash mode相关内容,其中singbox路由规则生成时,先生成了clash_mode Global、Direct规则,随后生成protocol dns规则代码。如下:

     "route":
    {
        "rules":
        [
            {
                "clash_mode": "Global",
                "outbound": "GLOBAL"
            },
            {
                "clash_mode": "Direct",
                "outbound": "DIRECT"
            },
            {
                "protocol": "dns",
                "outbound": "dns-out"
            },

singbox客户端运行时:
在 Rule 模式下,这样的配置dns解析正常。
在Direct | Global 模式下,这样的配置会导致dns解析不能正确路由。

修复方法:将dns路由规则放在第一条。

auto dns_object = buildObject(allocator, "protocol", "dns", "outbound", "dns-out");
rules.PushBack(dns_object, allocator);

这两行代码调整位置即可。(:534)

期望结果

singbox路由规则前三条应为:

    "route":
    {
        "rules":
        [
            {
                "protocol": "dns",
                "outbound": "dns-out"
            },
            {
                "clash_mode": "Global",
                "outbound": "GLOBAL"
            },
            {
                "clash_mode": "Direct",
                "outbound": "DIRECT"
            },

实际结果

目前版本(v0.9.0)singbox路由规则前三条实际为:

     "route":
    {
        "rules":
        [
            {
                "clash_mode": "Global",
                "outbound": "GLOBAL"
            },
            {
                "clash_mode": "Direct",
                "outbound": "DIRECT"
            },
            {
                "protocol": "dns",
                "outbound": "dns-out"
            },

错误信息

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant