sing-box icon indicating copy to clipboard operation
sing-box copied to clipboard

tls 字段缺少 enabled: true 时会直接崩溃

Open Utaea opened this issue 1 year ago • 2 comments

操作系统

macOS

系统版本

15.6.1

安装类型

sing-box for macOS 图形客户端程序

如果您使用图形客户端程序,请提供该程序版本。

版本1.13.0-alpha.16 (1)

版本


描述

使用如下配置启动 sfm 会直接崩溃,在 tls 中添加 enabled: true 之后不会崩溃。

重现方式

{
  "outbounds": [
    {
      "tag": "test",
      "type": "trojan",
      "server": "example.com",
      "server_port": 443,
      "password": "test",
      "tls": {
        "server_name": "google.com",
        "alpn": [
          "h2",
          "http/1.1"
        ]
      }
    }
  ],
  "route": {
    "rules": [
      {
        "action": "route",
        "outbound": "test"
      }
    ]
  },
  "log": {
    "disabled": false,
    "level": "debug"
  },
  "inbounds": [
    {
      "type": "tun",
      "address": [
        "172.19.0.1/30"
      ],
      "auto_route": true,
      "strict_route": true
    }
  ]
}

日志

Machine: arm64
System: macOS 版本15.6.1(版号24G90)

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x108955708]

goroutine 3067 [running]:
github.com/sagernet/sing/common/tls.ClientHandshake({0x10984f820, 0x14000bd0bd0}, {0x109859258?, 0x140003194d0?}, {0x0?, 0x0?})
	github.com/sagernet/[email protected]/common/tls/config.go:57 +0x58
github.com/sagernet/sing-box/common/tls.ClientHandshake({0x10984f778?, 0x14000fe3dd0?}, {0x109859258, 0x140003194d0}, {0x0, 0x0})
	github.com/sagernet/sing-box/common/tls/client.go:75 +0x74
github.com/sagernet/sing-box/common/tls.(*defaultDialer).dialContext(0x140002660e0, {0x10984f778, 0x14000fe3dd0}, {{{0x0, 0x0}, {0x0}}, 0x1bb, {0x140002d4760, 0xb}}, 0x1)
	github.com/sagernet/sing-box/common/tls/client.go:122 +0x98
github.com/sagernet/sing-box/common/tls.(*defaultDialer).DialTLSContext(0x10984f778?, {0x10984f778?, 0x14000fe3dd0?}, {{{0x0, 0x0}, {0x0}}, 0x1bb, {0x140002d4760, 0xb}})
	github.com/sagernet/sing-box/common/tls/client.go:114 +0x3c
github.com/sagernet/sing-box/protocol/trojan.(*trojanDialer).DialContext(0x1400014c5a0, {0x10984f778?, 0x14000fe3d40?}, {0x10912110d, 0x3}, {{{0x0, 0xffffac130002}, {0x1400000e1f8}}, 0x35, {0x0, ...}})
	github.com/sagernet/sing-box/protocol/trojan/outbound.go:134 +0x120
github.com/sagernet/sing-box/protocol/trojan.(*trojanDialer).ListenPacket(...)
	github.com/sagernet/sing-box/protocol/trojan/outbound.go:153
github.com/sagernet/sing-box/protocol/trojan.(*Outbound).ListenPacket(0x1400014c5a0, {0x10984f778, 0x14000fe3d40}, {{{0x0, 0xffffac130002}, {0x1400000e1f8}}, 0x35, {0x0, 0x0}})
	github.com/sagernet/sing-box/protocol/trojan/outbound.go:103 +0x1b4
github.com/sagernet/sing-box/route.(*ConnectionManager).NewPacketConnection(_, {_, _}, {_, _}, {_, _}, {{0x10915d39e, 0x1}, {0x109121194, ...}, ...}, ...)
	github.com/sagernet/sing-box/route/conn.go:161 +0x17c
github.com/sagernet/sing-box/route.(*Router).routePacketConnection(_, {_, _}, {_, _}, {{0x10915d39e, 0x1}, {0x109121194, 0x3}, 0x0, ...}, ...)
	github.com/sagernet/sing-box/route/route.go:265 +0xc70
github.com/sagernet/sing-box/route.(*Router).RoutePacketConnectionEx(_, {_, _}, {_, _}, {{0x10915d39e, 0x1}, {0x109121194, 0x3}, 0x0, ...}, ...)
	github.com/sagernet/sing-box/route/route.go:174 +0x58
github.com/sagernet/sing-box/protocol/tun.(*Inbound).NewPacketConnectionEx(0x14001880008, {0x10984f7b0?, 0x140004d4320?}, {0x109858230, 0x14000a8e000}, {{{0x0, 0xffffac130001}, {0x1400000e1f8}}, 0xdfb1, {0x0, ...}}, ...)
	github.com/sagernet/sing-box/protocol/tun/inbound.go:507 +0x260
created by github.com/sagernet/sing/common/udpnat2.(*Service).NewPacket.func1 in goroutine 3107
	github.com/sagernet/[email protected]/common/udpnat2/service.go:67 +0x2c0

支持我们

完整性要求

  • [x] 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • [x] 我保证提供了可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件。
  • [x] 我保证提供了可用于重现我报告的错误的最简配置,而不是依赖远程服务器、TUN、图形界面客户端或者其他闭源软件。
  • [x] 我保证提供了完整的配置文件与日志,而不是出于对自身智力的自信而仅提供了部分认为有用的部分。

Utaea avatar Sep 20 '25 17:09 Utaea

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Nov 20 '25 02:11 github-actions[bot]

there is pending PR

Utaea avatar Nov 23 '25 00:11 Utaea