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.

frame_pool.go 427B

123456789101112131415161718192021222324
  1. package obfuscated2
  2. import "sync"
  3. var framePool sync.Pool
  4. // MakeFrame returns new pointer to the handshake frame.
  5. func MakeFrame() *Frame {
  6. return framePool.Get().(*Frame)
  7. }
  8. // ReturnFrame returns pointer to the handshake frame back to the pool.
  9. func ReturnFrame(f *Frame) {
  10. framePool.Put(f)
  11. }
  12. func init() {
  13. framePool = sync.Pool{
  14. New: func() interface{} {
  15. data := make(Frame, FrameLen)
  16. return &data
  17. },
  18. }
  19. }