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.

read_current_data.go 404B

1234567891011121314151617181920
  1. package utils
  2. import "io"
  3. const readCurrentDataBufferSize = 1024 + 1 // + 1 because telegram operates with blocks mod 4
  4. func ReadCurrentData(src io.Reader) (rv []byte, err error) {
  5. buf := make([]byte, readCurrentDataBufferSize)
  6. n := readCurrentDataBufferSize
  7. for n == len(buf) {
  8. n, err = src.Read(buf)
  9. if err != nil {
  10. return nil, err
  11. }
  12. rv = append(rv, buf[:n]...)
  13. }
  14. return rv, nil
  15. }