refactor(project): 重构项目并更新依赖

- 更新 README.md 中的项目结构说明
- 添加 pprof 性能分析工具的使用说明
- 更新 build.bat 文件,增加 proto 文件编译命令
- 升级 go-logr/logr 依赖至 v1.3.0
- 降级 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc 依赖至 v1.16.0
- 降级 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp 依赖至 v1.16.0
- 升级 go.opentelemetry.io/otel/trace 依赖至 v1.20.0
- 移除 logic/main.go 中的冗余代码
- 重构 logic/server.go 中的 Start 函数
- 更新 login/main.go 文件
This commit is contained in:
2025-07-06 17:05:10 +08:00
parent c16eed6fe0
commit 83ecb90baf
45 changed files with 7546 additions and 39 deletions

798
common/api/rpc.pb.go Normal file
View File

@@ -0,0 +1,798 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.2
// protoc v3.20.0--rc1
// source: manifest/proto/rpc.proto
package api
import (
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)
)
// 注册请求 - logic 用户登录后注册
type RegisterUser struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Identity int32 `protobuf:"varint,1,opt,name=identity,proto3" json:"identity,omitempty"` // 客户端身份,进入后保存id->端口 实现通知踢人以及进程退出
UserId int32 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 执行踢人操作的用户id
}
func (x *RegisterUser) Reset() {
*x = RegisterUser{}
if protoimpl.UnsafeEnabled {
mi := &file_manifest_proto_rpc_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RegisterUser) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RegisterUser) ProtoMessage() {}
func (x *RegisterUser) ProtoReflect() protoreflect.Message {
mi := &file_manifest_proto_rpc_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 RegisterUser.ProtoReflect.Descriptor instead.
func (*RegisterUser) Descriptor() ([]byte, []int) {
return file_manifest_proto_rpc_proto_rawDescGZIP(), []int{0}
}
func (x *RegisterUser) GetIdentity() int32 {
if x != nil {
return x.Identity
}
return 0
}
func (x *RegisterUser) GetUserId() int32 {
if x != nil {
return x.UserId
}
return 0
}
// 注册请求 - B客户端使用此消息向服务器注册
type KickRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 执行踢人操作的用户id
}
func (x *KickRequest) Reset() {
*x = KickRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_manifest_proto_rpc_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *KickRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*KickRequest) ProtoMessage() {}
func (x *KickRequest) ProtoReflect() protoreflect.Message {
mi := &file_manifest_proto_rpc_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 KickRequest.ProtoReflect.Descriptor instead.
func (*KickRequest) Descriptor() ([]byte, []int) {
return file_manifest_proto_rpc_proto_rawDescGZIP(), []int{1}
}
func (x *KickRequest) GetUserId() int32 {
if x != nil {
return x.UserId
}
return 0
}
// 函数描述符
type FunctionDescriptor struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
FunctionName string `protobuf:"bytes,1,opt,name=function_name,json=functionName,proto3" json:"function_name,omitempty"` // 函数名称
InputType string `protobuf:"bytes,2,opt,name=input_type,json=inputType,proto3" json:"input_type,omitempty"` // 输入参数类型
OutputType string `protobuf:"bytes,3,opt,name=output_type,json=outputType,proto3" json:"output_type,omitempty"` // 输出参数类型
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` // 函数描述
}
func (x *FunctionDescriptor) Reset() {
*x = FunctionDescriptor{}
if protoimpl.UnsafeEnabled {
mi := &file_manifest_proto_rpc_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FunctionDescriptor) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FunctionDescriptor) ProtoMessage() {}
func (x *FunctionDescriptor) ProtoReflect() protoreflect.Message {
mi := &file_manifest_proto_rpc_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 FunctionDescriptor.ProtoReflect.Descriptor instead.
func (*FunctionDescriptor) Descriptor() ([]byte, []int) {
return file_manifest_proto_rpc_proto_rawDescGZIP(), []int{2}
}
func (x *FunctionDescriptor) GetFunctionName() string {
if x != nil {
return x.FunctionName
}
return ""
}
func (x *FunctionDescriptor) GetInputType() string {
if x != nil {
return x.InputType
}
return ""
}
func (x *FunctionDescriptor) GetOutputType() string {
if x != nil {
return x.OutputType
}
return ""
}
func (x *FunctionDescriptor) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
// 注册响应
type RegisterResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // 注册是否成功
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // 消息描述
RegistrationId string `protobuf:"bytes,3,opt,name=registration_id,json=registrationId,proto3" json:"registration_id,omitempty"` // 注册ID
}
func (x *RegisterResponse) Reset() {
*x = RegisterResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_manifest_proto_rpc_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RegisterResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RegisterResponse) ProtoMessage() {}
func (x *RegisterResponse) ProtoReflect() protoreflect.Message {
mi := &file_manifest_proto_rpc_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 RegisterResponse.ProtoReflect.Descriptor instead.
func (*RegisterResponse) Descriptor() ([]byte, []int) {
return file_manifest_proto_rpc_proto_rawDescGZIP(), []int{3}
}
func (x *RegisterResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *RegisterResponse) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
func (x *RegisterResponse) GetRegistrationId() string {
if x != nil {
return x.RegistrationId
}
return ""
}
// 函数调用请求 - A客户端使用此消息请求调用B的函数
type FunctionCallRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TargetClientId string `protobuf:"bytes,1,opt,name=target_client_id,json=targetClientId,proto3" json:"target_client_id,omitempty"` // 目标客户端IDB
FunctionName string `protobuf:"bytes,2,opt,name=function_name,json=functionName,proto3" json:"function_name,omitempty"` // 要调用的函数名
Parameters []byte `protobuf:"bytes,3,opt,name=parameters,proto3" json:"parameters,omitempty"` // 序列化后的函数参数
CallId string `protobuf:"bytes,4,opt,name=call_id,json=callId,proto3" json:"call_id,omitempty"` // 调用ID用于关联响应
}
func (x *FunctionCallRequest) Reset() {
*x = FunctionCallRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_manifest_proto_rpc_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FunctionCallRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FunctionCallRequest) ProtoMessage() {}
func (x *FunctionCallRequest) ProtoReflect() protoreflect.Message {
mi := &file_manifest_proto_rpc_proto_msgTypes[4]
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 FunctionCallRequest.ProtoReflect.Descriptor instead.
func (*FunctionCallRequest) Descriptor() ([]byte, []int) {
return file_manifest_proto_rpc_proto_rawDescGZIP(), []int{4}
}
func (x *FunctionCallRequest) GetTargetClientId() string {
if x != nil {
return x.TargetClientId
}
return ""
}
func (x *FunctionCallRequest) GetFunctionName() string {
if x != nil {
return x.FunctionName
}
return ""
}
func (x *FunctionCallRequest) GetParameters() []byte {
if x != nil {
return x.Parameters
}
return nil
}
func (x *FunctionCallRequest) GetCallId() string {
if x != nil {
return x.CallId
}
return ""
}
// 函数调用响应 - 从B客户端返回给A客户端
type FunctionCallResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CallId string `protobuf:"bytes,1,opt,name=call_id,json=callId,proto3" json:"call_id,omitempty"` // 对应请求的调用ID
Success bool `protobuf:"varint,2,opt,name=success,proto3" json:"success,omitempty"` // 调用是否成功
Result []byte `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"` // 序列化后的返回结果
ErrorMessage string `protobuf:"bytes,4,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` // 错误消息(如果失败)
}
func (x *FunctionCallResponse) Reset() {
*x = FunctionCallResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_manifest_proto_rpc_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FunctionCallResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FunctionCallResponse) ProtoMessage() {}
func (x *FunctionCallResponse) ProtoReflect() protoreflect.Message {
mi := &file_manifest_proto_rpc_proto_msgTypes[5]
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 FunctionCallResponse.ProtoReflect.Descriptor instead.
func (*FunctionCallResponse) Descriptor() ([]byte, []int) {
return file_manifest_proto_rpc_proto_rawDescGZIP(), []int{5}
}
func (x *FunctionCallResponse) GetCallId() string {
if x != nil {
return x.CallId
}
return ""
}
func (x *FunctionCallResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *FunctionCallResponse) GetResult() []byte {
if x != nil {
return x.Result
}
return nil
}
func (x *FunctionCallResponse) GetErrorMessage() string {
if x != nil {
return x.ErrorMessage
}
return ""
}
// 通用消息
type GenericMessage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Types that are assignable to Payload:
//
// *GenericMessage_RegisterRequest
// *GenericMessage_RegisterResponse
// *GenericMessage_FunctionCallRequest
// *GenericMessage_FunctionCallResponse
// *GenericMessage_TextMessage
// *GenericMessage_KickResponse
// *GenericMessage_Sucess
Payload isGenericMessage_Payload `protobuf_oneof:"payload"`
}
func (x *GenericMessage) Reset() {
*x = GenericMessage{}
if protoimpl.UnsafeEnabled {
mi := &file_manifest_proto_rpc_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GenericMessage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GenericMessage) ProtoMessage() {}
func (x *GenericMessage) ProtoReflect() protoreflect.Message {
mi := &file_manifest_proto_rpc_proto_msgTypes[6]
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 GenericMessage.ProtoReflect.Descriptor instead.
func (*GenericMessage) Descriptor() ([]byte, []int) {
return file_manifest_proto_rpc_proto_rawDescGZIP(), []int{6}
}
func (m *GenericMessage) GetPayload() isGenericMessage_Payload {
if m != nil {
return m.Payload
}
return nil
}
func (x *GenericMessage) GetRegisterRequest() *RegisterUser {
if x, ok := x.GetPayload().(*GenericMessage_RegisterRequest); ok {
return x.RegisterRequest
}
return nil
}
func (x *GenericMessage) GetRegisterResponse() *RegisterResponse {
if x, ok := x.GetPayload().(*GenericMessage_RegisterResponse); ok {
return x.RegisterResponse
}
return nil
}
func (x *GenericMessage) GetFunctionCallRequest() *FunctionCallRequest {
if x, ok := x.GetPayload().(*GenericMessage_FunctionCallRequest); ok {
return x.FunctionCallRequest
}
return nil
}
func (x *GenericMessage) GetFunctionCallResponse() *FunctionCallResponse {
if x, ok := x.GetPayload().(*GenericMessage_FunctionCallResponse); ok {
return x.FunctionCallResponse
}
return nil
}
func (x *GenericMessage) GetTextMessage() string {
if x, ok := x.GetPayload().(*GenericMessage_TextMessage); ok {
return x.TextMessage
}
return ""
}
func (x *GenericMessage) GetKickResponse() *KickRequest {
if x, ok := x.GetPayload().(*GenericMessage_KickResponse); ok {
return x.KickResponse
}
return nil
}
func (x *GenericMessage) GetSucess() bool {
if x, ok := x.GetPayload().(*GenericMessage_Sucess); ok {
return x.Sucess
}
return false
}
type isGenericMessage_Payload interface {
isGenericMessage_Payload()
}
type GenericMessage_RegisterRequest struct {
RegisterRequest *RegisterUser `protobuf:"bytes,1,opt,name=register_request,json=registerRequest,proto3,oneof"`
}
type GenericMessage_RegisterResponse struct {
RegisterResponse *RegisterResponse `protobuf:"bytes,2,opt,name=register_response,json=registerResponse,proto3,oneof"`
}
type GenericMessage_FunctionCallRequest struct {
FunctionCallRequest *FunctionCallRequest `protobuf:"bytes,3,opt,name=function_call_request,json=functionCallRequest,proto3,oneof"`
}
type GenericMessage_FunctionCallResponse struct {
FunctionCallResponse *FunctionCallResponse `protobuf:"bytes,4,opt,name=function_call_response,json=functionCallResponse,proto3,oneof"`
}
type GenericMessage_TextMessage struct {
TextMessage string `protobuf:"bytes,5,opt,name=text_message,json=textMessage,proto3,oneof"` // 普通文本消息
}
type GenericMessage_KickResponse struct {
KickResponse *KickRequest `protobuf:"bytes,6,opt,name=kick_response,json=kickResponse,proto3,oneof"`
}
type GenericMessage_Sucess struct {
Sucess bool `protobuf:"varint,7,opt,name=sucess,proto3,oneof"`
}
func (*GenericMessage_RegisterRequest) isGenericMessage_Payload() {}
func (*GenericMessage_RegisterResponse) isGenericMessage_Payload() {}
func (*GenericMessage_FunctionCallRequest) isGenericMessage_Payload() {}
func (*GenericMessage_FunctionCallResponse) isGenericMessage_Payload() {}
func (*GenericMessage_TextMessage) isGenericMessage_Payload() {}
func (*GenericMessage_KickResponse) isGenericMessage_Payload() {}
func (*GenericMessage_Sucess) isGenericMessage_Payload() {}
var File_manifest_proto_rpc_proto protoreflect.FileDescriptor
var file_manifest_proto_rpc_proto_rawDesc = []byte{
0x0a, 0x18, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x2f, 0x72, 0x70, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x61, 0x70, 0x69, 0x22,
0x43, 0x0a, 0x0c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x12,
0x1a, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x75,
0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x75, 0x73,
0x65, 0x72, 0x49, 0x64, 0x22, 0x26, 0x0a, 0x0b, 0x4b, 0x69, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x9b, 0x01, 0x0a,
0x12, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
0x74, 0x6f, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x75, 0x6e, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75,
0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e,
0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75,
0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x75,
0x74, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63,
0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64,
0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x6f, 0x0a, 0x10, 0x52, 0x65,
0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18,
0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x67,
0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x9d, 0x01, 0x0a, 0x13,
0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x63, 0x6c,
0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74,
0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x23, 0x0a,
0x0d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61,
0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65,
0x72, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x61, 0x6c, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x61, 0x6c, 0x6c, 0x49, 0x64, 0x22, 0x86, 0x01, 0x0a, 0x14,
0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x61, 0x6c, 0x6c, 0x5f, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x61, 0x6c, 0x6c, 0x49, 0x64, 0x12, 0x18, 0x0a,
0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07,
0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c,
0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12,
0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x22, 0xbc, 0x03, 0x0a, 0x0e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63,
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3e, 0x0a, 0x10, 0x72, 0x65, 0x67, 0x69, 0x73,
0x74, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72,
0x55, 0x73, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x44, 0x0a, 0x11, 0x72, 0x65, 0x67, 0x69, 0x73,
0x74, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65,
0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x10, 0x72, 0x65, 0x67,
0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4e, 0x0a,
0x15, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x5f, 0x72,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x61, 0x6c, 0x6c, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x13, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x51, 0x0a,
0x16, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x5f, 0x72,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x61, 0x6c, 0x6c,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x14, 0x66, 0x75, 0x6e, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x23, 0x0a, 0x0c, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x74, 0x65, 0x78, 0x74, 0x4d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x37, 0x0a, 0x0d, 0x6b, 0x69, 0x63, 0x6b, 0x5f, 0x72, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00,
0x52, 0x0c, 0x6b, 0x69, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18,
0x0a, 0x06, 0x73, 0x75, 0x63, 0x65, 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00,
0x52, 0x06, 0x73, 0x75, 0x63, 0x65, 0x73, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c,
0x6f, 0x61, 0x64, 0x32, 0x4b, 0x0a, 0x13, 0x42, 0x6f, 0x74, 0x68, 0x57, 0x61, 0x79, 0x53, 0x74,
0x72, 0x65, 0x61, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x04, 0x43, 0x61,
0x6c, 0x6c, 0x12, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63,
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65,
0x6e, 0x65, 0x72, 0x69, 0x63, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x28, 0x01, 0x30, 0x01,
0x42, 0x0d, 0x5a, 0x0b, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_manifest_proto_rpc_proto_rawDescOnce sync.Once
file_manifest_proto_rpc_proto_rawDescData = file_manifest_proto_rpc_proto_rawDesc
)
func file_manifest_proto_rpc_proto_rawDescGZIP() []byte {
file_manifest_proto_rpc_proto_rawDescOnce.Do(func() {
file_manifest_proto_rpc_proto_rawDescData = protoimpl.X.CompressGZIP(file_manifest_proto_rpc_proto_rawDescData)
})
return file_manifest_proto_rpc_proto_rawDescData
}
var file_manifest_proto_rpc_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_manifest_proto_rpc_proto_goTypes = []any{
(*RegisterUser)(nil), // 0: api.RegisterUser
(*KickRequest)(nil), // 1: api.KickRequest
(*FunctionDescriptor)(nil), // 2: api.FunctionDescriptor
(*RegisterResponse)(nil), // 3: api.RegisterResponse
(*FunctionCallRequest)(nil), // 4: api.FunctionCallRequest
(*FunctionCallResponse)(nil), // 5: api.FunctionCallResponse
(*GenericMessage)(nil), // 6: api.GenericMessage
}
var file_manifest_proto_rpc_proto_depIdxs = []int32{
0, // 0: api.GenericMessage.register_request:type_name -> api.RegisterUser
3, // 1: api.GenericMessage.register_response:type_name -> api.RegisterResponse
4, // 2: api.GenericMessage.function_call_request:type_name -> api.FunctionCallRequest
5, // 3: api.GenericMessage.function_call_response:type_name -> api.FunctionCallResponse
1, // 4: api.GenericMessage.kick_response:type_name -> api.KickRequest
6, // 5: api.BothWayStreamServer.Call:input_type -> api.GenericMessage
6, // 6: api.BothWayStreamServer.Call:output_type -> api.GenericMessage
6, // [6:7] is the sub-list for method output_type
5, // [5:6] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_manifest_proto_rpc_proto_init() }
func file_manifest_proto_rpc_proto_init() {
if File_manifest_proto_rpc_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_manifest_proto_rpc_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*RegisterUser); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_manifest_proto_rpc_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*KickRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_manifest_proto_rpc_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*FunctionDescriptor); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_manifest_proto_rpc_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*RegisterResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_manifest_proto_rpc_proto_msgTypes[4].Exporter = func(v any, i int) any {
switch v := v.(*FunctionCallRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_manifest_proto_rpc_proto_msgTypes[5].Exporter = func(v any, i int) any {
switch v := v.(*FunctionCallResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_manifest_proto_rpc_proto_msgTypes[6].Exporter = func(v any, i int) any {
switch v := v.(*GenericMessage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_manifest_proto_rpc_proto_msgTypes[6].OneofWrappers = []any{
(*GenericMessage_RegisterRequest)(nil),
(*GenericMessage_RegisterResponse)(nil),
(*GenericMessage_FunctionCallRequest)(nil),
(*GenericMessage_FunctionCallResponse)(nil),
(*GenericMessage_TextMessage)(nil),
(*GenericMessage_KickResponse)(nil),
(*GenericMessage_Sucess)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_manifest_proto_rpc_proto_rawDesc,
NumEnums: 0,
NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_manifest_proto_rpc_proto_goTypes,
DependencyIndexes: file_manifest_proto_rpc_proto_depIdxs,
MessageInfos: file_manifest_proto_rpc_proto_msgTypes,
}.Build()
File_manifest_proto_rpc_proto = out.File
file_manifest_proto_rpc_proto_rawDesc = nil
file_manifest_proto_rpc_proto_goTypes = nil
file_manifest_proto_rpc_proto_depIdxs = nil
}

143
common/api/rpc_grpc.pb.go Normal file
View File

@@ -0,0 +1,143 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v3.20.0--rc1
// source: manifest/proto/rpc.proto
package api
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
const (
BothWayStreamServer_Call_FullMethodName = "/api.BothWayStreamServer/Call"
)
// BothWayStreamServerClient is the client API for BothWayStreamServer 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 BothWayStreamServerClient interface {
// 双向流连接 - 用于注册和函数调用
Call(ctx context.Context, opts ...grpc.CallOption) (BothWayStreamServer_CallClient, error)
}
type bothWayStreamServerClient struct {
cc grpc.ClientConnInterface
}
func NewBothWayStreamServerClient(cc grpc.ClientConnInterface) BothWayStreamServerClient {
return &bothWayStreamServerClient{cc}
}
func (c *bothWayStreamServerClient) Call(ctx context.Context, opts ...grpc.CallOption) (BothWayStreamServer_CallClient, error) {
stream, err := c.cc.NewStream(ctx, &BothWayStreamServer_ServiceDesc.Streams[0], BothWayStreamServer_Call_FullMethodName, opts...)
if err != nil {
return nil, err
}
x := &bothWayStreamServerCallClient{stream}
return x, nil
}
type BothWayStreamServer_CallClient interface {
Send(*GenericMessage) error
Recv() (*GenericMessage, error)
grpc.ClientStream
}
type bothWayStreamServerCallClient struct {
grpc.ClientStream
}
func (x *bothWayStreamServerCallClient) Send(m *GenericMessage) error {
return x.ClientStream.SendMsg(m)
}
func (x *bothWayStreamServerCallClient) Recv() (*GenericMessage, error) {
m := new(GenericMessage)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// BothWayStreamServerServer is the server API for BothWayStreamServer service.
// All implementations must embed UnimplementedBothWayStreamServerServer
// for forward compatibility
type BothWayStreamServerServer interface {
// 双向流连接 - 用于注册和函数调用
Call(BothWayStreamServer_CallServer) error
mustEmbedUnimplementedBothWayStreamServerServer()
}
// UnimplementedBothWayStreamServerServer must be embedded to have forward compatible implementations.
type UnimplementedBothWayStreamServerServer struct {
}
func (UnimplementedBothWayStreamServerServer) Call(BothWayStreamServer_CallServer) error {
return status.Errorf(codes.Unimplemented, "method Call not implemented")
}
func (UnimplementedBothWayStreamServerServer) mustEmbedUnimplementedBothWayStreamServerServer() {}
// UnsafeBothWayStreamServerServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to BothWayStreamServerServer will
// result in compilation errors.
type UnsafeBothWayStreamServerServer interface {
mustEmbedUnimplementedBothWayStreamServerServer()
}
func RegisterBothWayStreamServerServer(s grpc.ServiceRegistrar, srv BothWayStreamServerServer) {
s.RegisterService(&BothWayStreamServer_ServiceDesc, srv)
}
func _BothWayStreamServer_Call_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(BothWayStreamServerServer).Call(&bothWayStreamServerCallServer{stream})
}
type BothWayStreamServer_CallServer interface {
Send(*GenericMessage) error
Recv() (*GenericMessage, error)
grpc.ServerStream
}
type bothWayStreamServerCallServer struct {
grpc.ServerStream
}
func (x *bothWayStreamServerCallServer) Send(m *GenericMessage) error {
return x.ServerStream.SendMsg(m)
}
func (x *bothWayStreamServerCallServer) Recv() (*GenericMessage, error) {
m := new(GenericMessage)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// BothWayStreamServer_ServiceDesc is the grpc.ServiceDesc for BothWayStreamServer service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var BothWayStreamServer_ServiceDesc = grpc.ServiceDesc{
ServiceName: "api.BothWayStreamServer",
HandlerType: (*BothWayStreamServerServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "Call",
Handler: _BothWayStreamServer_Call_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "manifest/proto/rpc.proto",
}