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 325B

1234567891011121314151617181920212223
  1. package tlstypes
  2. import (
  3. "bytes"
  4. "sync"
  5. )
  6. var (
  7. poolBytesBuffer = sync.Pool{
  8. New: func() interface{} {
  9. return &bytes.Buffer{}
  10. },
  11. }
  12. )
  13. func acquireBytesBuffer() *bytes.Buffer {
  14. return poolBytesBuffer.Get().(*bytes.Buffer)
  15. }
  16. func releaseBytesBuffer(buf *bytes.Buffer) {
  17. buf.Reset()
  18. poolBytesBuffer.Put(buf)
  19. }