protocol

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

README

protocol

消息协议内容

包含消息协议相关的API

Documentation

Index

Constants

View Source
const (
	ErrBadRequest            = 101 // 错误的请求
	ErrInvalidArgument       = 102 // 参数错误
	ErrOperationNotSupported = 103 // 不支持当前操作
	ErrOperationTooOften     = 104 // 操作过于频繁
	ErrRequestTimeout        = 105 // 请求超时
	ErrDataCodecFailure      = 106 // 数据编码错误
	ErrProtocolIncompatible  = 107 // 协议不兼容
	ErrRpcTimeout            = 108 // RPC超时
)

错误码,定义与errno.proto一致

Variables

View Source
var (
	ErrInvalidLengthInternalStruct        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowInternalStruct          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupInternalStruct = fmt.Errorf("proto: unexpected end of group")
)
View Source
var NodeState_name = map[int32]string{
	0: "StateDown",
	1: "StateUp",
}
View Source
var NodeState_value = map[string]int32{
	"StateDown": 0,
	"StateUp":   1,
}

Functions

func CreateMessageBy

func CreateMessageBy(msgId uint32) proto.Message

根据消息ID创建message

func GetMessageIDOf

func GetMessageIDOf(msg proto.Message) uint32

根据message获取消息ID

func RegisterV1

func RegisterV1()

func RegisterV2

func RegisterV2(exName string)

Types

type Environ

type Environ struct {
	AppEnv               string           `protobuf:"bytes,1,opt,name=app_env,json=appEnv,proto3" json:"app_env,omitempty"`
	AppGameId            string           `protobuf:"bytes,2,opt,name=app_game_id,json=appGameId,proto3" json:"app_game_id,omitempty"`
	AppChannelId         string           `protobuf:"bytes,3,opt,name=app_channel_id,json=appChannelId,proto3" json:"app_channel_id,omitempty"`
	AppServerId          string           `protobuf:"bytes,4,opt,name=app_server_id,json=appServerId,proto3" json:"app_server_id,omitempty"`
	AppServerName        string           `protobuf:"bytes,5,opt,name=app_server_name,json=appServerName,proto3" json:"app_server_name,omitempty"`
	AppAccessKey         string           `protobuf:"bytes,6,opt,name=app_access_key,json=appAccessKey,proto3" json:"app_access_key,omitempty"`
	AppLogLevel          string           `protobuf:"bytes,7,opt,name=app_log_level,json=appLogLevel,proto3" json:"app_log_level,omitempty"`
	AppPprofAddr         string           `protobuf:"bytes,10,opt,name=app_pprof_addr,json=appPprofAddr,proto3" json:"app_pprof_addr,omitempty"`
	AppWorkingDir        string           `protobuf:"bytes,11,opt,name=app_working_dir,json=appWorkingDir,proto3" json:"app_working_dir,omitempty"`
	ServiceType          string           `protobuf:"bytes,12,opt,name=service_type,json=serviceType,proto3" json:"service_type,omitempty"`
	ServiceIndex         int32            `protobuf:"varint,13,opt,name=service_index,json=serviceIndex,proto3" json:"service_index,omitempty"`
	ServiceDependency    string           `protobuf:"bytes,14,opt,name=service_dependency,json=serviceDependency,proto3" json:"service_dependency,omitempty"`
	EtcdAddr             string           `protobuf:"bytes,15,opt,name=etcd_addr,json=etcdAddr,proto3" json:"etcd_addr,omitempty"`
	EtcdKeyspace         string           `protobuf:"bytes,16,opt,name=etcd_keyspace,json=etcdKeyspace,proto3" json:"etcd_keyspace,omitempty"`
	EtcdLeaseTtl         int32            `protobuf:"varint,17,opt,name=etcd_lease_ttl,json=etcdLeaseTtl,proto3" json:"etcd_lease_ttl,omitempty"`
	NetInterfaces        []*InterfaceAddr `protobuf:"bytes,20,rep,name=net_interfaces,json=netInterfaces,proto3" json:"net_interfaces,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

通用环境变量

func (*Environ) Descriptor

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

func (*Environ) GetAppAccessKey

func (m *Environ) GetAppAccessKey() string

func (*Environ) GetAppChannelId

func (m *Environ) GetAppChannelId() string

func (*Environ) GetAppEnv

func (m *Environ) GetAppEnv() string

func (*Environ) GetAppGameId

func (m *Environ) GetAppGameId() string

func (*Environ) GetAppLogLevel

func (m *Environ) GetAppLogLevel() string

func (*Environ) GetAppPprofAddr

func (m *Environ) GetAppPprofAddr() string

func (*Environ) GetAppServerId

func (m *Environ) GetAppServerId() string

func (*Environ) GetAppServerName

func (m *Environ) GetAppServerName() string

func (*Environ) GetAppWorkingDir

func (m *Environ) GetAppWorkingDir() string

func (*Environ) GetEtcdAddr

func (m *Environ) GetEtcdAddr() string

func (*Environ) GetEtcdKeyspace

func (m *Environ) GetEtcdKeyspace() string

func (*Environ) GetEtcdLeaseTtl

func (m *Environ) GetEtcdLeaseTtl() int32

func (*Environ) GetNetInterfaces

func (m *Environ) GetNetInterfaces() []*InterfaceAddr

func (*Environ) GetServiceDependency

func (m *Environ) GetServiceDependency() string

func (*Environ) GetServiceIndex

func (m *Environ) GetServiceIndex() int32

func (*Environ) GetServiceType

func (m *Environ) GetServiceType() string

func (*Environ) Marshal

func (m *Environ) Marshal() (dAtA []byte, err error)

func (*Environ) MarshalTo

func (m *Environ) MarshalTo(dAtA []byte) (int, error)

func (*Environ) MarshalToSizedBuffer

func (m *Environ) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Environ) ProtoMessage

func (*Environ) ProtoMessage()

func (*Environ) Reset

func (m *Environ) Reset()

func (*Environ) Size

func (m *Environ) Size() (n int)

func (*Environ) String

func (m *Environ) String() string

func (*Environ) Unmarshal

func (m *Environ) Unmarshal(dAtA []byte) error

func (*Environ) XXX_DiscardUnknown

func (m *Environ) XXX_DiscardUnknown()

func (*Environ) XXX_Marshal

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

func (*Environ) XXX_Merge

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

func (*Environ) XXX_Size

func (m *Environ) XXX_Size() int

func (*Environ) XXX_Unmarshal

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

type InterfaceAddr

type InterfaceAddr struct {
	BindAddr             string   `protobuf:"bytes,1,opt,name=bind_addr,json=bindAddr,proto3" json:"bind_addr,omitempty"`
	AdvertiseAddr        string   `protobuf:"bytes,2,opt,name=advertise_addr,json=advertiseAddr,proto3" json:"advertise_addr,omitempty"`
	Port                 int32    `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

地址接口,对外地址@bind地址:端口,如example.com@0.0.0.0:9527

func (*InterfaceAddr) Descriptor

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

func (*InterfaceAddr) GetAdvertiseAddr

func (m *InterfaceAddr) GetAdvertiseAddr() string

func (*InterfaceAddr) GetBindAddr

func (m *InterfaceAddr) GetBindAddr() string

func (*InterfaceAddr) GetPort

func (m *InterfaceAddr) GetPort() int32

func (*InterfaceAddr) Marshal

func (m *InterfaceAddr) Marshal() (dAtA []byte, err error)

func (*InterfaceAddr) MarshalTo

func (m *InterfaceAddr) MarshalTo(dAtA []byte) (int, error)

func (*InterfaceAddr) MarshalToSizedBuffer

func (m *InterfaceAddr) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*InterfaceAddr) ProtoMessage

func (*InterfaceAddr) ProtoMessage()

func (*InterfaceAddr) Reset

func (m *InterfaceAddr) Reset()

func (*InterfaceAddr) Size

func (m *InterfaceAddr) Size() (n int)

func (*InterfaceAddr) String

func (m *InterfaceAddr) String() string

func (*InterfaceAddr) Unmarshal

func (m *InterfaceAddr) Unmarshal(dAtA []byte) error

func (*InterfaceAddr) XXX_DiscardUnknown

func (m *InterfaceAddr) XXX_DiscardUnknown()

func (*InterfaceAddr) XXX_Marshal

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

func (*InterfaceAddr) XXX_Merge

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

func (*InterfaceAddr) XXX_Size

func (m *InterfaceAddr) XXX_Size() int

func (*InterfaceAddr) XXX_Unmarshal

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

type NodeInfo added in v1.0.2

type NodeInfo struct {
	Node                 uint32   `protobuf:"varint,1,opt,name=node,proto3" json:"node,omitempty"`
	Interface            string   `protobuf:"bytes,2,opt,name=interface,proto3" json:"interface,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

节点信息

func (*NodeInfo) Descriptor added in v1.0.2

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

func (*NodeInfo) GetInterface added in v1.0.2

func (m *NodeInfo) GetInterface() string

func (*NodeInfo) GetNode added in v1.0.2

func (m *NodeInfo) GetNode() uint32

func (*NodeInfo) Marshal added in v1.0.2

func (m *NodeInfo) Marshal() (dAtA []byte, err error)

func (*NodeInfo) MarshalTo added in v1.0.2

func (m *NodeInfo) MarshalTo(dAtA []byte) (int, error)

func (*NodeInfo) MarshalToSizedBuffer added in v1.0.2

func (m *NodeInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*NodeInfo) ProtoMessage added in v1.0.2

func (*NodeInfo) ProtoMessage()

func (*NodeInfo) Reset added in v1.0.2

func (m *NodeInfo) Reset()

func (*NodeInfo) Size added in v1.0.2

func (m *NodeInfo) Size() (n int)

func (*NodeInfo) String added in v1.0.2

func (m *NodeInfo) String() string

func (*NodeInfo) Unmarshal added in v1.0.2

func (m *NodeInfo) Unmarshal(dAtA []byte) error

func (*NodeInfo) XXX_DiscardUnknown added in v1.0.2

func (m *NodeInfo) XXX_DiscardUnknown()

func (*NodeInfo) XXX_Marshal added in v1.0.2

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

func (*NodeInfo) XXX_Merge added in v1.0.2

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

func (*NodeInfo) XXX_Size added in v1.0.2

func (m *NodeInfo) XXX_Size() int

func (*NodeInfo) XXX_Unmarshal added in v1.0.2

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

type NodeState added in v1.0.2

type NodeState int32

节点状态

const (
	NodeState_StateDown NodeState = 0
	NodeState_StateUp   NodeState = 1
)

func (NodeState) EnumDescriptor added in v1.0.2

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

func (NodeState) String added in v1.0.2

func (x NodeState) String() string

Jump to

Keyboard shortcuts

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