rpc

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SERVICE_name = map[int32]string{
		0: "NONE",
		1: "CLIENT",
		2: "GATE",
		3: "GAME",
		4: "ZONE",
		5: "DB",
		6: "NUM",
	}
	SERVICE_value = map[string]int32{
		"NONE":   0,
		"CLIENT": 1,
		"GATE":   2,
		"GAME":   3,
		"ZONE":   4,
		"DB":     5,
		"NUM":    6,
	}
)

Enum value maps for SERVICE.

View Source
var (
	SEND_name = map[int32]string{
		0: "POINT",
		1: "BOARD_CAST",
	}
	SEND_value = map[string]int32{
		"POINT":      0,
		"BOARD_CAST": 1,
	}
)

Enum value maps for SEND.

View Source
var (
	STUB_name = map[int32]string{
		0: "Master",
		1: "PlayerMgr",
		2: "AccountMgr",
		3: "ChatMgr",
		4: "END",
	}
	STUB_value = map[string]int32{
		"Master":     0,
		"PlayerMgr":  1,
		"AccountMgr": 2,
		"ChatMgr":    3,
		"END":        4,
	}
)

Enum value maps for STUB.

View Source
var (
	MAIL_name = map[int32]string{
		0: "Player",
	}
	MAIL_value = map[string]int32{
		"Player": 0,
	}
)

Enum value maps for MAIL.

Functions

func Route

func Route(head *RpcHead, funcName string) string

func Unmarshal

func Unmarshal(buff []byte) (*RpcPacket, RpcHead)

func UnmarshalBody

func UnmarshalBody(rpcPacket *RpcPacket, pFuncType reflect.Type) []interface{}

rpc Unmarshal pFuncType for (this *X)func(conttext, params)

func UnmarshalBodyCall

func UnmarshalBodyCall(rpcPacket *RpcPacket, pFuncType reflect.Type) (error, []interface{})

func UnmarshalHead

func UnmarshalHead(buff []byte) (*RpcPacket, RpcHead)

rpc UnmarshalHead

Types

type ClusterInfo

type ClusterInfo struct {
	Type     SERVICE `protobuf:"varint,1,opt,name=Type,proto3,enum=rpc.SERVICE" json:"Type,omitempty"`
	Ip       string  `protobuf:"bytes,2,opt,name=Ip,proto3" json:"Ip,omitempty"`
	Port     int32   `protobuf:"varint,3,opt,name=Port,proto3" json:"Port,omitempty"`
	Weight   int32   `protobuf:"varint,4,opt,name=Weight,proto3" json:"Weight,omitempty"`
	SocketId uint32  `protobuf:"varint,5,opt,name=SocketId,proto3" json:"SocketId,omitempty"`
	// contains filtered or unexported fields
}

集群信息

func (*ClusterInfo) Descriptor deprecated

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

Deprecated: Use ClusterInfo.ProtoReflect.Descriptor instead.

func (*ClusterInfo) GetIp

func (x *ClusterInfo) GetIp() string

func (*ClusterInfo) GetPort

func (x *ClusterInfo) GetPort() int32

func (*ClusterInfo) GetSocketId

func (x *ClusterInfo) GetSocketId() uint32

func (*ClusterInfo) GetType

func (x *ClusterInfo) GetType() SERVICE

func (*ClusterInfo) GetWeight

func (x *ClusterInfo) GetWeight() int32

func (*ClusterInfo) ProtoMessage

func (*ClusterInfo) ProtoMessage()

func (*ClusterInfo) ProtoReflect

func (x *ClusterInfo) ProtoReflect() protoreflect.Message

func (*ClusterInfo) Reset

func (x *ClusterInfo) Reset()

func (*ClusterInfo) String

func (x *ClusterInfo) String() string

type ICluster

type ICluster interface {
	SendMsg(head RpcHead, funcName string, params ...interface{})
	Call(params ...interface{})
	Id() uint32
}
var MGR ICluster

type MAIL

type MAIL int32

邮件类型

const (
	MAIL_Player MAIL = 0 //player
)

func (MAIL) Descriptor

func (MAIL) Descriptor() protoreflect.EnumDescriptor

func (MAIL) Enum

func (x MAIL) Enum() *MAIL

func (MAIL) EnumDescriptor deprecated

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

Deprecated: Use MAIL.Descriptor instead.

func (MAIL) Number

func (x MAIL) Number() protoreflect.EnumNumber

func (MAIL) String

func (x MAIL) String() string

func (MAIL) Type

func (MAIL) Type() protoreflect.EnumType

type MailBox

type MailBox struct {
	Id        int64  `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"`
	LeaseId   int64  `protobuf:"varint,2,opt,name=LeaseId,proto3" json:"LeaseId,omitempty"`
	MailType  MAIL   `protobuf:"varint,3,opt,name=MailType,proto3,enum=rpc.MAIL" json:"MailType,omitempty"`
	ClusterId uint32 `protobuf:"varint,5,opt,name=ClusterId,proto3" json:"ClusterId,omitempty"` //集群id
	// contains filtered or unexported fields
}

邮箱

func (*MailBox) Descriptor deprecated

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

Deprecated: Use MailBox.ProtoReflect.Descriptor instead.

func (*MailBox) GetClusterId

func (x *MailBox) GetClusterId() uint32

func (*MailBox) GetId

func (x *MailBox) GetId() int64

func (*MailBox) GetLeaseId

func (x *MailBox) GetLeaseId() int64

func (*MailBox) GetMailType

func (x *MailBox) GetMailType() MAIL

func (*MailBox) ProtoMessage

func (*MailBox) ProtoMessage()

func (*MailBox) ProtoReflect

func (x *MailBox) ProtoReflect() protoreflect.Message

func (*MailBox) Reset

func (x *MailBox) Reset()

func (*MailBox) String

func (x *MailBox) String() string

type Packet

type Packet struct {
	Id        uint32     `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"`              //socketid
	Reply     string     `protobuf:"bytes,2,opt,name=Reply,proto3" json:"Reply,omitempty"`         //call sessionid
	Buff      []byte     `protobuf:"bytes,3,opt,name=Buff,proto3" json:"Buff,omitempty"`           //buff
	RpcPacket *RpcPacket `protobuf:"bytes,4,opt,name=RpcPacket,proto3" json:"RpcPacket,omitempty"` //rpc packet
	// contains filtered or unexported fields
}

原始包

func Marshal

func Marshal(head *RpcHead, funcName *string, params ...interface{}) Packet

rpc Marshal

func (*Packet) Descriptor deprecated

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

Deprecated: Use Packet.ProtoReflect.Descriptor instead.

func (*Packet) GetBuff

func (x *Packet) GetBuff() []byte

func (*Packet) GetId

func (x *Packet) GetId() uint32

func (*Packet) GetReply

func (x *Packet) GetReply() string

func (*Packet) GetRpcPacket

func (x *Packet) GetRpcPacket() *RpcPacket

func (*Packet) ProtoMessage

func (*Packet) ProtoMessage()

func (*Packet) ProtoReflect

func (x *Packet) ProtoReflect() protoreflect.Message

func (*Packet) Reset

func (x *Packet) Reset()

func (*Packet) String

func (x *Packet) String() string

type RpcHead

type RpcHead struct {
	Id             int64   `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` //token
	SocketId       uint32  `protobuf:"varint,2,opt,name=SocketId,proto3" json:"SocketId,omitempty"`
	SrcClusterId   uint32  `protobuf:"varint,3,opt,name=SrcClusterId,proto3" json:"SrcClusterId,omitempty"`                      //源集群id
	ClusterId      uint32  `protobuf:"varint,4,opt,name=ClusterId,proto3" json:"ClusterId,omitempty"`                            //目标集群id
	DestServerType SERVICE `protobuf:"varint,5,opt,name=DestServerType,proto3,enum=rpc.SERVICE" json:"DestServerType,omitempty"` //目标集群
	SendType       SEND    `protobuf:"varint,6,opt,name=SendType,proto3,enum=rpc.SEND" json:"SendType,omitempty"`
	ActorName      string  `protobuf:"bytes,7,opt,name=ActorName,proto3" json:"ActorName,omitempty"`
	Reply          string  `protobuf:"bytes,8,opt,name=Reply,proto3" json:"Reply,omitempty"` //call sessionid
	// contains filtered or unexported fields
}

rpc 包头

func (*RpcHead) Descriptor deprecated

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

Deprecated: Use RpcHead.ProtoReflect.Descriptor instead.

func (*RpcHead) GetActorName

func (x *RpcHead) GetActorName() string

func (*RpcHead) GetClusterId

func (x *RpcHead) GetClusterId() uint32

func (*RpcHead) GetDestServerType

func (x *RpcHead) GetDestServerType() SERVICE

func (*RpcHead) GetId

func (x *RpcHead) GetId() int64

func (*RpcHead) GetReply

func (x *RpcHead) GetReply() string

func (*RpcHead) GetSendType

func (x *RpcHead) GetSendType() SEND

func (*RpcHead) GetSocketId

func (x *RpcHead) GetSocketId() uint32

func (*RpcHead) GetSrcClusterId

func (x *RpcHead) GetSrcClusterId() uint32

func (*RpcHead) ProtoMessage

func (*RpcHead) ProtoMessage()

func (*RpcHead) ProtoReflect

func (x *RpcHead) ProtoReflect() protoreflect.Message

func (*RpcHead) Reset

func (x *RpcHead) Reset()

func (*RpcHead) String

func (x *RpcHead) String() string

type RpcPacket

type RpcPacket struct {
	FuncName string   `protobuf:"bytes,1,opt,name=FuncName,proto3" json:"FuncName,omitempty"`
	ArgLen   int32    `protobuf:"varint,2,opt,name=ArgLen,proto3" json:"ArgLen,omitempty"`
	RpcHead  *RpcHead `protobuf:"bytes,3,opt,name=RpcHead,proto3" json:"RpcHead,omitempty"`
	RpcBody  []byte   `protobuf:"bytes,4,opt,name=RpcBody,proto3" json:"RpcBody,omitempty"`
	// contains filtered or unexported fields
}

rpc 包

func (*RpcPacket) Descriptor deprecated

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

Deprecated: Use RpcPacket.ProtoReflect.Descriptor instead.

func (*RpcPacket) GetArgLen

func (x *RpcPacket) GetArgLen() int32

func (*RpcPacket) GetFuncName

func (x *RpcPacket) GetFuncName() string

func (*RpcPacket) GetRpcBody

func (x *RpcPacket) GetRpcBody() []byte

func (*RpcPacket) GetRpcHead

func (x *RpcPacket) GetRpcHead() *RpcHead

func (*RpcPacket) ProtoMessage

func (*RpcPacket) ProtoMessage()

func (*RpcPacket) ProtoReflect

func (x *RpcPacket) ProtoReflect() protoreflect.Message

func (*RpcPacket) Reset

func (x *RpcPacket) Reset()

func (*RpcPacket) String

func (x *RpcPacket) String() string

type SEND

type SEND int32

发送标志

const (
	SEND_POINT      SEND = 0 //指定集群id
	SEND_BOARD_CAST SEND = 1 //广播
)

func (SEND) Descriptor

func (SEND) Descriptor() protoreflect.EnumDescriptor

func (SEND) Enum

func (x SEND) Enum() *SEND

func (SEND) EnumDescriptor deprecated

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

Deprecated: Use SEND.Descriptor instead.

func (SEND) Number

func (x SEND) Number() protoreflect.EnumNumber

func (SEND) String

func (x SEND) String() string

func (SEND) Type

func (SEND) Type() protoreflect.EnumType

type SERVICE

type SERVICE int32

服务器类型

const (
	SERVICE_NONE   SERVICE = 0
	SERVICE_CLIENT SERVICE = 1
	SERVICE_GATE   SERVICE = 2
	SERVICE_GAME   SERVICE = 3
	SERVICE_ZONE   SERVICE = 4
	SERVICE_DB     SERVICE = 5
	SERVICE_NUM    SERVICE = 6
)

func (SERVICE) Descriptor

func (SERVICE) Descriptor() protoreflect.EnumDescriptor

func (SERVICE) Enum

func (x SERVICE) Enum() *SERVICE

func (SERVICE) EnumDescriptor deprecated

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

Deprecated: Use SERVICE.Descriptor instead.

func (SERVICE) Number

func (x SERVICE) Number() protoreflect.EnumNumber

func (SERVICE) String

func (x SERVICE) String() string

func (SERVICE) Type

func (SERVICE) Type() protoreflect.EnumType

type STUB

type STUB int32

STUB类型

const (
	STUB_Master     STUB = 0 //master
	STUB_PlayerMgr  STUB = 1 //db
	STUB_AccountMgr STUB = 2 //登录
	STUB_ChatMgr    STUB = 3 //聊天
	STUB_END        STUB = 4
)

func (STUB) Descriptor

func (STUB) Descriptor() protoreflect.EnumDescriptor

func (STUB) Enum

func (x STUB) Enum() *STUB

func (STUB) EnumDescriptor deprecated

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

Deprecated: Use STUB.Descriptor instead.

func (STUB) Number

func (x STUB) Number() protoreflect.EnumNumber

func (STUB) String

func (x STUB) String() string

func (STUB) Type

func (STUB) Type() protoreflect.EnumType

type StubMailBox

type StubMailBox struct {
	Id        int64  `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"`
	LeaseId   int64  `protobuf:"varint,2,opt,name=LeaseId,proto3" json:"LeaseId,omitempty"`
	StubType  STUB   `protobuf:"varint,3,opt,name=StubType,proto3,enum=rpc.STUB" json:"StubType,omitempty"`
	ClusterId uint32 `protobuf:"varint,5,opt,name=ClusterId,proto3" json:"ClusterId,omitempty"` //集群id
	// contains filtered or unexported fields
}

玩法集群信息

func (*StubMailBox) Descriptor deprecated

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

Deprecated: Use StubMailBox.ProtoReflect.Descriptor instead.

func (*StubMailBox) GetClusterId

func (x *StubMailBox) GetClusterId() uint32

func (*StubMailBox) GetId

func (x *StubMailBox) GetId() int64

func (*StubMailBox) GetLeaseId

func (x *StubMailBox) GetLeaseId() int64

func (*StubMailBox) GetStubType

func (x *StubMailBox) GetStubType() STUB

func (*StubMailBox) ProtoMessage

func (*StubMailBox) ProtoMessage()

func (*StubMailBox) ProtoReflect

func (x *StubMailBox) ProtoReflect() protoreflect.Message

func (*StubMailBox) Reset

func (x *StubMailBox) Reset()

func (*StubMailBox) String

func (x *StubMailBox) String() string

Jump to

Keyboard shortcuts

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