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.
24 lines
514 B
24 lines
514 B
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) |
|
}
|
|
|