pkg

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PKG_SIZE_BYTES = 4
	PKG_TYPE_BYTES = 4
)
View Source
const (
	TYPE_NULL          = iota
	TYPE_HANDSHAKE     //1
	TYPE_HANDSHAKE_ACK //2
	TYPE_HEARTBEAT     //3
	TYPE_DATA          //4
	TYPE_KICK          //5

	PKG_HEAD_BYTES = 4
)

Variables

View Source
var EErrorCode_name = map[int32]string{
	0: "INVALID_ERROR_CODE",
	1: "SUCCESS",
	2: "ERROR_ROUTE_ID",
	3: "ERROR_KICK_BY_SERVER",
}
View Source
var EErrorCode_value = map[string]int32{
	"INVALID_ERROR_CODE":   0,
	"SUCCESS":              1,
	"ERROR_ROUTE_ID":       2,
	"ERROR_KICK_BY_SERVER": 3,
}
View Source
var EMsgType_name = map[int32]string{
	0:     "INVALID_TYPE",
	70000: "TYPE_HEARTBEAT",
	70001: "TYPE_COMMON_RESULT",
	70002: "TYPE_KICK_BY_SERVER",
}
View Source
var EMsgType_value = map[string]int32{
	"INVALID_TYPE":        0,
	"TYPE_HEARTBEAT":      70000,
	"TYPE_COMMON_RESULT":  70001,
	"TYPE_KICK_BY_SERVER": 70002,
}

Functions

func Decode

func Decode(buffer []byte) (pkgType int, body []byte)

*

  • Package protocol decode.
  • See encode for package format.

func Encode

func Encode(pkgType int, body []byte) *[]byte

*

  • Package protocol encode. *
  • +------+------+------------------+
  • | size | type | body |
  • +------+------+------------------+ *

func GetByteOrder

func GetByteOrder() bool

func SetByteOrder

func SetByteOrder(littleEndian bool)

Types

type EErrorCode

type EErrorCode int32
const (
	EErrorCode_INVALID_ERROR_CODE   EErrorCode = 0
	EErrorCode_SUCCESS              EErrorCode = 1
	EErrorCode_ERROR_ROUTE_ID       EErrorCode = 2
	EErrorCode_ERROR_KICK_BY_SERVER EErrorCode = 3
)

func (EErrorCode) EnumDescriptor

func (EErrorCode) EnumDescriptor() ([]byte, []int)

func (EErrorCode) String

func (x EErrorCode) String() string

type EMsgType

type EMsgType int32
const (
	EMsgType_INVALID_TYPE        EMsgType = 0
	EMsgType_TYPE_HEARTBEAT      EMsgType = 70000
	EMsgType_TYPE_COMMON_RESULT  EMsgType = 70001
	EMsgType_TYPE_KICK_BY_SERVER EMsgType = 70002
)

func (EMsgType) EnumDescriptor

func (EMsgType) EnumDescriptor() ([]byte, []int)

func (EMsgType) String

func (x EMsgType) String() string

type ReqHeartbeat

type ReqHeartbeat struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ReqHeartbeat) Descriptor

func (*ReqHeartbeat) Descriptor() ([]byte, []int)

func (*ReqHeartbeat) ProtoMessage

func (*ReqHeartbeat) ProtoMessage()

func (*ReqHeartbeat) Reset

func (m *ReqHeartbeat) Reset()

func (*ReqHeartbeat) String

func (m *ReqHeartbeat) String() string

func (*ReqHeartbeat) XXX_DiscardUnknown

func (m *ReqHeartbeat) XXX_DiscardUnknown()

func (*ReqHeartbeat) XXX_Marshal

func (m *ReqHeartbeat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ReqHeartbeat) XXX_Merge

func (m *ReqHeartbeat) XXX_Merge(src proto.Message)

func (*ReqHeartbeat) XXX_Size

func (m *ReqHeartbeat) XXX_Size() int

func (*ReqHeartbeat) XXX_Unmarshal

func (m *ReqHeartbeat) XXX_Unmarshal(b []byte) error

type RespResult

type RespResult struct {
	Code                 int32    `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"`
	Msg                  string   `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RespResult) Descriptor

func (*RespResult) Descriptor() ([]byte, []int)

func (*RespResult) GetCode

func (m *RespResult) GetCode() int32

func (*RespResult) GetMsg

func (m *RespResult) GetMsg() string

func (*RespResult) ProtoMessage

func (*RespResult) ProtoMessage()

func (*RespResult) Reset

func (m *RespResult) Reset()

func (*RespResult) String

func (m *RespResult) String() string

func (*RespResult) XXX_DiscardUnknown

func (m *RespResult) XXX_DiscardUnknown()

func (*RespResult) XXX_Marshal

func (m *RespResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RespResult) XXX_Merge

func (m *RespResult) XXX_Merge(src proto.Message)

func (*RespResult) XXX_Size

func (m *RespResult) XXX_Size() int

func (*RespResult) XXX_Unmarshal

func (m *RespResult) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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