msg

package
v0.0.0-...-730ab85 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Heartbeat = iota
	Login     //登录成功后,配置的客户端获取
	Command   //start,stop,uninstall
	File
	OK
	Online //定时更新数据
	ERROR
	ACK
	UNKNOWN
)
View Source
const (
	FlagCompress = iota
	FlagAutoAck
)
View Source
const (
	FileTransferError = iota
	ConmmandError
)
View Source
const (
	Start = iota + 1
	Stop
	Restart
	Reload
	Uninstall
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AckData

type AckData struct {
	BaseMessage
	Origin uint8
}

func (*AckData) Pack

func (ack *AckData) Pack() ([]byte, error)

func (*AckData) UnPack

func (ack *AckData) UnPack(binaryData []byte) error

type BaseMessage

type BaseMessage struct {
	ConnID    uint32
	SessionId string
	Flags     byte ///特性,如是否加密,是否压缩, 是否ack等
}

func (*BaseMessage) BasePack

func (bm *BaseMessage) BasePack(dataBuff *bytes.Buffer) error

func (*BaseMessage) BaseUnpack

func (bm *BaseMessage) BaseUnpack(dataBuff *bytes.Reader) error

func (*BaseMessage) ReadBytes

func (bm *BaseMessage) ReadBytes(dataBuff *bytes.Reader) ([]byte, error)

func (*BaseMessage) ReadString

func (bm *BaseMessage) ReadString(dataBuff *bytes.Reader) (string, error)

func (*BaseMessage) WriteBytes

func (bm *BaseMessage) WriteBytes(buff *bytes.Buffer, data []byte) error

func (*BaseMessage) WriteString

func (bm *BaseMessage) WriteString(buff *bytes.Buffer, str string) error

type CommandData

type CommandData struct {
	BaseMessage
	Name string
	Type byte
}

func (*CommandData) Pack

func (cmd *CommandData) Pack() ([]byte, error)

func (*CommandData) UnPack

func (cmd *CommandData) UnPack(binaryData []byte) error

type ErrorData

type ErrorData struct {
	BaseMessage
	Origin uint8
	Data   string
}

func (*ErrorData) Pack

func (ed *ErrorData) Pack() ([]byte, error)

func (*ErrorData) UnPack

func (ed *ErrorData) UnPack(binaryData []byte) error

type FileData

type FileData struct {
	BaseMessage
	FileName   string
	FileSize   uint64 //总大小
	ChunkCount uint32 //总块数
	Sign       string //md5签名验证文件是否正常

	StartSize uint64 //起始大小
	ChunkSize uint64
	ChunkData string
}

func (*FileData) Pack

func (file *FileData) Pack() ([]byte, error)

func (*FileData) UnPack

func (file *FileData) UnPack(binaryData []byte) error

type OkData

type OkData struct {
	BaseMessage
	Origin uint8
	Data   string
}

func (*OkData) Pack

func (ok *OkData) Pack() ([]byte, error)

func (*OkData) UnPack

func (ok *OkData) UnPack(binaryData []byte) error

Jump to

Keyboard shortcuts

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