1 parent 3aed155 commit 40a1d62Copy full SHA for 40a1d62
1 file changed
vless/constant.go
@@ -32,9 +32,15 @@ func reshapeBuffer(b []byte) []*buf.Buffer {
32
if len(b) < bufferLimit {
33
return []*buf.Buffer{buf.As(b)}
34
}
35
- index := int32(bytes.LastIndex(b, tlsApplicationDataStart))
36
- if index <= 0 {
37
- index = 8192 / 2
+ var buffers []*buf.Buffer
+ for len(b) >= bufferLimit {
+ index := int32(bytes.LastIndex(b, tlsApplicationDataStart))
38
+ if index < 32 || index > bufferLimit {
39
+ index = 8192 / 2
40
+ }
41
+ buffers = append(buffers, buf.As(b[:index]))
42
+ b = b[index:]
43
- return []*buf.Buffer{buf.As(b[:index]), buf.As(b[index:])}
44
+ buffers = append(buffers, buf.As(b))
45
+ return buffers
46
0 commit comments