github.com/Uhtred009/v2ray-core-1@v4.31.2+incompatible/transport/internet/quic/pool.go (about) 1 // +build !confonly 2 3 package quic 4 5 import ( 6 "sync" 7 8 "v2ray.com/core/common/bytespool" 9 ) 10 11 var pool *sync.Pool 12 13 func init() { 14 pool = bytespool.GetPool(2048) 15 } 16 17 func getBuffer() []byte { 18 return pool.Get().([]byte) 19 } 20 21 func putBuffer(p []byte) { 22 pool.Put(p) 23 }