[#168] session: Implement binary/JSON encoders/decoders on RequestMeta

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-13 17:02:30 +03:00 committed by Alex Vanin
parent 7e3e9e1cba
commit 8f8e977a3e
4 changed files with 45 additions and 4 deletions

View file

@ -528,6 +528,17 @@ func (r *RequestMetaHeader) StableSize() (size int) {
return size
}
func (r *RequestMetaHeader) Unmarshal(data []byte) error {
m := new(session.RequestMetaHeader)
if err := goproto.Unmarshal(data, m); err != nil {
return err
}
*r = *RequestMetaHeaderFromGRPCMessage(m)
return nil
}
func (r *RequestVerificationHeader) StableMarshal(buf []byte) ([]byte, error) {
if r == nil {
return []byte{}, nil