feat 协议移动到Public

This commit is contained in:
2025-12-15 11:22:59 +08:00
parent 6e19d93f5e
commit 3498cf158d
45 changed files with 2730 additions and 929 deletions

View File

@@ -0,0 +1,221 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.32.0
// protoc v4.25.1
// source: service_gateway.proto
package grpc_pb
import (
_ "common/proto/ss/ss_common"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ToClientReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UID int32 `protobuf:"varint,1,opt,name=UID,proto3" json:"UID,omitempty"`
MessageID int32 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"`
Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"`
}
func (x *ToClientReq) Reset() {
*x = ToClientReq{}
if protoimpl.UnsafeEnabled {
mi := &file_service_gateway_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ToClientReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ToClientReq) ProtoMessage() {}
func (x *ToClientReq) ProtoReflect() protoreflect.Message {
mi := &file_service_gateway_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ToClientReq.ProtoReflect.Descriptor instead.
func (*ToClientReq) Descriptor() ([]byte, []int) {
return file_service_gateway_proto_rawDescGZIP(), []int{0}
}
func (x *ToClientReq) GetUID() int32 {
if x != nil {
return x.UID
}
return 0
}
func (x *ToClientReq) GetMessageID() int32 {
if x != nil {
return x.MessageID
}
return 0
}
func (x *ToClientReq) GetPayload() []byte {
if x != nil {
return x.Payload
}
return nil
}
type ToClientResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ToClientResp) Reset() {
*x = ToClientResp{}
if protoimpl.UnsafeEnabled {
mi := &file_service_gateway_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ToClientResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ToClientResp) ProtoMessage() {}
func (x *ToClientResp) ProtoReflect() protoreflect.Message {
mi := &file_service_gateway_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ToClientResp.ProtoReflect.Descriptor instead.
func (*ToClientResp) Descriptor() ([]byte, []int) {
return file_service_gateway_proto_rawDescGZIP(), []int{1}
}
var File_service_gateway_proto protoreflect.FileDescriptor
var file_service_gateway_proto_rawDesc = []byte{
0x0a, 0x15, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61,
0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d,
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x0b, 0x54, 0x6f, 0x43, 0x6c,
0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x49, 0x44, 0x18, 0x01,
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x55, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x4d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f,
0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61,
0x64, 0x22, 0x0e, 0x0a, 0x0c, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73,
0x70, 0x32, 0x36, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2b, 0x0a, 0x08,
0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x0c, 0x2e, 0x54, 0x6f, 0x43, 0x6c, 0x69,
0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e,
0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x28, 0x01, 0x42, 0x19, 0x5a, 0x17, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70,
0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_service_gateway_proto_rawDescOnce sync.Once
file_service_gateway_proto_rawDescData = file_service_gateway_proto_rawDesc
)
func file_service_gateway_proto_rawDescGZIP() []byte {
file_service_gateway_proto_rawDescOnce.Do(func() {
file_service_gateway_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_gateway_proto_rawDescData)
})
return file_service_gateway_proto_rawDescData
}
var file_service_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_service_gateway_proto_goTypes = []interface{}{
(*ToClientReq)(nil), // 0: ToClientReq
(*ToClientResp)(nil), // 1: ToClientResp
}
var file_service_gateway_proto_depIdxs = []int32{
0, // 0: Gateway.ToClient:input_type -> ToClientReq
1, // 1: Gateway.ToClient:output_type -> ToClientResp
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_service_gateway_proto_init() }
func file_service_gateway_proto_init() {
if File_service_gateway_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_service_gateway_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ToClientReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_gateway_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ToClientResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_service_gateway_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_service_gateway_proto_goTypes,
DependencyIndexes: file_service_gateway_proto_depIdxs,
MessageInfos: file_service_gateway_proto_msgTypes,
}.Build()
File_service_gateway_proto = out.File
file_service_gateway_proto_rawDesc = nil
file_service_gateway_proto_goTypes = nil
file_service_gateway_proto_depIdxs = nil
}

View File

@@ -0,0 +1,139 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v4.25.1
// source: service_gateway.proto
package grpc_pb
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// GatewayClient is the client API for Gateway 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.
type GatewayClient interface {
ToClient(ctx context.Context, opts ...grpc.CallOption) (Gateway_ToClientClient, error)
}
type gatewayClient struct {
cc grpc.ClientConnInterface
}
func NewGatewayClient(cc grpc.ClientConnInterface) GatewayClient {
return &gatewayClient{cc}
}
func (c *gatewayClient) ToClient(ctx context.Context, opts ...grpc.CallOption) (Gateway_ToClientClient, error) {
stream, err := c.cc.NewStream(ctx, &Gateway_ServiceDesc.Streams[0], "/Gateway/ToClient", opts...)
if err != nil {
return nil, err
}
x := &gatewayToClientClient{stream}
return x, nil
}
type Gateway_ToClientClient interface {
Send(*ToClientReq) error
CloseAndRecv() (*ToClientResp, error)
grpc.ClientStream
}
type gatewayToClientClient struct {
grpc.ClientStream
}
func (x *gatewayToClientClient) Send(m *ToClientReq) error {
return x.ClientStream.SendMsg(m)
}
func (x *gatewayToClientClient) CloseAndRecv() (*ToClientResp, error) {
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
m := new(ToClientResp)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// GatewayServer is the server API for Gateway service.
// All implementations must embed UnimplementedGatewayServer
// for forward compatibility
type GatewayServer interface {
ToClient(Gateway_ToClientServer) error
mustEmbedUnimplementedGatewayServer()
}
// UnimplementedGatewayServer must be embedded to have forward compatible implementations.
type UnimplementedGatewayServer struct {
}
func (UnimplementedGatewayServer) ToClient(Gateway_ToClientServer) error {
return status.Errorf(codes.Unimplemented, "method ToClient not implemented")
}
func (UnimplementedGatewayServer) mustEmbedUnimplementedGatewayServer() {}
// UnsafeGatewayServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to GatewayServer will
// result in compilation errors.
type UnsafeGatewayServer interface {
mustEmbedUnimplementedGatewayServer()
}
func RegisterGatewayServer(s grpc.ServiceRegistrar, srv GatewayServer) {
s.RegisterService(&Gateway_ServiceDesc, srv)
}
func _Gateway_ToClient_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(GatewayServer).ToClient(&gatewayToClientServer{stream})
}
type Gateway_ToClientServer interface {
SendAndClose(*ToClientResp) error
Recv() (*ToClientReq, error)
grpc.ServerStream
}
type gatewayToClientServer struct {
grpc.ServerStream
}
func (x *gatewayToClientServer) SendAndClose(m *ToClientResp) error {
return x.ServerStream.SendMsg(m)
}
func (x *gatewayToClientServer) Recv() (*ToClientReq, error) {
m := new(ToClientReq)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// Gateway_ServiceDesc is the grpc.ServiceDesc for Gateway service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Gateway_ServiceDesc = grpc.ServiceDesc{
ServiceName: "Gateway",
HandlerType: (*GatewayServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "ToClient",
Handler: _Gateway_ToClient_Handler,
ClientStreams: true,
},
},
Metadata: "service_gateway.proto",
}

View File

@@ -0,0 +1,388 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.32.0
// protoc v4.25.1
// source: service_scene.proto
package grpc_pb
import (
_ "common/proto/ss/ss_common"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type EnterReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UID int32 `protobuf:"varint,1,opt,name=UID,proto3" json:"UID,omitempty"` // 用户ID
GatewaySID int64 `protobuf:"varint,2,opt,name=GatewaySID,proto3" json:"GatewaySID,omitempty"` // 网关服务ID
InstanceID int32 `protobuf:"varint,3,opt,name=InstanceID,proto3" json:"InstanceID,omitempty"` // 副本ID
}
func (x *EnterReq) Reset() {
*x = EnterReq{}
if protoimpl.UnsafeEnabled {
mi := &file_service_scene_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EnterReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EnterReq) ProtoMessage() {}
func (x *EnterReq) ProtoReflect() protoreflect.Message {
mi := &file_service_scene_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use EnterReq.ProtoReflect.Descriptor instead.
func (*EnterReq) Descriptor() ([]byte, []int) {
return file_service_scene_proto_rawDescGZIP(), []int{0}
}
func (x *EnterReq) GetUID() int32 {
if x != nil {
return x.UID
}
return 0
}
func (x *EnterReq) GetGatewaySID() int64 {
if x != nil {
return x.GatewaySID
}
return 0
}
func (x *EnterReq) GetInstanceID() int32 {
if x != nil {
return x.InstanceID
}
return 0
}
type EnterResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SceneSID int64 `protobuf:"varint,1,opt,name=SceneSID,proto3" json:"SceneSID,omitempty"` // 场景服务ID
UniqueNo int64 `protobuf:"varint,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号
}
func (x *EnterResp) Reset() {
*x = EnterResp{}
if protoimpl.UnsafeEnabled {
mi := &file_service_scene_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EnterResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EnterResp) ProtoMessage() {}
func (x *EnterResp) ProtoReflect() protoreflect.Message {
mi := &file_service_scene_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use EnterResp.ProtoReflect.Descriptor instead.
func (*EnterResp) Descriptor() ([]byte, []int) {
return file_service_scene_proto_rawDescGZIP(), []int{1}
}
func (x *EnterResp) GetSceneSID() int64 {
if x != nil {
return x.SceneSID
}
return 0
}
func (x *EnterResp) GetUniqueNo() int64 {
if x != nil {
return x.UniqueNo
}
return 0
}
type ActionReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UniqueNo int64 `protobuf:"varint,1,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号
UID int32 `protobuf:"varint,2,opt,name=UID,proto3" json:"UID,omitempty"` // 用户ID
Action int32 `protobuf:"varint,3,opt,name=Action,proto3" json:"Action,omitempty"` // 动作ID
Payload []byte `protobuf:"bytes,4,opt,name=Payload,proto3" json:"Payload,omitempty"` // 动作数据
}
func (x *ActionReq) Reset() {
*x = ActionReq{}
if protoimpl.UnsafeEnabled {
mi := &file_service_scene_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ActionReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ActionReq) ProtoMessage() {}
func (x *ActionReq) ProtoReflect() protoreflect.Message {
mi := &file_service_scene_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ActionReq.ProtoReflect.Descriptor instead.
func (*ActionReq) Descriptor() ([]byte, []int) {
return file_service_scene_proto_rawDescGZIP(), []int{2}
}
func (x *ActionReq) GetUniqueNo() int64 {
if x != nil {
return x.UniqueNo
}
return 0
}
func (x *ActionReq) GetUID() int32 {
if x != nil {
return x.UID
}
return 0
}
func (x *ActionReq) GetAction() int32 {
if x != nil {
return x.Action
}
return 0
}
func (x *ActionReq) GetPayload() []byte {
if x != nil {
return x.Payload
}
return nil
}
type ActionResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ActionResp) Reset() {
*x = ActionResp{}
if protoimpl.UnsafeEnabled {
mi := &file_service_scene_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ActionResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ActionResp) ProtoMessage() {}
func (x *ActionResp) ProtoReflect() protoreflect.Message {
mi := &file_service_scene_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ActionResp.ProtoReflect.Descriptor instead.
func (*ActionResp) Descriptor() ([]byte, []int) {
return file_service_scene_proto_rawDescGZIP(), []int{3}
}
var File_service_scene_proto protoreflect.FileDescriptor
var file_service_scene_proto_rawDesc = []byte{
0x0a, 0x13, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5c, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52,
0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x03, 0x55, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53,
0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61,
0x79, 0x53, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,
0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e,
0x63, 0x65, 0x49, 0x44, 0x22, 0x43, 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73,
0x70, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x18, 0x01, 0x20,
0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x12, 0x1a, 0x0a,
0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x22, 0x6b, 0x0a, 0x09, 0x41, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65,
0x4e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65,
0x4e, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x03, 0x55, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03,
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07,
0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50,
0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x0c, 0x0a, 0x0a, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x52, 0x65, 0x73, 0x70, 0x32, 0x50, 0x0a, 0x05, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x12, 0x20, 0x0a,
0x05, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x09, 0x2e, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65,
0x71, 0x1a, 0x0a, 0x2e, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12,
0x25, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0a, 0x2e, 0x41, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0b, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
0x73, 0x70, 0x22, 0x00, 0x28, 0x01, 0x42, 0x19, 0x5a, 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_service_scene_proto_rawDescOnce sync.Once
file_service_scene_proto_rawDescData = file_service_scene_proto_rawDesc
)
func file_service_scene_proto_rawDescGZIP() []byte {
file_service_scene_proto_rawDescOnce.Do(func() {
file_service_scene_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_scene_proto_rawDescData)
})
return file_service_scene_proto_rawDescData
}
var file_service_scene_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_service_scene_proto_goTypes = []interface{}{
(*EnterReq)(nil), // 0: EnterReq
(*EnterResp)(nil), // 1: EnterResp
(*ActionReq)(nil), // 2: ActionReq
(*ActionResp)(nil), // 3: ActionResp
}
var file_service_scene_proto_depIdxs = []int32{
0, // 0: Scene.Enter:input_type -> EnterReq
2, // 1: Scene.Action:input_type -> ActionReq
1, // 2: Scene.Enter:output_type -> EnterResp
3, // 3: Scene.Action:output_type -> ActionResp
2, // [2:4] is the sub-list for method output_type
0, // [0:2] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_service_scene_proto_init() }
func file_service_scene_proto_init() {
if File_service_scene_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_service_scene_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EnterReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_scene_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EnterResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_scene_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ActionReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_scene_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ActionResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_service_scene_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_service_scene_proto_goTypes,
DependencyIndexes: file_service_scene_proto_depIdxs,
MessageInfos: file_service_scene_proto_msgTypes,
}.Build()
File_service_scene_proto = out.File
file_service_scene_proto_rawDesc = nil
file_service_scene_proto_goTypes = nil
file_service_scene_proto_depIdxs = nil
}

View File

@@ -0,0 +1,176 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v4.25.1
// source: service_scene.proto
package grpc_pb
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// SceneClient is the client API for Scene 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.
type SceneClient interface {
Enter(ctx context.Context, in *EnterReq, opts ...grpc.CallOption) (*EnterResp, error)
Action(ctx context.Context, opts ...grpc.CallOption) (Scene_ActionClient, error)
}
type sceneClient struct {
cc grpc.ClientConnInterface
}
func NewSceneClient(cc grpc.ClientConnInterface) SceneClient {
return &sceneClient{cc}
}
func (c *sceneClient) Enter(ctx context.Context, in *EnterReq, opts ...grpc.CallOption) (*EnterResp, error) {
out := new(EnterResp)
err := c.cc.Invoke(ctx, "/Scene/Enter", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *sceneClient) Action(ctx context.Context, opts ...grpc.CallOption) (Scene_ActionClient, error) {
stream, err := c.cc.NewStream(ctx, &Scene_ServiceDesc.Streams[0], "/Scene/Action", opts...)
if err != nil {
return nil, err
}
x := &sceneActionClient{stream}
return x, nil
}
type Scene_ActionClient interface {
Send(*ActionReq) error
CloseAndRecv() (*ActionResp, error)
grpc.ClientStream
}
type sceneActionClient struct {
grpc.ClientStream
}
func (x *sceneActionClient) Send(m *ActionReq) error {
return x.ClientStream.SendMsg(m)
}
func (x *sceneActionClient) CloseAndRecv() (*ActionResp, error) {
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
m := new(ActionResp)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// SceneServer is the server API for Scene service.
// All implementations must embed UnimplementedSceneServer
// for forward compatibility
type SceneServer interface {
Enter(context.Context, *EnterReq) (*EnterResp, error)
Action(Scene_ActionServer) error
mustEmbedUnimplementedSceneServer()
}
// UnimplementedSceneServer must be embedded to have forward compatible implementations.
type UnimplementedSceneServer struct {
}
func (UnimplementedSceneServer) Enter(context.Context, *EnterReq) (*EnterResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Enter not implemented")
}
func (UnimplementedSceneServer) Action(Scene_ActionServer) error {
return status.Errorf(codes.Unimplemented, "method Action not implemented")
}
func (UnimplementedSceneServer) mustEmbedUnimplementedSceneServer() {}
// UnsafeSceneServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SceneServer will
// result in compilation errors.
type UnsafeSceneServer interface {
mustEmbedUnimplementedSceneServer()
}
func RegisterSceneServer(s grpc.ServiceRegistrar, srv SceneServer) {
s.RegisterService(&Scene_ServiceDesc, srv)
}
func _Scene_Enter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EnterReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SceneServer).Enter(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Scene/Enter",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SceneServer).Enter(ctx, req.(*EnterReq))
}
return interceptor(ctx, in, info, handler)
}
func _Scene_Action_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(SceneServer).Action(&sceneActionServer{stream})
}
type Scene_ActionServer interface {
SendAndClose(*ActionResp) error
Recv() (*ActionReq, error)
grpc.ServerStream
}
type sceneActionServer struct {
grpc.ServerStream
}
func (x *sceneActionServer) SendAndClose(m *ActionResp) error {
return x.ServerStream.SendMsg(m)
}
func (x *sceneActionServer) Recv() (*ActionReq, error) {
m := new(ActionReq)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// Scene_ServiceDesc is the grpc.ServiceDesc for Scene service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Scene_ServiceDesc = grpc.ServiceDesc{
ServiceName: "Scene",
HandlerType: (*SceneServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Enter",
Handler: _Scene_Enter_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "Action",
Handler: _Scene_Action_Handler,
ClientStreams: true,
},
},
Metadata: "service_scene.proto",
}

View File

@@ -0,0 +1,62 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.32.0
// protoc v4.25.1
// source: ss_common.proto
package ss_common
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
var File_ss_common_proto protoreflect.FileDescriptor
var file_ss_common_proto_rawDesc = []byte{
0x0a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x42, 0x1b, 0x5a, 0x19, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var file_ss_common_proto_goTypes = []interface{}{}
var file_ss_common_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_ss_common_proto_init() }
func file_ss_common_proto_init() {
if File_ss_common_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_ss_common_proto_rawDesc,
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_ss_common_proto_goTypes,
DependencyIndexes: file_ss_common_proto_depIdxs,
}.Build()
File_ss_common_proto = out.File
file_ss_common_proto_rawDesc = nil
file_ss_common_proto_goTypes = nil
file_ss_common_proto_depIdxs = nil
}

View File

@@ -0,0 +1,9 @@
@echo off
@REM protoc --proto_path=. --go_out=.. ./proto/common.proto
@REM protoc --proto_path=./proto --go_out=.. ./proto/grpc/*.proto
protoc --proto_path=./sources --go_out=./gen --go-grpc_out=./gen ./sources/*.proto
@REM protoc --proto_path=./proto --go_out=.. ./proto/cs/*.proto
@REM xcopy ./proto/cs/*.* ../../Client/web/proto/
xcopy "./gen/common" "../../../Server/common" /E /I /Y /Q

View File

@@ -0,0 +1,17 @@
syntax = "proto3";
option go_package = "common/proto/ss/grpc_pb";
import "ss_common.proto";
service Gateway {
rpc ToClient(stream ToClientReq) returns (ToClientResp) {}
}
message ToClientReq {
int32 UID = 1;
int32 MessageID = 2;
bytes Payload = 3;
}
message ToClientResp {
}

View File

@@ -0,0 +1,30 @@
syntax = "proto3";
option go_package = "common/proto/ss/grpc_pb";
import "ss_common.proto";
service Scene {
rpc Enter(EnterReq) returns (EnterResp) {}
rpc Action(stream ActionReq) returns (ActionResp) {}
}
message EnterReq {
int32 UID = 1; // 用户ID
int64 GatewaySID = 2; // 网关服务ID
int32 InstanceID = 3; // 副本ID
}
message EnterResp {
int64 SceneSID = 1; // 场景服务ID
int64 UniqueNo = 2; // 副本唯一编号
}
message ActionReq {
int64 UniqueNo = 1; // 副本唯一编号
int32 UID = 2; // 用户ID
int32 Action = 3; // 动作ID
bytes Payload = 4; // 动作数据
}
message ActionResp {
}

View File

@@ -0,0 +1,3 @@
syntax = "proto3";
option go_package = "common/proto/ss/ss_common";