Documentation ¶
Index ¶
- Constants
- func GetCrc8(buf []byte) (crc byte)
- func TopMsgPack(msg *TopMessage) ([]byte, error)
- type DataPack
- type ErrConnectionFailed
- type ErrHttpServe
- type ErrInvalidMessage
- type ErrRegistrationTimeout
- type IMessage
- type LoginCfg
- type Message
- func (msg *Message) CheckDataCRC([]byte) bool
- func (msg *Message) GetCRCLen() uint32
- func (msg *Message) GetControl() byte
- func (msg *Message) GetData() []byte
- func (msg *Message) GetDataCRC() uint32
- func (msg *Message) GetDataLen() uint32
- func (msg *Message) GetHeadCRC(data []byte) byte
- func (msg *Message) GetMsgID() uint32
- func (msg *Message) GetProtocol() byte
- func (msg *Message) GetVer() byte
- func (msg *Message) SetData(data []byte)
- func (msg *Message) SetDataLen(len uint32)
- func (msg *Message) SetMsgID(msgID uint32)
- type Packet
- type PluginApp
- type PluginCfg
- type RegisterCfg
- type ServiceMsg
- type TopMessage
- type TopicInfo
- type TopicMap
Constants ¶
View Source
const ( ControlLogin = iota ControlRegister ControlData ControlHeart ControlError ControlClosed )
View Source
const ( ProtocolTopic = iota //byte ProtocolRPC )
View Source
const ( ClientStaConnect = iota //connect ClientStaLogin ClientStaRegister ClientStaData ClientStaClose )
View Source
const ( PluginUnStart = iota PluginStarting PluginRun PluginStop PluginErr )
View Source
const HeadCRC8Len uint32 = 1
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrConnectionFailed ¶
type ErrConnectionFailed error
Error reported when connection to the external plugin has failed.
type ErrHttpServe ¶
type ErrHttpServe error
Error reported when the external plugin cannot start listening for calls.
type ErrInvalidMessage ¶
type ErrInvalidMessage error
Error reported when an invalid message is printed by the external plugin.
type ErrRegistrationTimeout ¶
type ErrRegistrationTimeout error
Error reported when the plugin fails to register before the registration timeout expires.
type IMessage ¶
type IMessage interface { GetMsgID() uint32 //获取消息ID GetData() []byte //获取消息内容 GetDataLen() uint32 //设置消息数据段长度 GetHeadCRC([]byte) byte //数据帧头 GetDataCRC() uint32 //数据内容数据校验 GetCRCLen() uint32 CheckDataCRC([]byte) bool GetVer() byte GetProtocol() byte GetControl() byte SetMsgID(uint32) //设计消息ID SetData([]byte) //设计消息内容 SetDataLen(uint32) //设置消息数据段长度 }
func NewMsgPackage ¶
NewMsgPackage 创建一个Message消息包
type Message ¶
type Message struct { DataLen uint32 //消息的长度 ID uint32 //消息的ID Version byte //版本号 Protocol byte //协议类型 Control byte //控制 HeadCRC byte //头验证 Data []byte //消息的内容 DataCRC uint32 }
Message 消息
func (*Message) CheckDataCRC ¶
func (*Message) GetControl ¶
func (*Message) GetDataCRC ¶
func (*Message) GetHeadCRC ¶
func (*Message) GetProtocol ¶
type Packet ¶
type PluginCfg ¶
type PluginCfg struct { Proto string `p:"proto" json:"proto"` //参数名称 Unixdir string `p:"unixdir" json:"unixdir"` //unix文件地址 ServerAddr string `p:"serveraddr" json:"serveraddr"` //服务器地址 Name string `p:"name" json:"name"` //名称 Passwd string `p:"passwd" json:"passwd"` //名称 Params string `p:"params" json:"params"` //参数 }
type RegisterCfg ¶
type ServiceMsg ¶
type ServiceMsg struct { }
Click to show internal directories.
Click to hide internal directories.