github.com/xraypb/Xray-core@v1.8.1/transport/internet/quic/pool.go (about) 1 package quic 2 3 import ( 4 "sync" 5 6 "github.com/xraypb/Xray-core/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) 21 }