protobuf

package
v0.0.0-...-bd135c8 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PackMessage

func PackMessage(msgType string, data []byte) []byte

PackMessage:按自定义协议打包数据

Types

type Message

type Message struct {
	Len     uint32
	TypeLen uint16
	Type    string
	Data    []byte
}

Message 数据帧定义

type Protocol

type Protocol struct {
}

Protocol protobuf

func New

func New() *Protocol

New 创建 protobuf Protocol

func (*Protocol) Packet

func (p *Protocol) Packet(c *connection.Connection, data []byte) []byte

Packet:装包

func (*Protocol) UnPacket

func (p *Protocol) UnPacket(c *connection.Connection, buffer *ringbuffer.RingBuffer) (ctx interface{}, out []byte)

UnPacket:拆包

Jump to

Keyboard shortcuts

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