mtprotobuf

package module
v0.0.0-...-e49887a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2023 License: MIT Imports: 8 Imported by: 0

README

mtprotobuf

A sequence and reverse sequence protocol tool, fully referenced from https://github.com/sdidyk/mtproto
Compile:
    go install -v github.com/qingsong-he/mtprotobuf/mtprotobuf-getcrc32
    go install -v github.com/qingsong-he/mtprotobuf/mtprotobuf-gen-go

Usage:
    ./mtprotobuf-getcrc32 'boolTrue#997275b5 = Bool;'
    ./mtprotobuf-gen-go example.tl example

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CRC32_TL_vector_layer0      uint32 = 0x1cb5c415
	CRC32_TL_gzip_packed_layer0 uint32 = 0x3072cfa1
	CRC32_TL_boolFalse_layer0   uint32 = 0xbc799737
	CRC32_TL_boolTrue_layer0    uint32 = 0x997275b5
)
View Source
var DefaultDecodeMap = make(map[uint32]func(m *DecodeBuf) TL)
View Source
var TLErrByTLRepeatReg = errors.New("tl repeat")

Functions

func GetBufWithGZip

func GetBufWithGZip(bin []byte) []byte

Types

type DecodeBuf

type DecodeBuf struct {
	// contains filtered or unexported fields
}

func NewDecodeBuf

func NewDecodeBuf(b []byte) *DecodeBuf

func (*DecodeBuf) BigInt

func (m *DecodeBuf) BigInt() *big.Int

func (*DecodeBuf) Bool

func (m *DecodeBuf) Bool() bool

func (*DecodeBuf) Bytes

func (m *DecodeBuf) Bytes(size int) []byte

func (*DecodeBuf) Double

func (m *DecodeBuf) Double() float64

func (*DecodeBuf) Int

func (m *DecodeBuf) Int() int32

func (*DecodeBuf) Long

func (m *DecodeBuf) Long() int64

func (*DecodeBuf) Object

func (m *DecodeBuf) Object() (r TL)

func (*DecodeBuf) String

func (m *DecodeBuf) String() string

func (*DecodeBuf) StringBytes

func (m *DecodeBuf) StringBytes() []byte

func (*DecodeBuf) UInt

func (m *DecodeBuf) UInt() uint32

func (*DecodeBuf) Vector

func (m *DecodeBuf) Vector() []TL

func (*DecodeBuf) VectorDouble

func (m *DecodeBuf) VectorDouble() []float64

func (*DecodeBuf) VectorInt

func (m *DecodeBuf) VectorInt() []int32

func (*DecodeBuf) VectorLong

func (m *DecodeBuf) VectorLong() []int64

func (*DecodeBuf) VectorString

func (m *DecodeBuf) VectorString() []string

type EncodeBuf

type EncodeBuf struct {
	// contains filtered or unexported fields
}

func NewEncodeBuf

func NewEncodeBuf(cap int) *EncodeBuf

func (*EncodeBuf) BigInt

func (e *EncodeBuf) BigInt(s *big.Int)

func (*EncodeBuf) Bytes

func (e *EncodeBuf) Bytes(s []byte)

func (*EncodeBuf) Double

func (e *EncodeBuf) Double(s float64)

func (*EncodeBuf) GetBuf

func (e *EncodeBuf) GetBuf() []byte

func (*EncodeBuf) Int

func (e *EncodeBuf) Int(s int32)

func (*EncodeBuf) Long

func (e *EncodeBuf) Long(s int64)

func (*EncodeBuf) String

func (e *EncodeBuf) String(s string)

func (*EncodeBuf) StringBytes

func (e *EncodeBuf) StringBytes(s []byte)

func (*EncodeBuf) UInt

func (e *EncodeBuf) UInt(s uint32)

func (*EncodeBuf) Vector

func (e *EncodeBuf) Vector(v []TL)

func (*EncodeBuf) VectorDouble

func (e *EncodeBuf) VectorDouble(v []float64)

func (*EncodeBuf) VectorInt

func (e *EncodeBuf) VectorInt(v []int32)

func (*EncodeBuf) VectorLong

func (e *EncodeBuf) VectorLong(v []int64)

func (*EncodeBuf) VectorString

func (e *EncodeBuf) VectorString(v []string)

type TL

type TL interface {
	Encode() []byte
	CRC32() uint32
}

type TL_boolFalse_layer0

type TL_boolFalse_layer0 struct {
}

begin of 'boolFalse#bc799737 = Bool;'

func NewTL_boolFalse_layer0

func NewTL_boolFalse_layer0() *TL_boolFalse_layer0

func (*TL_boolFalse_layer0) CRC32

func (*TL_boolFalse_layer0) CRC32() uint32

func (*TL_boolFalse_layer0) Decode

func (tl *TL_boolFalse_layer0) Decode(m *DecodeBuf) TL

func (*TL_boolFalse_layer0) Encode

func (*TL_boolFalse_layer0) Encode() []byte

func (*TL_boolFalse_layer0) GetLayer

func (*TL_boolFalse_layer0) GetLayer() int32

type TL_boolTrue_layer0

type TL_boolTrue_layer0 struct {
}

func NewTL_boolTrue_layer0

func NewTL_boolTrue_layer0() *TL_boolTrue_layer0

func (*TL_boolTrue_layer0) CRC32

func (*TL_boolTrue_layer0) CRC32() uint32

func (*TL_boolTrue_layer0) Decode

func (tl *TL_boolTrue_layer0) Decode(m *DecodeBuf) TL

func (*TL_boolTrue_layer0) Encode

func (*TL_boolTrue_layer0) Encode() []byte

func (*TL_boolTrue_layer0) GetLayer

func (*TL_boolTrue_layer0) GetLayer() int32

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL