SagerNet / sing-box

The universal proxy platform
https://sing-box.sagernet.org/
Other
18.57k stars 2.22k forks source link

panic when use vless + xtls-rprx-vision #453

Closed everyx closed 1 year ago

everyx commented 1 year ago

Welcome

Description of the problem

When I use vless with xtls-rprx-vision flow, I get panic on the server, and client get connection refused.

Version of sing-box

server ```console $ sing-box version Environment: go1.20.2 linux/amd64 Tags: with_quic,with_wireguard,with_acme,with_utls,with_reality_server,with_clash_api Revision: ce6d18634525e5c74cfb8d73c06d6de2dc35ad5f CGO: disabled ```
client ```console sing-box version v1.2-beta9 Environment: go1.20.2 linux/amd64 Tags: with_gvisor,with_quic,with_wireguard,with_utls,with_reality_server,with_clash_api Revision: 74dffdd85a115babd2f58f011bb73d035d524323 CGO: enabled ```

Server and client configuration file

server config ```console { "log": { "level": "warn", "timestamp": false }, "inbounds": [ { "type": "vless", "tag": "vless-in", "listen": "::", "listen_port": 443, "sniff": true, "sniff_override_destination": true, "domain_strategy": "ipv4_only", "users": [ { "uuid": "fa12384f-e353-45b0-8fe2-c2c5aaf6628e", "flow": "xtls-rprx-vision" } ], "tls": { "enabled": true, "certificate_path": "/fullchain.pem", "key_path": "/privkey.pem" } } ], "outbounds": [ { "tag": "direct", "type": "direct" } ] } ```
client config ```console { "inbounds": [ { "type": "mixed", "listen": "::", "listen_port": 1080 } ], "outbounds": [ { "tag": "awssg(vless)", "type": "vless", "server": "xx.sub.mydomain.com", "server_port": 443, "uuid": "fa12384f-e353-45b0-8fe2-c2c5aaf6628e", "flow": "xtls-rprx-vision", "tls": { "enabled": true, "min_version": "1.3" } } ] } ```

Server and client log file

server log ```console tools_sing-box-worker.0.pqvvmanfn7hn@awssg | panic: buffer overflow: cap 32768,end 32768, need 247 tools_sing-box-worker.0.pqvvmanfn7hn@awssg | goroutine 102 [running]: tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing/common/buf.(*Buffer).Extend(0xc0002cedb0, 0xf7) tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing@v0.1.9-0.20230317044231-85a9429eadb6/common/buf/buffer.go:117 +0x199 tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing-box/transport/vless.(*VisionConn).padding(0xc000001e00, 0xc0002ced20, 0x1) tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing-box/transport/vless/vision.go:299 +0x488 tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing-box/transport/vless.(*VisionConn).Write(0xc000001e00, {0xc0004f8000?, 0x8000, 0x8000?}) tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing-box/transport/vless/vision.go:195 +0x31b tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing-box/transport/vless.(*serverConn).Write(0xc000466a50?, {0xc0004f8000?, 0xc000238c30?, 0x81917d?}) tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing-box/transport/vless/service.go:134 +0xc5 tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing/common/bufio.(*ExtendedWriterWrapper).WriteBuffer(0xe7bd60?, 0xc000467710?) tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing@v0.1.9-0.20230317044231-85a9429eadb6/common/bufio/conn.go:180 +0x93 tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing/common/bufio.CopyExtendedBuffer({0x10da780?, 0xc000166d80}, {0x10da758, 0xc000166d90}, 0xc0002c7d88) tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing@v0.1.9-0.20230317044231-85a9429eadb6/common/bufio/copy.go:121 +0x206 tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing/common/bufio.CopyExtended({0x10da780?, 0xc000166d80}, {0x10da758?, 0xc000166d90}) tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing@v0.1.9-0.20230317044231-85a9429eadb6/common/bufio/copy.go:99 +0x2c5 tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing/common/bufio.Copy({0x7f348fac0078, 0xc000010948}, {0x10d5980?, 0xc000012660?}) tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing@v0.1.9-0.20230317044231-85a9429eadb6/common/bufio/copy.go:75 +0x394 tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing/common/bufio.CopyConn.func4({0xc0002c5f18?, 0xc0002c5fd0?}) tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing@v0.1.9-0.20230317044231-85a9429eadb6/common/bufio/copy.go:218 +0xc9 tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing/common/task.(*Group).Run.func1() tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing@v0.1.9-0.20230317044231-85a9429eadb6/common/task/task.go:59 +0x93 tools_sing-box-worker.0.pqvvmanfn7hn@awssg | created by github.com/sagernet/sing/common/task.(*Group).Run tools_sing-box-worker.0.pqvvmanfn7hn@awssg | github.com/sagernet/sing@v0.1.9-0.20230317044231-85a9429eadb6/common/task/task.go:58 +0x225 ```
client log ```console Mar 18 22:41:36 Arch systemd[1]: Started sing-box service. Mar 18 22:41:57 Arch sing-box[115113]: ERROR[0020] [1882335306] inbound/mixed[0]: process connection from 127.0.0.1:43466: dial tcp 3.0.71.95:443: connect: connection refused Mar 18 22:41:57 Arch sing-box[115113]: ERROR[0021] [2724245529] inbound/mixed[0]: process connection from 127.0.0.1:43482: dial tcp 3.0.71.95:443: connect: connection refused Mar 18 22:41:58 Arch sing-box[115113]: ERROR[0021] [2944625318] inbound/mixed[0]: process connection from 127.0.0.1:43498: dial tcp 3.0.71.95:443: connect: connection refused Mar 18 22:41:58 Arch sing-box[115113]: ERROR[0022] [2879290160] inbound/mixed[0]: process connection from 127.0.0.1:43512: dial tcp 3.0.71.95:443: connect: connection refused Mar 18 22:41:58 Arch sing-box[115113]: ERROR[0022] [2659498370] inbound/mixed[0]: process connection from 127.0.0.1:43526: dial tcp 3.0.71.95:443: connect: connection refused Mar 18 22:41:58 Arch sing-box[115113]: ERROR[0022] [2301154451] inbound/mixed[0]: process connection from 127.0.0.1:43542: dial tcp 3.0.71.95:443: connect: connection refused Mar 18 22:41:59 Arch sing-box[115113]: ERROR[0023] [2927384531] inbound/mixed[0]: process connection from 127.0.0.1:43548: dial tcp 3.0.71.95:443: connect: connection refused Mar 18 22:42:02 Arch sing-box[115113]: ERROR[0025] [32614806] inbound/mixed[0]: process connection from 127.0.0.1:43564: dial tcp 3.0.71.95:443: connect: connection refused Mar 18 22:42:02 Arch sing-box[115113]: ERROR[0025] [1789381905] inbound/mixed[0]: process connection from 127.0.0.1:43566: dial tcp 3.0.71.95:443: connect: connection refused Mar 18 22:42:28 Arch sing-box[115113]: ERROR[0051] [3482812336] inbound/mixed[0]: process connection from 127.0.0.1:57970: dial tcp 3.0.71.95:443: connect: connection refused Mar 18 22:42:28 Arch sing-box[115113]: ERROR[0051] [4129760004] inbound/mixed[0]: process connection from 127.0.0.1:57974: dial tcp 3.0.71.95:443: connect: connection refused Mar 18 22:42:34 Arch sing-box[115113]: ERROR[0057] [2910637273] inbound/mixed[0]: process connection from 127.0.0.1:58168: dial tcp 3.0.71.95:443: connect: connection refused Mar 18 22:42:35 Arch sing-box[115113]: ERROR[0058] [2592875603] inbound/mixed[0]: process connection from 127.0.0.1:58170: dial tcp 3.0.71.95:443: connect: connection refused Mar 18 22:42:37 Arch sing-box[115113]: ERROR[0060] [2934990300] inbound/mixed[0]: process connection from 127.0.0.1:32806: dial tcp 3.0.71.95:443: connect: connection refused Mar 18 22:42:38 Arch sing-box[115113]: ERROR[0061] [3908410556] inbound/mixed[0]: process connection from 127.0.0.1:32818: dial tcp 3.0.71.95:443: connect: connection refused ```
nekohasekai commented 1 year ago

https://github.com/SagerNet/sing-box/commit/46040a71c3670899c6af65b627d0a4f8e8c390f4

everyx commented 1 year ago

It's working fine, thanks