github.com/imannamdari/v2ray-core/v5@v5.0.5/transport/internet/quic/pool.go (about) 1 package quic 2 3 import ( 4 "sync" 5 6 "github.com/imannamdari/v2ray-core/v5/common/bytespool" 7 ) 8 9 var pool *sync.Pool 10 11 func init() { 12 pool = bytespool.GetPool(2048) 13 } 14 15 func getBuffer() []byte { 16 return pool.Get().([]byte) 17 } 18 19 func putBuffer(p []byte) { 20 pool.Put(p) // nolint: staticcheck 21 }