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.
25 lines
514 B
25 lines
514 B
3 years ago
|
package mtproto
|
||
|
|
||
|
import (
|
||
|
"github.com/go-faster/errors"
|
||
|
|
||
|
"github.com/gotd/td/bin"
|
||
|
"github.com/gotd/td/internal/proto"
|
||
|
)
|
||
|
|
||
|
func gzip(b *bin.Buffer) (*bin.Buffer, error) {
|
||
|
var content proto.GZIP
|
||
|
if err := content.Decode(b); err != nil {
|
||
|
return nil, errors.Wrap(err, "decode")
|
||
|
}
|
||
|
return &bin.Buffer{Buf: content.Data}, nil
|
||
|
}
|
||
|
|
||
|
func (c *Conn) handleGZIP(msgID int64, b *bin.Buffer) error {
|
||
|
content, err := gzip(b)
|
||
|
if err != nil {
|
||
|
return errors.Wrap(err, "unzip")
|
||
|
}
|
||
|
return c.handleMessage(msgID, content)
|
||
|
}
|