mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-12-22 19:33:32 +02:00
?
This commit is contained in:
parent
b977899926
commit
3531b95d82
1 changed files with 7 additions and 0 deletions
|
@ -26,6 +26,13 @@ type Buffer struct {
|
|||
|
||||
// New creates a Buffer with 0 length and 2K capacity.
|
||||
func New() *Buffer {
|
||||
buf := pool.Get().([]byte)
|
||||
if cap(buf) >= Size {
|
||||
buf = buf[:Size]
|
||||
} else {
|
||||
buf = make([]byte, Size)
|
||||
}
|
||||
|
||||
return &Buffer{
|
||||
v: buf,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue