Documentation ¶
Index ¶
- Variables
- func Call(parmas ...interface{})
- func MarshalJson(head api.JsonHead, funcName string, params ...interface{}) (packet api.Packet)
- func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer)
- func Route(head *RpcHead, funcName string) string
- func Unmarshal(buff []byte) (*RpcPacket, RpcHead)
- func Unmarshal2(buff []byte) (*RpcPacket, RpcHead)
- func UnmarshalBody(rpcPacket *RpcPacket, pFuncType reflect.Type) []interface{}
- func UnmarshalBody2(rpcPacket *RpcPacket, pFuncType reflect.Type) []interface{}
- func UnmarshalBodyCall(rpcPacket *RpcPacket, pFuncType reflect.Type) (error, []interface{})
- func UnmarshalBodyJson(jsonPacket api.JsonPacket, pFuncType reflect.Type) []interface{}
- func UnmarshalHead(buff []byte) (*RpcPacket, RpcHead)
- type ClusterInfo
- func (*ClusterInfo) Descriptor() ([]byte, []int)deprecated
- func (x *ClusterInfo) GetIp() string
- func (x *ClusterInfo) GetPort() int32
- func (x *ClusterInfo) GetSocketId() uint32
- func (x *ClusterInfo) GetType() SERVICE
- func (x *ClusterInfo) GetUrl() string
- func (x *ClusterInfo) GetWeight() int32
- func (c *ClusterInfo) Id() uint32
- func (c *ClusterInfo) IpString() string
- func (*ClusterInfo) ProtoMessage()
- func (x *ClusterInfo) ProtoReflect() protoreflect.Message
- func (x *ClusterInfo) Reset()
- func (c *ClusterInfo) ServiceName() string
- func (c *ClusterInfo) ServiceType() SERVICE
- func (x *ClusterInfo) String() string
- type F
- type ICluster
- type IClusterInfo
- type MAIL
- type MailBox
- func (*MailBox) Descriptor() ([]byte, []int)deprecated
- func (x *MailBox) GetClusterId() uint32
- func (x *MailBox) GetId() int64
- func (x *MailBox) GetLeaseId() int64
- func (x *MailBox) GetMailType() MAIL
- func (*MailBox) ProtoMessage()
- func (x *MailBox) ProtoReflect() protoreflect.Message
- func (x *MailBox) Reset()
- func (x *MailBox) String() string
- type Packet
- func (*Packet) Descriptor() ([]byte, []int)deprecated
- func (x *Packet) GetBuff() []byte
- func (x *Packet) GetId() uint32
- func (x *Packet) GetReply() string
- func (x *Packet) GetRpcPacket() *RpcPacket
- func (*Packet) ProtoMessage()
- func (x *Packet) ProtoReflect() protoreflect.Message
- func (x *Packet) Reset()
- func (x *Packet) String() string
- type RpcHead
- func (*RpcHead) Descriptor() ([]byte, []int)deprecated
- func (x *RpcHead) GetActorName() string
- func (x *RpcHead) GetClusterId() uint32
- func (x *RpcHead) GetCode() int32
- func (x *RpcHead) GetDestServerType() SERVICE
- func (x *RpcHead) GetId() int64
- func (x *RpcHead) GetMsg() string
- func (x *RpcHead) GetReply() string
- func (x *RpcHead) GetSendType() SEND
- func (x *RpcHead) GetSocketId() uint32
- func (x *RpcHead) GetSrcClusterId() uint32
- func (x *RpcHead) GetToken() string
- func (*RpcHead) ProtoMessage()
- func (x *RpcHead) ProtoReflect() protoreflect.Message
- func (x *RpcHead) Reset()
- func (x *RpcHead) String() string
- type RpcPacket
- func (*RpcPacket) Descriptor() ([]byte, []int)deprecated
- func (x *RpcPacket) GetArgLen() int32
- func (x *RpcPacket) GetFuncName() string
- func (x *RpcPacket) GetRpcBody() []byte
- func (x *RpcPacket) GetRpcHead() *RpcHead
- func (*RpcPacket) ProtoMessage()
- func (x *RpcPacket) ProtoReflect() protoreflect.Message
- func (x *RpcPacket) Reset()
- func (x *RpcPacket) String() string
- type SEND
- type SERVICE
- type STUB
- type StubMailBox
- func (*StubMailBox) Descriptor() ([]byte, []int)deprecated
- func (x *StubMailBox) GetClusterId() uint32
- func (x *StubMailBox) GetId() int64
- func (x *StubMailBox) GetLeaseId() int64
- func (x *StubMailBox) GetStubType() STUB
- func (s *StubMailBox) Key() string
- func (*StubMailBox) ProtoMessage()
- func (x *StubMailBox) ProtoReflect() protoreflect.Message
- func (x *StubMailBox) Reset()
- func (x *StubMailBox) String() string
- func (s *StubMailBox) StubName() string
- type T
- type TestServiceClient
- type TestServiceServer
- type UnimplementedTestServiceServer
- type UnsafeTestServiceServer
Constants ¶
This section is empty.
Variables ¶
var ( SERVICE_name = map[int32]string{ 0: "NONE", 1: "CLIENT", 2: "GATE", 3: "GM", 4: "GAME", 5: "ZONE", 6: "DB", 7: "GATESERVER", 8: "ACCOUNTSERVER", 9: "WORLDSERVER", 10: "ZONESERVER", 11: "WORLDDBSERVER", 12: "ServiceWarKings", 13: "ServiceFruitPark", } SERVICE_value = map[string]int32{ "NONE": 0, "CLIENT": 1, "GATE": 2, "GM": 3, "GAME": 4, "ZONE": 5, "DB": 6, "GATESERVER": 7, "ACCOUNTSERVER": 8, "WORLDSERVER": 9, "ZONESERVER": 10, "WORLDDBSERVER": 11, "ServiceWarKings": 12, "ServiceFruitPark": 13, } )
Enum value maps for SERVICE.
var ( SEND_name = map[int32]string{ 0: "POINT", 1: "BALANCE", 2: "BOARD_CAST", } SEND_value = map[string]int32{ "POINT": 0, "BALANCE": 1, "BOARD_CAST": 2, } )
Enum value maps for SEND.
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.
var ( MAIL_name = map[int32]string{ 0: "Player", } MAIL_value = map[string]int32{ "Player": 0, } )
Enum value maps for MAIL.
var File_rpc3_proto protoreflect.FileDescriptor
var GCall = reflect.ValueOf(Call)
var TestService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "rpc.TestService", HandlerType: (*TestServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "TestSon", Handler: _TestService_TestSon_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "rpc3.proto", }
TestService_ServiceDesc is the grpc.ServiceDesc for TestService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func MarshalJson ¶ added in v1.7.5
func RegisterTestServiceServer ¶
func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer)
func Unmarshal2 ¶
func UnmarshalBody ¶
rpc Unmarshal pFuncType for (this *X)func(conttext, params)
func UnmarshalBody2 ¶
func UnmarshalBodyCall ¶
func UnmarshalBodyJson ¶ added in v1.7.3
func UnmarshalBodyJson(jsonPacket api.JsonPacket, pFuncType reflect.Type) []interface{}
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"` Url string `protobuf:"bytes,6,opt,name=Url,proto3" json:"Url,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) GetUrl ¶
func (x *ClusterInfo) GetUrl() string
func (*ClusterInfo) GetWeight ¶
func (x *ClusterInfo) GetWeight() int32
func (*ClusterInfo) Id ¶ added in v1.9.6
func (c *ClusterInfo) Id() uint32
func (*ClusterInfo) IpString ¶ added in v1.9.6
func (c *ClusterInfo) IpString() string
func (*ClusterInfo) ProtoMessage ¶
func (*ClusterInfo) ProtoMessage()
func (*ClusterInfo) ProtoReflect ¶
func (x *ClusterInfo) ProtoReflect() protoreflect.Message
func (*ClusterInfo) Reset ¶
func (x *ClusterInfo) Reset()
func (*ClusterInfo) ServiceName ¶ added in v1.9.6
func (c *ClusterInfo) ServiceName() string
func (*ClusterInfo) ServiceType ¶ added in v1.9.6
func (c *ClusterInfo) ServiceType() SERVICE
func (*ClusterInfo) String ¶
func (x *ClusterInfo) String() string
type F ¶
type F struct { RpcPacket *RpcPacket `protobuf:"bytes,1,opt,name=RpcPacket,proto3" json:"RpcPacket,omitempty"` Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` // contains filtered or unexported fields }
func (*F) Descriptor
deprecated
func (*F) GetRpcPacket ¶
func (*F) ProtoMessage ¶
func (*F) ProtoMessage()
func (*F) ProtoReflect ¶
func (x *F) ProtoReflect() protoreflect.Message
type ICluster ¶
type ICluster interface { SendMsg(head RpcHead, funcName string, params ...interface{}) Call(parmas ...interface{}) Id() uint32 }
var MGR ICluster
type IClusterInfo ¶ added in v1.9.6
type MAIL ¶
type MAIL int32
邮件类型
const (
MAIL_Player MAIL = 0 //player
)
func (MAIL) Descriptor ¶
func (MAIL) Descriptor() protoreflect.EnumDescriptor
func (MAIL) EnumDescriptor
deprecated
func (MAIL) Number ¶
func (x MAIL) Number() protoreflect.EnumNumber
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) GetClusterId ¶
func (*MailBox) GetLeaseId ¶
func (*MailBox) GetMailType ¶
func (*MailBox) ProtoMessage ¶
func (*MailBox) ProtoMessage()
func (*MailBox) ProtoReflect ¶
func (x *MailBox) ProtoReflect() protoreflect.Message
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 (*Packet) Descriptor
deprecated
func (*Packet) GetRpcPacket ¶
func (*Packet) ProtoMessage ¶
func (*Packet) ProtoMessage()
func (*Packet) ProtoReflect ¶
func (x *Packet) ProtoReflect() protoreflect.Message
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 Code int32 `protobuf:"varint,9,opt,name=Code,proto3" json:"Code,omitempty"` Msg string `protobuf:"bytes,10,opt,name=Msg,proto3" json:"Msg,omitempty"` Token string `protobuf:"bytes,11,opt,name=Token,proto3" json:"Token,omitempty"` // contains filtered or unexported fields }
rpc 包头
func (*RpcHead) Descriptor
deprecated
func (*RpcHead) GetActorName ¶
func (*RpcHead) GetClusterId ¶
func (*RpcHead) GetDestServerType ¶
func (*RpcHead) GetSendType ¶
func (*RpcHead) GetSocketId ¶
func (*RpcHead) GetSrcClusterId ¶
func (*RpcHead) ProtoMessage ¶
func (*RpcHead) ProtoMessage()
func (*RpcHead) ProtoReflect ¶
func (x *RpcHead) ProtoReflect() protoreflect.Message
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 MarshalPacket ¶
rpc MarshalPacket
func (*RpcPacket) Descriptor
deprecated
func (*RpcPacket) GetFuncName ¶
func (*RpcPacket) GetRpcBody ¶
func (*RpcPacket) GetRpcHead ¶
func (*RpcPacket) ProtoMessage ¶
func (*RpcPacket) ProtoMessage()
func (*RpcPacket) ProtoReflect ¶
func (x *RpcPacket) ProtoReflect() protoreflect.Message
type SEND ¶
type SEND int32
发送标志
func (SEND) Descriptor ¶
func (SEND) Descriptor() protoreflect.EnumDescriptor
func (SEND) EnumDescriptor
deprecated
func (SEND) Number ¶
func (x SEND) Number() protoreflect.EnumNumber
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_GM SERVICE = 3 //gamemgr SERVICE_GAME SERVICE = 4 //game SERVICE_ZONE SERVICE = 5 //地图 SERVICE_DB SERVICE = 6 //db SERVICE_GATESERVER SERVICE = 7 //网关,转发服务 SERVICE_ACCOUNTSERVER SERVICE = 8 //账号 SERVICE_WORLDSERVER SERVICE = 9 //世界 SERVICE_ZONESERVER SERVICE = 10 //地图 SERVICE_WORLDDBSERVER SERVICE = 11 //db SERVICE_ServiceWarKings SERVICE = 12 //王者战记 SERVICE_ServiceFruitPark SERVICE = 13 //db水果乐园 )
func (SERVICE) Descriptor ¶
func (SERVICE) Descriptor() protoreflect.EnumDescriptor
func (SERVICE) EnumDescriptor
deprecated
func (SERVICE) Number ¶
func (x SERVICE) Number() protoreflect.EnumNumber
func (SERVICE) Type ¶
func (SERVICE) Type() protoreflect.EnumType
type STUB ¶
type STUB int32
STUB类型
func (STUB) Descriptor ¶
func (STUB) Descriptor() protoreflect.EnumDescriptor
func (STUB) EnumDescriptor
deprecated
func (STUB) Number ¶
func (x STUB) Number() protoreflect.EnumNumber
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) Key ¶ added in v1.9.6
func (s *StubMailBox) Key() string
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
func (*StubMailBox) StubName ¶ added in v1.9.6
func (s *StubMailBox) StubName() string
type T ¶
type T struct { RpcPacket *RpcPacket `protobuf:"bytes,1,opt,name=RpcPacket,proto3" json:"RpcPacket,omitempty"` Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` // contains filtered or unexported fields }
func (*T) Descriptor
deprecated
func (*T) GetRpcPacket ¶
func (*T) ProtoMessage ¶
func (*T) ProtoMessage()
func (*T) ProtoReflect ¶
func (x *T) ProtoReflect() protoreflect.Message
type TestServiceClient ¶
type TestServiceClient interface {
TestSon(ctx context.Context, in *F, opts ...grpc.CallOption) (*T, error)
}
TestServiceClient is the client API for TestService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewTestServiceClient ¶
func NewTestServiceClient(cc grpc.ClientConnInterface) TestServiceClient
type TestServiceServer ¶
type TestServiceServer interface { TestSon(context.Context, *F) (*T, error) // contains filtered or unexported methods }
TestServiceServer is the server API for TestService service. All implementations must embed UnimplementedTestServiceServer for forward compatibility
type UnimplementedTestServiceServer ¶
type UnimplementedTestServiceServer struct { }
UnimplementedTestServiceServer must be embedded to have forward compatible implementations.
type UnsafeTestServiceServer ¶
type UnsafeTestServiceServer interface {
// contains filtered or unexported methods
}
UnsafeTestServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TestServiceServer will result in compilation errors.