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

[Feature request]: V6.24 tun 模式下能够显示 singbox 的实时日志 #3881

Closed
1 task done
yang05051 opened this issue May 19, 2023 · 20 comments
Closed
1 task done
Labels
enhancement New feature or request

Comments

@yang05051
Copy link

yang05051 commented May 19, 2023

相关问题

在 V6.24 版本中,开启 tun 模式后,软件的日志框内不会出现 singbox 的实时日志。希望在 tun 模式下能够显示 singbox 的实时日志。

描述你希望的解决方案

在 tun 模式下能够显示 singbox 的实时日志。

我确认已查询历史issues

@yang05051 yang05051 added the enhancement New feature or request label May 19, 2023
@2dust
Copy link
Owner

2dust commented May 21, 2023

日志等级是什么?
启动tun后是否正常使用?

@yang05051
Copy link
Author

日志等级是什么?
启动tun后是否正常使用?

日志等级是 Warning,启动 tun 模式后完全没有日志的输出

@2dust
Copy link
Owner

2dust commented Jun 4, 2023

把配置文件guiNconfig发出来

@yang05051
Copy link
Author

把配置文件guiNconfig发出来

晚一点发给您,我现在暂时没有电脑

还有我在 #3915 中回复您了,希望您能看一下我描述的场景

@yang05051
Copy link
Author

yang05051 commented Jun 5, 2023

把配置文件guiNconfig发出来

{
  "indexId": "5252147361131982400",
  "subIndexId": null,
  "sysProxyType": 0,
  "systemProxyExceptions": "",
  "systemProxyAdvancedProtocol": null,
  "coreBasicItem": {
    "logEnabled": false,
    "loglevel": "warning",
    "muxEnabled": false,
    "defAllowInsecure": false,
    "defFingerprint": "chrome",
    "defUserAgent": null
  },
  "tunModeItem": {
    "enableTun": true,
    "strictRoute": true,
    "stack": "gvisor",
    "mtu": 9000
  },
  "kcpItem": {
    "mtu": 1350,
    "tti": 50,
    "uplinkCapacity": 12,
    "downlinkCapacity": 100,
    "congestion": false,
    "readBufferSize": 2,
    "writeBufferSize": 2
  },
  "grpcItem": {
    "idle_timeout": 60,
    "health_check_timeout": 20,
    "permit_without_stream": false,
    "initial_windows_size": 0
  },
  "routingBasicItem": {
    "domainStrategy": "IPIfNonMatch",
    "domainStrategy4Singbox": "prefer_ipv6",
    "domainMatcher": "",
    "routingIndexId": "4984604804357993860",
    "enableRoutingAdvanced": true
  },
  "guiItem": {
    "autoRun": false,
    "enableStatistics": true,
    "statisticsFreshRate": 1,
    "keepOlderDedupl": false,
    "ignoreGeoUpdateCore": true,
    "autoUpdateInterval": 10,
    "checkPreReleaseUpdate": true,
    "enableSecurityProtocolTls13": true,
    "trayMenuServersLimit": 20,
    "enableHWA": false,
    "enableLog": true
  },
  "uiItem": {
    "enableAutoAdjustMainLvColWidth": true,
    "mainWidth": 1734.5,
    "mainHeight": 1104.5,
    "mainGirdHeight1": 457.0,
    "mainGirdHeight2": 457.0,
    "colorModeDark": true,
    "followSystemTheme": true,
    "colorPrimaryName": "lightblue",
    "currentLanguage": "en",
    "currentFontFamily": "Source Han Sans CN",
    "currentFontSize": 11,
    "enableDragDropSort": false,
    "doubleClick2Activate": false,
    "autoHideStartup": true,
    "mainMsgFilter": "",
    "showTrayTip": false,
    "mainColumnItem": [
      {
        "Name": "configType",
        "Width": 80,
        "Index": 0
      },
      {
        "Name": "remarks",
        "Width": 82,
        "Index": 1
      },
      {
        "Name": "address",
        "Width": 112,
        "Index": 2
      },
      {
        "Name": "port",
        "Width": 56,
        "Index": 3
      },
      {
        "Name": "security",
        "Width": 79,
        "Index": 4
      },
      {
        "Name": "network",
        "Width": 88,
        "Index": 5
      },
      {
        "Name": "streamSecurity",
        "Width": 53,
        "Index": 6
      },
      {
        "Name": "subRemarks",
        "Width": 97,
        "Index": 7
      },
      {
        "Name": "delayVal",
        "Width": 90,
        "Index": 8
      },
      {
        "Name": "speedVal",
        "Width": 318,
        "Index": 9
      },
      {
        "Name": "todayUp",
        "Width": 145,
        "Index": 10
      },
      {
        "Name": "todayDown",
        "Width": 162,
        "Index": 11
      },
      {
        "Name": "totalUp",
        "Width": 139,
        "Index": 12
      },
      {
        "Name": "totalDown",
        "Width": 156,
        "Index": 13
      }
    ]
  },
  "constItem": {
    "defIEProxyExceptions": "localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.*",
    "subConvertUrl": ""
  },
  "speedTestItem": {
    "speedTestTimeout": 10,
    "speedTestUrl": "http://cachefly.cachefly.net/100mb.test",
    "speedPingTestUrl": "https://www.google.com/generate_204"
  },
  "mux4Sbox": {
    "protocol": "h2mux",
    "max_connections": 4,
    "min_streams": 4,
    "max_streams": 0,
    "padding": true
  },
  "inbound": [
    {
      "localPort": 30808,
      "protocol": "socks",
      "udpEnabled": true,
      "sniffingEnabled": true,
      "routeOnly": false,
      "allowLANConn": true,
      "newPort4LAN": true,
      "user": "Daniel",
      "pass": "20031115468"
    }
  ],
  "globalHotkeys": [
    {
      "eGlobalHotkey": 0,
      "Alt": false,
      "Control": false,
      "Shift": false,
      "KeyCode": null
    },
    {
      "eGlobalHotkey": 1,
      "Alt": false,
      "Control": false,
      "Shift": false,
      "KeyCode": null
    },
    {
      "eGlobalHotkey": 2,
      "Alt": false,
      "Control": false,
      "Shift": false,
      "KeyCode": null
    },
    {
      "eGlobalHotkey": 3,
      "Alt": false,
      "Control": false,
      "Shift": false,
      "KeyCode": null
    },
    {
      "eGlobalHotkey": 4,
      "Alt": false,
      "Control": false,
      "Shift": false,
      "KeyCode": null
    }
  ],
  "coreTypeItem": [
    {
      "configType": 1,
      "coreType": 24
    },
    {
      "configType": 2,
      "coreType": 24
    },
    {
      "configType": 3,
      "coreType": 24
    },
    {
      "configType": 4,
      "coreType": 24
    },
    {
      "configType": 5,
      "coreType": 24
    },
    {
      "configType": 6,
      "coreType": 24
    }
  ]
}

@yang05051
Copy link
Author

把配置文件guiNconfig发出来

singbox 的错误日志可以实时显示

我观察了一下纯 singbox 的命令窗口,命令窗口似乎也没有实时域名解析日志,只有实时错误日志。所以这应该是 singbox 的问题。但我希望在tun模式下也能看到实时域名解析日志,大佬看看有没有什么解决办法

@chika0801
Copy link
Contributor

纯 singbox 的命令窗口 你能发个截图嘛?

指你在cmd下运行sing-box.exe加载配置?但是你用v2rayN如果是这样,就是手动运行Singbox。现在的版本并不会单独有cmd窗口出来了。要不你细说下了?》

@yang05051
Copy link
Author

yang05051 commented Jun 5, 2023

纯 singbox 的命令窗口 你能发个截图嘛?

指你在cmd下运行sing-box.exe加载配置?但是你用v2rayN如果是这样,就是手动运行Singbox。现在的版本并不会单独有cmd窗口出来了。要不你细说下了?》

我说的不太清楚,不好意思啊。

“纯 singbox 命令窗口”是在 cmd 下直接加载 singbox,此时v2rayN 没有运行。配置文件用的是 v2rayN 开启 tun 模式下生成的配置文件 config.json

我把 cmd 的输出和 v2rayN 的输出进行了比较,发现二者差不多,只输出实时错误信息,并没有实时域名解析日志。

之后我在配置文件指定了 singbox 的日志输出位置,并在 cmd 再次运行 singbox。发现在仍然不输出实时域名解析日志,只输出实时错误信息。之后我又把日志的级别改成了 debug,也是不输出实时的域名解析日志,只有实时的错误日志。

我发现停止 singbox 之后,指定的日志目录下生成的日志含有域名解析日志,所以 singbox 内核是有能力输出域名解析日志的,只是我们的配置没有让他实时输出出来。因此我个人认为,目前 singbox 配置文件中的日志模块存在一些问题。

我查看了 singbox 的官方文档,似乎没找到设置实时日志输出的模块(有可能是我看漏了)。麻烦大佬们看看如何能让 singbox 实时输出域名解析的日志,这样就能解决这个 issue 了。

@chika0801
Copy link
Contributor

那个作者要你的配置是指sing-box的配置。我看了你上面的发言,1是问下你

配置文件用的是 v2rayN 开启 tun 模式下生成的配置文件 config.json。

配置确定是TUN模式版本的吧。

你可以有空附上配置(也可以不)

因为sing-box无论在tun或http socks代理时 日志输出是没问题的。至于你的问题我们要看你的配置,你是在什么环境下用,看到东西才能给你分析。

需要你对sing-box在httpsocks代理或TUN(透明代理)环境 2种环境处理DNS流程配置你很熟悉的话。

sing-box文档没细讲。

我看sing-box日志如果要排查问题,我是用trace 这级别。我的经验记忆中sing-box的日志 如果用到了它内置DNS部分的DNS解析了都是有记录完整的。

@chika0801
Copy link
Contributor

chika0801 commented Jun 5, 2023

@2dust 大力使用sing-box后,真咨询量(人数)sing-box配置原理的,直线上升了,我目测了下你这比Xray sing-box群接到的量还多了

@yang05051
Copy link
Author

那个作者要你的配置是指sing-box的配置。我看了你上面的发言,1是问下你

配置文件用的是 v2rayN 开启 tun 模式下生成的配置文件 config.json。

配置确定是TUN模式版本的吧。

你可以有空附上配置(也可以不)

因为sing-box无论在tun或http socks代理时 日志输出是没问题的。至于你的问题我们要看你的配置,你是在什么环境下用,看到东西才能给你分析。

需要你对sing-box在httpsocks代理或TUN(透明代理)环境 2种环境处理DNS流程配置你很熟悉的话。

sing-box文档没细讲。

我看sing-box日志如果要排查问题,我是用trace 这级别。我的经验记忆中sing-box的日志 如果用到了它内置DNS部分的DNS解析了都是有记录完整的。

我今天晚些时候会把配置发过来,现在电脑不在身边

singbox会保存完整的DNS解析记录,但是在tun模式下目前并不能让他像Xray那样实时输出出来

我不清楚在httpsocks的模式下会不会实时输出解析记录,我晚一点会试一下。

如果实在没法让singbox内核在tun模式下实时输出解析日志,我会到singbox的仓库那边提issue

@yang05051
Copy link
Author

yang05051 commented Jun 7, 2023

那个作者要你的配置是指sing-box的配置。我看了你上面的发言,1是问下你

配置文件用的是 v2rayN 开启 tun 模式下生成的配置文件 config.json。

配置确定是TUN模式版本的吧。

你可以有空附上配置(也可以不)

因为sing-box无论在tun或http socks代理时 日志输出是没问题的。至于你的问题我们要看你的配置,你是在什么环境下用,看到东西才能给你分析。

需要你对sing-box在httpsocks代理或TUN(透明代理)环境 2种环境处理DNS流程配置你很熟悉的话。

sing-box文档没细讲。

我看sing-box日志如果要排查问题,我是用trace 这级别。我的经验记忆中sing-box的日志 如果用到了它内置DNS部分的DNS解析了都是有记录完整的。

{
  "log": {
    "disabled": false,
    "level": "debug",
    "output": "C:/path/to/box.log",
    "timestamp": true
  },
  "dns": {
    "servers": [
      {
        "tag": "remote",
        "address": "https://dns.cloudflare.com/dns-query",
        "address_resolver": "local_local",
        "detour": "proxy"
      },
      {
        "tag": "local",
        "address": "https://doh.pub/dns-query",
        "address_resolver": "local_local",
        "detour": "direct"
      },
      {
        "tag": "block",
        "address": "rcode://success"
      },
      {
        "tag": "local_local",
        "address": "223.5.5.5",
        "detour": "direct"
      }
    ],
    "rules": [
      {
        "server": "local",
        "disable_cache": true,
        "geosite": [
          "cn"
        ]
      },
      {
        "server": "block",
        "disable_cache": true,
        "geosite": [
          "category-ads-all"
        ]
      },
      {
        "outbound": "any",
        "server": "local_local"
      }
    ],
    "strategy": "prefer_ipv6"
  },
  "inbounds": [
    {
      "type": "tun",
      "tag": "tun-in",
      "interface_name": "singbox_tun",
      "inet4_address": "172.19.0.1/30",
      "inet6_address": "fc00::/18",
      "mtu": 9000,
      "auto_route": true,
      "strict_route": true,
      "stack": "gvisor",
      "sniff": true
    }
  ],
  "outbounds": [
    {
      "type": "vless",
      "tag": "proxy",
      "server": "SERVER_IP",
      "server_port": 443,
      "uuid": "UUID",
      "flow": "xtls-rprx-vision",
      "packet_encoding": "xudp",
      "tls": {
        "enabled": true,
        "server_name": "www.example.com",
        "insecure": false,
        "utls": {
          "enabled": true,
          "fingerprint": "chrome"
        }
      }
    },
    {
      "type": "direct",
      "tag": "direct"
    },
    {
      "type": "block",
      "tag": "block"
    },
    {
      "type": "dns",
      "tag": "dns_out"
    }
  ],
  "route": {
    "auto_detect_interface": true,
    "rules": [
      {
        "outbound": "dns_out",
        "inbound": [
          "dns_in"
        ]
      },
      {
        "outbound": "dns_out",
        "protocol": [
          "dns"
        ]
      },
      {
        "outbound": "block",
        "network": "udp",
        "port": [
          135,
          137,
          138,
          139,
          5353
        ]
      },
      {
        "outbound": "block",
        "ip_cidr": [
          "224.0.0.0/3",
          "ff00::/8"
        ]
      },
      {
        "outbound": "block",
        "source_ip_cidr": [
          "224.0.0.0/3",
          "ff00::/8"
        ]
      },
      {
        "outbound": "dns_out",
        "port": [
          53
        ],
        "process_name": [
          "wv2ray.exe",
          "v2ray.exe",
          "SagerNet.exe",
          "v2ray.exe",
          "v2ray.exe",
          "xray.exe",
          "wxray.exe",
          "clash-windows-amd64-v3.exe",
          "clash-windows-amd64.exe",
          "clash-windows-386.exe",
          "clash.exe",
          "Clash.Meta-windows-amd64-compatible.exe",
          "Clash.Meta-windows-amd64.exe",
          "Clash.Meta-windows-386.exe",
          "Clash.Meta.exe",
          "clash.exe",
          "hysteria-windows-amd64.exe",
          "hysteria-windows-386.exe",
          "hysteria.exe",
          "naiveproxy.exe",
          "naive.exe",
          "tuic-client.exe",
          "tuic.exe"
        ]
      },
      {
        "outbound": "direct",
        "process_name": [
          "wv2ray.exe",
          "v2ray.exe",
          "SagerNet.exe",
          "v2ray.exe",
          "v2ray.exe",
          "xray.exe",
          "wxray.exe",
          "clash-windows-amd64-v3.exe",
          "clash-windows-amd64.exe",
          "clash-windows-386.exe",
          "clash.exe",
          "Clash.Meta-windows-amd64-compatible.exe",
          "Clash.Meta-windows-amd64.exe",
          "Clash.Meta-windows-386.exe",
          "Clash.Meta.exe",
          "clash.exe",
          "hysteria-windows-amd64.exe",
          "hysteria-windows-386.exe",
          "hysteria.exe",
          "naiveproxy.exe",
          "naive.exe",
          "tuic-client.exe",
          "tuic.exe",
          "sing-box-client.exe",
          "sing-box.exe"
        ]
      },
      {
        "outbound": "block",
        "protocol": [
          "http",
          "tls"
        ],
        "geosite": [
          "category-ads-all"
        ]
      },
      {
        "outbound": "proxy",
        "protocol": [
          "http",
          "tls"
        ],
        "domain": [
          "moecats.cn"
        ],
        "domain_suffix": [
          ".moecats.cn"
        ]
      },
      {
        "outbound": "direct",
        "protocol": [
          "http",
          "tls"
        ],
        "domain": [
          "163.com",
          "360.com",
          "biliapi.net",
          "bilibili.com",
          "bilivideo.com",
          "binance.com",
          "cdntips.net",
          "e.huawei.com",
          "globalcash.hk",
          "huaweicloud.com",
          "huaweiuniversity.com",
          "iclass30",
          "ipip.net",
          "jianyujiasu.com",
          "kami.vip",
          "kuaifaka.net",
          "lecloud-pc.lenovo.com",
          "legionzone.lenovo.com",
          "lenovomm.com",
          "lestore.lenovo.com",
          "mini4k.com",
          "qq.com",
          "ruanmei.com",
          "sandsresortsmacao.com",
          "um.edu.mo",
          "uniportal.huawei.com",
          "wechat.com"
        ],
        "domain_suffix": [
          ".163.com",
          ".360.com",
          ".biliapi.net",
          ".bilibili.com",
          ".bilivideo.com",
          ".binance.com",
          ".cdntips.net",
          ".e.huawei.com",
          ".globalcash.hk",
          ".huaweicloud.com",
          ".huaweiuniversity.com",
          ".iclass30",
          ".ipip.net",
          ".jianyujiasu.com",
          ".kami.vip",
          ".kuaifaka.net",
          ".lecloud-pc.lenovo.com",
          ".legionzone.lenovo.com",
          ".lenovomm.com",
          ".lestore.lenovo.com",
          ".mini4k.com",
          ".qq.com",
          ".ruanmei.com",
          ".sandsresortsmacao.com",
          ".um.edu.mo",
          ".uniportal.huawei.com",
          ".wechat.com"
        ],
        "domain_regex": [
          "(.cn)",
          "(.zoom.)",
          "(afdian)",
          "(baidu)",
          "(baijiayun)",
          "(bmclapi)",
          "(coolapk)",
          "(csdn)",
          "(hmcl)",
          "(huangyuhui)",
          "(iqiyi)",
          "(ithome)",
          "(jianshu)",
          "(luogu)",
          "(mfood)",
          "(spartanhost)",
          "(talk915)",
          "(tencent)",
          "(vijos)",
          "(xuedianyun)",
          "(xunlei)",
          "(yuansouti)",
          "(zhengruioi)",
          "(zoom.)",
          "(zybang)"
        ]
      },
      {
        "outbound": "direct",
        "protocol": [
          "http",
          "tls"
        ],
        "geoip": [
          "private"
        ],
        "ip_cidr": [
          "1.0.0.1",
          "1.1.1.1"
        ]
      }
    ]
  }
}

@chika0801
Copy link
Contributor

你用上面的sb tun配置在WIN下用CMD窗口(要管理员权限打开) sb要管理员权限,运行试试

我日志级别是trace我没用输出到文件。这样观察到的。

@yang05051
Copy link
Author

yang05051 commented Jun 8, 2023

你用上面的sb tun配置在WIN下用CMD窗口(要管理员权限打开) sb要管理员权限,运行试试

我日志级别是trace我没用输出到文件。这样观察到的。

我设置的是 debug,可以在日志文件里面找到这样的的域名解析日志:

+0800 2023-06-08 20:53:32 DEBUG dns: exchange edge.microsoft.com. IN A
+0800 2023-06-08 20:53:32 DEBUG dns: exchange update.googleapis.com. IN A
+0800 2023-06-08 20:53:32 DEBUG dns: exchange update.googleapis.com. IN AAAA
+0800 2023-06-08 20:53:32 DEBUG dns: exchange substrate.office.com. IN AAAA
+0800 2023-06-08 20:53:32 DEBUG dns: exchange substrate.office.com. IN A
+0800 2023-06-08 20:53:32 DEBUG dns: exchange browser.pipe.aria.microsoft.com. IN AAAA
+0800 2023-06-08 20:53:32 DEBUG dns: cached browser.pipe.aria.microsoft.com NOERROR 48
+0800 2023-06-08 20:53:32 INFO dns: cached browser.pipe.aria.microsoft.com CNAME browser.pipe.aria.microsoft.com. 3526 IN CNAME browser.events.data.trafficmanager.net.
+0800 2023-06-08 20:53:32 INFO dns: cached browser.pipe.aria.microsoft.com CNAME browser.events.data.trafficmanager.net. 48 IN CNAME onedscolprdwus11.westus.cloudapp.azure.com.
+0800 2023-06-08 20:53:32 INFO dns: cached browser.pipe.aria.microsoft.com SOA westus.cloudapp.azure.com. 48 IN SOA ns1-02.azure-dns.com. msnhst.microsoft.com. 10001 900 300 604800 60
+0800 2023-06-08 20:53:32 INFO dns: exchanged browser.pipe.aria.microsoft.com. CNAME browser.pipe.aria.microsoft.com. 3526 IN CNAME browser.events.data.trafficmanager.net.
+0800 2023-06-08 20:53:32 INFO dns: exchanged browser.pipe.aria.microsoft.com. CNAME browser.events.data.trafficmanager.net. 48 IN CNAME onedscolprdwus11.westus.cloudapp.azure.com.
+0800 2023-06-08 20:53:32 INFO [4096014584 0ms] inbound/tun[tun-in]: inbound connection from 172.19.0.1:51076
+0800 2023-06-08 20:53:32 INFO [4096014584 0ms] inbound/tun[tun-in]: inbound connection to 52.168.117.169:443

@chika0801
Copy link
Contributor

这些日志是正常的。

@yang05051
Copy link
Author

yang05051 commented Jun 9, 2023

这些日志是正常的。

是的,但是这些东西没法像Xray那样实时输出出来。

@chika0801
Copy link
Contributor

你意思是你用cmd运行Sing-box这些日志能正常输出

你用v2rayN开TUN,这些日志在v2rayN的日志窗口没实时输出 ?

@yang05051
Copy link
Author

你意思是你用cmd运行Sing-box这些日志能正常输出

你用v2rayN开TUN,这些日志在v2rayN的日志窗口没实时输出 ?

之前说过啊,两种情况下都没法正常输出

所以我想请求各位大佬看看如何配置,才能让singbox实时输出出来

@chika0801
Copy link
Contributor

你意思是你用cmd运行Sing-box这些日志能正常输出
你用v2rayN开TUN,这些日志在v2rayN的日志窗口没实时输出 ?

之前说过啊,两种情况下都没法正常输出

所以我想请求各位大佬看看如何配置,才能让singbox实时输出出来

#3881 (comment)

我看你这句话理解就是你

#3881 (comment)

@danta926
Copy link

你意思是你用cmd运行Sing-box这些日志能正常输出
你用v2rayN开TUN,这些日志在v2rayN的日志窗口没实时输出 ?

之前说过啊,两种情况下都没法正常输出

所以我想请求各位大佬看看如何配置,才能让singbox实时输出出来

配置文件不要写日志路径.官方文档有说明:配置了路径控制台就不会显示

@2dust 2dust closed this as completed Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants