naive作为outbound有严重的性能瓶颈
操作系统
Windows
系统版本
Windows 11 25H2 26200.7840
安装类型
sing-box 原始命令行程序
如果您使用图形客户端程序,请提供该程序版本。
No response
版本
sing-box version 1.13.0
Environment: go1.26.0 windows/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,with_naive_outbound,with_purego,badlinkname,tfogo_checklinkname0
CGO: disabled
描述
我原来是使用naive官方客户端 + sing-box(socks转发)这种组合来使用naiveproxy。1.13.0正式发布后我尝试使用naive outbound来代替原本的naive客户端,只保留sing-box。但是我发现这种方案有严重的性能问题,会导致网速大幅度下降,fast.com上的测速最高只有1Mpbs,而原来的方案最高150Mpbs。我无法确定具体原因,但是仅更换了outbound的实现方式就导致网速出现断崖式下降,我怀疑是sing-box的问题。
重现方式
下面是我目前使用的配置,搬瓦工对应原来的方案(naive+singbox),而搬瓦工2就是使用naive outbound。
直接只用./sing-box.exe run -c ./config.json启动即可
{
"log": {
"disabled": false,
"level": "info",
"output": "NUL",
"timestamp": true
},
"experimental": {
"clash_api": {
"external_controller": "127.0.0.1:9090",
"external_ui": ".\\zashboard",
"secret": "password",
"default_mode": "rule"
},
"cache_file": {
"enabled": true
}
},
"dns": {
"servers": [
{
"tag": "dns_tencent",
"type": "udp",
"server": "119.29.29.29"
},
{
"tag": "dns_quad9",
"type": "tcp",
"server": "9.9.9.11",
"detour": "select"
}
],
"rules": [
{
"inbound": [
"direct-only-v4"
],
"server": "dns_tencent"
},
{
"rule_set": [
"geosite-private",
"geosite-microsoft-cn",
"geosite-apple-cn",
"geosite-google-cn",
"geosite-games-cn",
"geosite-cn",
"geosite-jetbrains-cn",
"geosite-steam-cn"
],
"domain_suffix": [
"ping.archlinux.org",
"download.jetbrains.com",
"download-cdn.jetbrains.com",
"ustclug.org",
"steamserver.net"
],
"domain": [
"steamcdn-a.akamaihd.net"
],
"server": "dns_tencent"
},
{
"type": "logical",
"mode": "and",
"rules": [
{
"rule_set": [
"geosite-geolocation-!cn"
],
"invert": true
},
{
"rule_set": "geoip-cn"
}
],
"server": "dns_quad9",
"client_subnet": "202.96.134.133"
},
{
"query_type": [
"A",
"AAAA"
],
"server": "dns_quad9"
}
],
"final": "dns_tencent",
"disable_cache": false,
"disable_expire": false,
"cache_capacity": 2048
},
"inbounds": [
{
"type": "mixed",
"tag": "direct-only-v4",
"listen": "127.0.0.1",
"listen_port": 30000
},
{
"type": "mixed",
"tag": "mixed-in-v4",
"listen": "0.0.0.0",
"listen_port": 7890
}
],
"outbounds": [
{
"type": "selector",
"tag": "select",
"outbounds": [
"direct",
"搬瓦工",
"搬瓦工2"
],
"default": "direct"
},
{
"type": "socks",
"tag": "搬瓦工",
"server": "127.0.0.1",
"server_port": 2080,
"network": "tcp"
},
{
"type": "naive",
"tag": "搬瓦工2",
"server": "xx",
"server_port": 443,
"username": "xx",
"password": "xx",
"tls": {
"enabled": true
}
},
{
"type": "direct",
"tag": "direct"
}
],
"route": {
"rules": [
{
"action": "sniff"
},
{
"protocol": "dns",
"action": "hijack-dns"
},
{
"rule_set": [
"geosite-pcdn_DDCHlsq",
"geosite-httpdns_DDCHlsq"
],
"action": "reject"
},
{
"network": "udp",
"outbound": "direct"
},
{
"inbound": [
"direct-only-v4"
],
"outbound": "direct"
},
{
"clash_mode": "direct",
"outbound": "direct"
},
{
"clash_mode": "global",
"outbound": "select"
},
{
"domain_suffix": [
"suse.org.cn",
"xiaomi.eu"
],
"outbound": "select"
},
{
"rule_set": [
"geosite-private",
"geosite-microsoft-cn",
"geosite-apple-cn",
"geosite-google-cn",
"geosite-games-cn",
"geosite-cn",
"geosite-jetbrains-cn",
"geosite-steam-cn",
"geosite-category-public-tracker"
],
"outbound": "direct"
},
{
"domain_suffix": [
"download.jetbrains.com",
"download-cdn.jetbrains.com",
"ustclug.org",
"steamserver.net"
],
"domain": [
"steamcdn-a.akamaihd.net"
],
"outbound": "direct"
},
{
"domain_suffix": [
"digiket.com",
"digiket.net"
],
"outbound": "VMISS日本"
},
{
"rule_set": [
"geosite-geolocation-!cn",
"geosite-bytedance-!cn",
"geosite-tiktok"
],
"outbound": "select"
},
{
"rule_set": "geoip-cn",
"outbound": "direct"
},
{
"ip_is_private": true,
"outbound": "direct"
}
],
"rule_set": [
{
"tag": "geosite-microsoft-cn",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\geosite\\[email protected]"
},
{
"tag": "geosite-apple-cn",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\geosite\\geosite-apple-cn.srs"
},
{
"tag": "geosite-google-cn",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\geosite\\geosite-google-cn.srs"
},
{
"tag": "geosite-games-cn",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\geosite\\[email protected]"
},
{
"tag": "geoip-cn",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\geoip\\geoip-cn.srs"
},
{
"tag": "geosite-cn",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\geosite\\geosite-cn.srs"
},
{
"tag": "geosite-geolocation-!cn",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\geosite\\geosite-geolocation-!cn.srs"
},
{
"tag": "geosite-bytedance-!cn",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\geosite\\geosite-bytedance@!cn.srs"
},
{
"tag": "geosite-tiktok",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\geosite\\geosite-tiktok.srs"
},
{
"tag": "geosite-private",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\geosite\\geosite-private.srs"
},
{
"tag": "geosite-jetbrains-cn",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\geosite\\[email protected]"
},
{
"tag": "geosite-openai",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\geosite\\geosite-openai.srs"
},
{
"tag": "geosite-steam-cn",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\geosite\\[email protected]"
},
{
"tag": "geosite-category-public-tracker",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\geosite\\geosite-category-public-tracker.srs"
},
{
"tag": "geosite-httpdns_DDCHlsq",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\DDCHlsq\\httpdns.srs"
},
{
"tag": "geosite-pcdn_DDCHlsq",
"type": "local",
"format": "binary",
"path": ".\\ruleset\\DDCHlsq\\pcdn.srs"
}
],
"final": "select",
"default_domain_resolver": "dns_tencent"
}
}
日志
支持我们
- [ ] 我已经 赞助
完整性要求
- [x] 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
- [x] 我保证提供了可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件。
- [x] 我保证提供了可用于重现我报告的错误的最简配置,而不是依赖远程服务器、TUN、图形界面客户端或者其他闭源软件。
- [x] 我保证提供了完整的配置文件与日志,而不是出于对自身智力的自信而仅提供了部分认为有用的部分。
请提供最小可复现配置。
同样的情况 延迟和网速都明显比使用原生的naive差好多
要开起quic true,另外这个本来就是为来安全的,速度还是得hy2才行
要开起quic true,另外这个本来就是为来安全的,速度还是得hy2才行
quic true和false是两个节点 都测试过 确实比原本的慢很多
下面是目前我能确认的最小复现配置
{
"log": {
"disabled": false,
"level": "info",
"output": "NUL",
"timestamp": true
},
"experimental": {
"clash_api": {
"external_controller": "127.0.0.1:9090",
"external_ui": ".\\zashboard",
"secret": "password",
"default_mode": "rule"
},
"cache_file": {
"enabled": true
}
},
"dns": {
"servers": [
{
"tag": "dns_tencent",
"type": "udp",
"server": "119.29.29.29"
}
],
"final": "dns_tencent",
"disable_cache": false,
"disable_expire": false,
"cache_capacity": 2048
},
"inbounds": [
{
"type": "mixed",
"tag": "mixed-in-v4",
"listen": "0.0.0.0",
"listen_port": 7890
}
],
"outbounds": [
{
"type": "selector",
"tag": "select",
"outbounds": [
"direct",
"搬瓦工",
"搬瓦工2"
],
"default": "direct"
},
{
"type": "socks",
"tag": "搬瓦工",
"server": "127.0.0.1",
"server_port": 2080,
"network": "tcp"
},
{
"type": "naive",
"tag": "搬瓦工2",
"server": "xxxx",
"server_port": 443,
"username": "xx",
"password": "xx",
"tls": {
"enabled": true
}
},
{
"type": "direct",
"tag": "direct"
}
],
"route": {
"rules": [
{
"action": "sniff"
},
{
"protocol": "dns",
"action": "hijack-dns"
},
{
"network": "udp",
"outbound": "direct"
},
{
"clash_mode": "direct",
"outbound": "direct"
},
{
"clash_mode": "global",
"outbound": "select"
},
{
"ip_is_private": true,
"outbound": "direct"
}
],
"rule_set": [],
"final": "select",
"default_domain_resolver": "dns_tencent"
}
}
1.13.1版本和最新的libcronet.dll仍然存在改问题。