schema

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: MulanPSL-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeOK       = uint32(0) //正确
	ErrCodeFail     = uint32(1) //总之失败
	ErrCodeUnknown  = uint32(2) //未知错误
	ErrCodeInvalid  = uint32(3) //无效
	ErrCodeNotExist = uint32(4) //不存在
	ErrCodeTimeout  = uint32(5) //超时
)

内部错误码范围 [0 - 255] 约定一些常见的错误性质

View Source
const (
	ProtoIDHeartbeatReq = uint32(1)
	ProtoIDHeartbeatRsp = uint32(2)
	ProtoIDEchoReq      = uint32(3)
	ProtoIDEchoRsp      = uint32(4)
	ProtoIDSignInReq    = uint32(5)
	ProtoIDSignInRsp    = uint32(6)

	ProtoIDUDPHelloReq = uint32(225)
	ProtoIDUDPHelloRsp = uint32(226)
)

内部协议号范围 [0 - 255]

Variables

This section is empty.

Functions

This section is empty.

Types

type EchoReq

type EchoReq struct {
	Text string `json:"text,omitempty"`
}

消息: 回声

type EchoRsp

type EchoRsp struct {
	Text string `json:"text,omitempty"`
}
type Header struct {
	Seq      uint64 `json:"s,omitempty"`
	Tms      uint64 `json:"t,omitempty"`
	CheckSum string `json:"cs,omitempty"`
	ProtoID  uint32 `json:"p,omitempty"`

	Rsp *HeaderRsp `json:"rsp,omitempty"`
}

消息头(header)

type HeaderRsp

type HeaderRsp struct {
	RequestSeq uint64 `json:"rs,omitempty"`
	RequestTms uint64 `json:"rt,omitempty"`
	ErrCode    uint32 `json:"ec,omitempty"`
	ErrMessage string `json:"em,omitempty"`
}

type HeartbeatReq

type HeartbeatReq struct {
}

消息: 心跳

type HeartbeatRsp

type HeartbeatRsp struct {
	//心跳的response被设计为投递模式, 所以需要显式的时间回执
	BackTms uint64 `json:"backTms,omitempty"`
}

type STConnectionConfig added in v0.1.0

type STConnectionConfig struct {
	ConfoundCode []byte `json:"confoundCode,omitempty"`
}

type STServerStatus added in v0.1.0

type STServerStatus struct {
	ServerVersion string `json:"serverVersion,omitempty"`
}

type SignInReq added in v0.1.0

type SignInReq struct {
}

消息: 服务配置

type SignInRsp added in v0.1.0

type SignInRsp struct {
	ServerStatus *STServerStatus `json:"serverStatus,omitempty"`

	ConnID     uint64              `json:"connID,omitempty"`
	ConnConfig *STConnectionConfig `json:"connConfig,omitempty"`
}

type UDPHeader added in v0.1.0

type UDPHeader struct {
	Index uint64 `json:"i,omitempty"`
}

UDP的额外头部

type UDPHelloReq added in v0.1.0

type UDPHelloReq struct {
	SignCode string `json:"signCode,omitempty"`
}

应为一个UDP客户端发送的第一个消息

type UDPHelloRsp added in v0.1.0

type UDPHelloRsp struct {
	Index uint64 `json:"index,omitempty"`
}

应为一个UDP客户端接收的第一个消息

Jump to

Keyboard shortcuts

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