QUIC sniffer: handle multiple initial packets (#3802)

* QUIC sniffer: handle multiple initial packets
Basically copied from Vigilans/v2ray-core@8f33db0

Co-Authored-By: Vigilans <vigilans@foxmail.com>

* Remove unnecessary file

---------

Co-authored-by: Vigilans <vigilans@foxmail.com>
This commit is contained in:
风扇滑翔翼 2024-09-14 01:32:43 +08:00 committed by GitHub
parent 7970f240de
commit 781aaee21f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 217 additions and 178 deletions

View file

@ -207,6 +207,21 @@ func (b *Buffer) Len() int32 {
return b.end - b.start
}
// Cap returns the capacity of the buffer content.
func (b *Buffer) Cap() int32 {
if b == nil {
return 0
}
return int32(len(b.v))
}
// NewWithSize creates a Buffer with 0 length and capacity with at least the given size.
func NewWithSize(size int32) *Buffer {
return &Buffer{
v: bytespool.Alloc(size),
}
}
// IsEmpty returns true if the buffer is empty.
func (b *Buffer) IsEmpty() bool {
return b.Len() == 0