Highly-opinionated (ex-bullshit-free) MTPROTO proxy for Telegram. If you use v1.0 or upgrade broke you proxy, please read the chapter Version 2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pools.go 289B

12345678910111213141516171819
  1. package relay
  2. import "sync"
  3. var copyBufferPool = sync.Pool{
  4. New: func() interface{} {
  5. rv := make([]byte, copyBufferSize)
  6. return &rv
  7. },
  8. }
  9. func acquireCopyBuffer() *[]byte {
  10. return copyBufferPool.Get().(*[]byte)
  11. }
  12. func releaseCopyBuffer(buf *[]byte) {
  13. copyBufferPool.Put(buf)
  14. }