chore: 初始开源发布

iotlcm-upstream-chan:运营商上游通道适配服务(统一 /sim/* 协议)。

- 内联原私有依赖:yunze-public → internal/pub/(10 包 18 文件),
  yunze-pb/pb → internal/pb/(9 文件);Consul 注册改用官方
  gogf/gf/contrib/registry/consul/v2(API 兼容)
- Go module:yz-svr → git.5iot.com/iotlcm-public/iotlcm-upstream-chan
- 修复 mingqian 包测试:实现重构后 `adapter.operations` 字段已移除,
  测试断言按当前实现语义重写(不改产品行为)
- 凭据与内部标识脱敏:MySQL/Redis/Consul 凭据、私网与生产 IP、
  内网域名、真实手机号、注释里的真实 token/transid
- 移除内部资产:CI 触发器、生产通道种子 SQL、真实凭据测试资源文档
- Dockerfile 改用公共基础镜像,移除写死的 registry 凭据
- 补 Apache-2.0 LICENSE,重写 README,LF 行尾 + .gitattributes
This commit is contained in:
MiFaZhan
2026-10-22 15:42:29 +08:00
commit 96b1edff45
191 changed files with 30805 additions and 0 deletions
+206
View File
@@ -0,0 +1,206 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v5.29.3
// source: common.proto
package pb
import (
reflect "reflect"
sync "sync"
unsafe "unsafe"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
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 HeadReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
RouterId int64 `protobuf:"varint,1,opt,name=router_id,json=routerId,proto3" json:"router_id,omitempty" dc:"路由id json:'router_id'"` // 路由id json:"router_id"
TraceId string `protobuf:"bytes,2,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty" dc:"追踪id json:'trace_id'"` // 追踪id json:"trace_id"
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *HeadReq) Reset() {
*x = HeadReq{}
mi := &file_common_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *HeadReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HeadReq) ProtoMessage() {}
func (x *HeadReq) ProtoReflect() protoreflect.Message {
mi := &file_common_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HeadReq.ProtoReflect.Descriptor instead.
func (*HeadReq) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{0}
}
func (x *HeadReq) GetRouterId() int64 {
if x != nil {
return x.RouterId
}
return 0
}
func (x *HeadReq) GetTraceId() string {
if x != nil {
return x.TraceId
}
return ""
}
type HeadRes struct {
state protoimpl.MessageState `protogen:"open.v1"`
Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty" dc:"错误码 json:'code'"` // 错误码 json:"code"
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty" dc:"错误信息 json:'message'"` // 错误信息 json:"message"
RouterId int64 `protobuf:"varint,3,opt,name=router_id,json=routerId,proto3" json:"router_id,omitempty" dc:"路由id json:'router_id'"` // 路由id json:"router_id"
TraceId string `protobuf:"bytes,4,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty" dc:"追踪id json:'trace_id'"` // 追踪id json:"trace_id"
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *HeadRes) Reset() {
*x = HeadRes{}
mi := &file_common_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *HeadRes) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HeadRes) ProtoMessage() {}
func (x *HeadRes) ProtoReflect() protoreflect.Message {
mi := &file_common_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HeadRes.ProtoReflect.Descriptor instead.
func (*HeadRes) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{1}
}
func (x *HeadRes) GetCode() int32 {
if x != nil {
return x.Code
}
return 0
}
func (x *HeadRes) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
func (x *HeadRes) GetRouterId() int64 {
if x != nil {
return x.RouterId
}
return 0
}
func (x *HeadRes) GetTraceId() string {
if x != nil {
return x.TraceId
}
return ""
}
var File_common_proto protoreflect.FileDescriptor
const file_common_proto_rawDesc = "" +
"\n" +
"\fcommon.proto\x12\bPbCommon\"A\n" +
"\aHeadReq\x12\x1b\n" +
"\trouter_id\x18\x01 \x01(\x03R\brouterId\x12\x19\n" +
"\btrace_id\x18\x02 \x01(\tR\atraceId\"o\n" +
"\aHeadRes\x12\x12\n" +
"\x04code\x18\x01 \x01(\x05R\x04code\x12\x18\n" +
"\amessage\x18\x02 \x01(\tR\amessage\x12\x1b\n" +
"\trouter_id\x18\x03 \x01(\x03R\brouterId\x12\x19\n" +
"\btrace_id\x18\x04 \x01(\tR\atraceIdB\x05Z\x03pb/b\x06proto3"
var (
file_common_proto_rawDescOnce sync.Once
file_common_proto_rawDescData []byte
)
func file_common_proto_rawDescGZIP() []byte {
file_common_proto_rawDescOnce.Do(func() {
file_common_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_common_proto_rawDesc), len(file_common_proto_rawDesc)))
})
return file_common_proto_rawDescData
}
var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_common_proto_goTypes = []any{
(*HeadReq)(nil), // 0: PbCommon.HeadReq
(*HeadRes)(nil), // 1: PbCommon.HeadRes
}
var file_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_common_proto_init() }
func file_common_proto_init() {
if File_common_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_common_proto_rawDesc), len(file_common_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_common_proto_goTypes,
DependencyIndexes: file_common_proto_depIdxs,
MessageInfos: file_common_proto_msgTypes,
}.Build()
File_common_proto = out.File
file_common_proto_goTypes = nil
file_common_proto_depIdxs = nil
}
+257
View File
@@ -0,0 +1,257 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v5.29.3
// source: info.proto
package pb
import (
reflect "reflect"
sync "sync"
unsafe "unsafe"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
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 InfoReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Head *HeadReq `protobuf:"bytes,1,opt,name=head,proto3" json:"head,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *InfoReq) Reset() {
*x = InfoReq{}
mi := &file_info_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *InfoReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*InfoReq) ProtoMessage() {}
func (x *InfoReq) ProtoReflect() protoreflect.Message {
mi := &file_info_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use InfoReq.ProtoReflect.Descriptor instead.
func (*InfoReq) Descriptor() ([]byte, []int) {
return file_info_proto_rawDescGZIP(), []int{0}
}
func (x *InfoReq) GetHead() *HeadReq {
if x != nil {
return x.Head
}
return nil
}
type InfoRes struct {
state protoimpl.MessageState `protogen:"open.v1"`
Head *HeadRes `protobuf:"bytes,1,opt,name=head,proto3" json:"head,omitempty"`
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"`
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"`
Build string `protobuf:"bytes,7,opt,name=build,proto3" json:"build,omitempty"`
Commit string `protobuf:"bytes,8,opt,name=commit,proto3" json:"commit,omitempty"`
Data map[string]string `protobuf:"bytes,9,rep,name=data,proto3" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *InfoRes) Reset() {
*x = InfoRes{}
mi := &file_info_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *InfoRes) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*InfoRes) ProtoMessage() {}
func (x *InfoRes) ProtoReflect() protoreflect.Message {
mi := &file_info_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use InfoRes.ProtoReflect.Descriptor instead.
func (*InfoRes) Descriptor() ([]byte, []int) {
return file_info_proto_rawDescGZIP(), []int{1}
}
func (x *InfoRes) GetHead() *HeadRes {
if x != nil {
return x.Head
}
return nil
}
func (x *InfoRes) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *InfoRes) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *InfoRes) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *InfoRes) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *InfoRes) GetVersion() string {
if x != nil {
return x.Version
}
return ""
}
func (x *InfoRes) GetBuild() string {
if x != nil {
return x.Build
}
return ""
}
func (x *InfoRes) GetCommit() string {
if x != nil {
return x.Commit
}
return ""
}
func (x *InfoRes) GetData() map[string]string {
if x != nil {
return x.Data
}
return nil
}
var File_info_proto protoreflect.FileDescriptor
const file_info_proto_rawDesc = "" +
"\n" +
"\n" +
"info.proto\x12\x06PbInfo\x1a\fcommon.proto\"0\n" +
"\aInfoReq\x12%\n" +
"\x04head\x18\x01 \x01(\v2\x11.PbCommon.HeadReqR\x04head\"\xc0\x02\n" +
"\aInfoRes\x12%\n" +
"\x04head\x18\x01 \x01(\v2\x11.PbCommon.HeadResR\x04head\x12\x12\n" +
"\x04type\x18\x02 \x01(\tR\x04type\x12\x12\n" +
"\x04name\x18\x03 \x01(\tR\x04name\x12\x14\n" +
"\x05title\x18\x04 \x01(\tR\x05title\x12 \n" +
"\vdescription\x18\x05 \x01(\tR\vdescription\x12\x18\n" +
"\aversion\x18\x06 \x01(\tR\aversion\x12\x14\n" +
"\x05build\x18\a \x01(\tR\x05build\x12\x16\n" +
"\x06commit\x18\b \x01(\tR\x06commit\x12-\n" +
"\x04data\x18\t \x03(\v2\x19.PbInfo.InfoRes.DataEntryR\x04data\x1a7\n" +
"\tDataEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x0122\n" +
"\x04Info\x12*\n" +
"\x04Info\x12\x0f.PbInfo.InfoReq\x1a\x0f.PbInfo.InfoRes\"\x00B\x05Z\x03pb/b\x06proto3"
var (
file_info_proto_rawDescOnce sync.Once
file_info_proto_rawDescData []byte
)
func file_info_proto_rawDescGZIP() []byte {
file_info_proto_rawDescOnce.Do(func() {
file_info_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_info_proto_rawDesc), len(file_info_proto_rawDesc)))
})
return file_info_proto_rawDescData
}
var file_info_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_info_proto_goTypes = []any{
(*InfoReq)(nil), // 0: PbInfo.InfoReq
(*InfoRes)(nil), // 1: PbInfo.InfoRes
nil, // 2: PbInfo.InfoRes.DataEntry
(*HeadReq)(nil), // 3: PbCommon.HeadReq
(*HeadRes)(nil), // 4: PbCommon.HeadRes
}
var file_info_proto_depIdxs = []int32{
3, // 0: PbInfo.InfoReq.head:type_name -> PbCommon.HeadReq
4, // 1: PbInfo.InfoRes.head:type_name -> PbCommon.HeadRes
2, // 2: PbInfo.InfoRes.data:type_name -> PbInfo.InfoRes.DataEntry
0, // 3: PbInfo.Info.Info:input_type -> PbInfo.InfoReq
1, // 4: PbInfo.Info.Info:output_type -> PbInfo.InfoRes
4, // [4:5] is the sub-list for method output_type
3, // [3:4] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_info_proto_init() }
func file_info_proto_init() {
if File_info_proto != nil {
return
}
file_common_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_info_proto_rawDesc), len(file_info_proto_rawDesc)),
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_info_proto_goTypes,
DependencyIndexes: file_info_proto_depIdxs,
MessageInfos: file_info_proto_msgTypes,
}.Build()
File_info_proto = out.File
file_info_proto_goTypes = nil
file_info_proto_depIdxs = nil
}
+122
View File
@@ -0,0 +1,122 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc v5.29.3
// source: info.proto
package 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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Info_Info_FullMethodName = "/PbInfo.Info/Info"
)
// InfoClient is the client API for Info 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 InfoClient interface {
Info(ctx context.Context, in *InfoReq, opts ...grpc.CallOption) (*InfoRes, error)
}
type infoClient struct {
cc grpc.ClientConnInterface
}
func NewInfoClient(cc grpc.ClientConnInterface) InfoClient {
return &infoClient{cc}
}
func (c *infoClient) Info(ctx context.Context, in *InfoReq, opts ...grpc.CallOption) (*InfoRes, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(InfoRes)
err := c.cc.Invoke(ctx, Info_Info_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// InfoServer is the server API for Info service.
// All implementations must embed UnimplementedInfoServer
// for forward compatibility.
type InfoServer interface {
Info(context.Context, *InfoReq) (*InfoRes, error)
mustEmbedUnimplementedInfoServer()
}
// UnimplementedInfoServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedInfoServer struct{}
func (UnimplementedInfoServer) Info(context.Context, *InfoReq) (*InfoRes, error) {
return nil, status.Error(codes.Unimplemented, "method Info not implemented")
}
func (UnimplementedInfoServer) mustEmbedUnimplementedInfoServer() {}
func (UnimplementedInfoServer) testEmbeddedByValue() {}
// UnsafeInfoServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to InfoServer will
// result in compilation errors.
type UnsafeInfoServer interface {
mustEmbedUnimplementedInfoServer()
}
func RegisterInfoServer(s grpc.ServiceRegistrar, srv InfoServer) {
// If the following call panics, it indicates UnimplementedInfoServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Info_ServiceDesc, srv)
}
func _Info_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(InfoReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(InfoServer).Info(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Info_Info_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(InfoServer).Info(ctx, req.(*InfoReq))
}
return interceptor(ctx, in, info, handler)
}
// Info_ServiceDesc is the grpc.ServiceDesc for Info service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Info_ServiceDesc = grpc.ServiceDesc{
ServiceName: "PbInfo.Info",
HandlerType: (*InfoServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Info",
Handler: _Info_Info_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "info.proto",
}
+632
View File
@@ -0,0 +1,632 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v5.29.3
// source: msgbus.proto
package pb
import (
reflect "reflect"
sync "sync"
unsafe "unsafe"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
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 EnumMsgType int32
const (
EnumMsgType_MsgTypeNone EnumMsgType = 0 // 未知消息类型
EnumMsgType_MsgTypeLogin EnumMsgType = 1 // 客户端长连接登录包
EnumMsgType_MsgTypeLogout EnumMsgType = 2 // 客户端长连接登出包
EnumMsgType_MsgTypeConnect EnumMsgType = 3 // 新建链接消息
EnumMsgType_MsgTypeDisconnect EnumMsgType = 4 // 关闭链接消息
EnumMsgType_MsgTypeData EnumMsgType = 5 // 消息透传转发
)
// Enum value maps for EnumMsgType.
var (
EnumMsgType_name = map[int32]string{
0: "MsgTypeNone",
1: "MsgTypeLogin",
2: "MsgTypeLogout",
3: "MsgTypeConnect",
4: "MsgTypeDisconnect",
5: "MsgTypeData",
}
EnumMsgType_value = map[string]int32{
"MsgTypeNone": 0,
"MsgTypeLogin": 1,
"MsgTypeLogout": 2,
"MsgTypeConnect": 3,
"MsgTypeDisconnect": 4,
"MsgTypeData": 5,
}
)
func (x EnumMsgType) Enum() *EnumMsgType {
p := new(EnumMsgType)
*p = x
return p
}
func (x EnumMsgType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (EnumMsgType) Descriptor() protoreflect.EnumDescriptor {
return file_msgbus_proto_enumTypes[0].Descriptor()
}
func (EnumMsgType) Type() protoreflect.EnumType {
return &file_msgbus_proto_enumTypes[0]
}
func (x EnumMsgType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use EnumMsgType.Descriptor instead.
func (EnumMsgType) EnumDescriptor() ([]byte, []int) {
return file_msgbus_proto_rawDescGZIP(), []int{0}
}
// 渠道类型
type EnumChannelType int32
const (
EnumChannelType_ChannelTypeNone EnumChannelType = 0
EnumChannelType_ChannelTypeMqtt EnumChannelType = 1 // 1-MQTT服务器
EnumChannelType_ChannelTypeTcp EnumChannelType = 2 // 2-TCP服务器
EnumChannelType_ChannelTypeUdp EnumChannelType = 3 // 3-UDP服务器
EnumChannelType_ChannelTypeHttp EnumChannelType = 4 // 4-HTTP服务
EnumChannelType_ChannelTypeWs EnumChannelType = 5 // 5-WebSocket服务
EnumChannelType_ChannelTypeDb EnumChannelType = 6 // 6-数据库服务
EnumChannelType_ChannelTypeInner EnumChannelType = 100 // 100-内网流转通道
)
// Enum value maps for EnumChannelType.
var (
EnumChannelType_name = map[int32]string{
0: "ChannelTypeNone",
1: "ChannelTypeMqtt",
2: "ChannelTypeTcp",
3: "ChannelTypeUdp",
4: "ChannelTypeHttp",
5: "ChannelTypeWs",
6: "ChannelTypeDb",
100: "ChannelTypeInner",
}
EnumChannelType_value = map[string]int32{
"ChannelTypeNone": 0,
"ChannelTypeMqtt": 1,
"ChannelTypeTcp": 2,
"ChannelTypeUdp": 3,
"ChannelTypeHttp": 4,
"ChannelTypeWs": 5,
"ChannelTypeDb": 6,
"ChannelTypeInner": 100,
}
)
func (x EnumChannelType) Enum() *EnumChannelType {
p := new(EnumChannelType)
*p = x
return p
}
func (x EnumChannelType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (EnumChannelType) Descriptor() protoreflect.EnumDescriptor {
return file_msgbus_proto_enumTypes[1].Descriptor()
}
func (EnumChannelType) Type() protoreflect.EnumType {
return &file_msgbus_proto_enumTypes[1]
}
func (x EnumChannelType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use EnumChannelType.Descriptor instead.
func (EnumChannelType) EnumDescriptor() ([]byte, []int) {
return file_msgbus_proto_rawDescGZIP(), []int{1}
}
// 渠道信息
type Channel struct {
state protoimpl.MessageState `protogen:"open.v1"`
ChannelId int64 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" dc:"渠道ID"` // 渠道ID
ChannelType int32 `protobuf:"varint,2,opt,name=channel_type,json=channelType,proto3" json:"channel_type,omitempty" dc:"渠道类型 EnumChannelType"` // 渠道类型 EnumChannelType
ServerId int64 `protobuf:"varint,3,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty" dc:"服务ID"` // 服务ID
CreateTime int64 `protobuf:"varint,4,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty" dc:"启动时间戳(秒)"` // 启动时间戳(秒)
TenantId string `protobuf:"bytes,5,opt,name=tenant_id,json=tenantId,proto3" json:"tenant_id,omitempty" dc:"租户ID"` // 租户ID
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Channel) Reset() {
*x = Channel{}
mi := &file_msgbus_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Channel) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Channel) ProtoMessage() {}
func (x *Channel) ProtoReflect() protoreflect.Message {
mi := &file_msgbus_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Channel.ProtoReflect.Descriptor instead.
func (*Channel) Descriptor() ([]byte, []int) {
return file_msgbus_proto_rawDescGZIP(), []int{0}
}
func (x *Channel) GetChannelId() int64 {
if x != nil {
return x.ChannelId
}
return 0
}
func (x *Channel) GetChannelType() int32 {
if x != nil {
return x.ChannelType
}
return 0
}
func (x *Channel) GetServerId() int64 {
if x != nil {
return x.ServerId
}
return 0
}
func (x *Channel) GetCreateTime() int64 {
if x != nil {
return x.CreateTime
}
return 0
}
func (x *Channel) GetTenantId() string {
if x != nil {
return x.TenantId
}
return ""
}
// 链接信息
type Conn struct {
state protoimpl.MessageState `protogen:"open.v1"`
ConnId int64 `protobuf:"varint,1,opt,name=conn_id,json=connId,proto3" json:"conn_id,omitempty" dc:"链接ID"` // 链接ID
CreateTime int64 `protobuf:"varint,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty" dc:"链接时间戳(秒)"` // 链接时间戳(秒)
LastRecvTime int64 `protobuf:"varint,3,opt,name=last_recv_time,json=lastRecvTime,proto3" json:"last_recv_time,omitempty" dc:"最后接收时间戳(秒)"` // 最后接收时间戳(秒)
LastSendTime int64 `protobuf:"varint,4,opt,name=last_send_time,json=lastSendTime,proto3" json:"last_send_time,omitempty" dc:"最后发送时间戳(秒)"` // 最后发送时间戳(秒)
ClientId string `protobuf:"bytes,5,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" dc:"客户端ID"` // 客户端ID
UserName string `protobuf:"bytes,6,opt,name=user_name,json=userName,proto3" json:"user_name,omitempty" dc:"客户端登录名称"` // 客户端登录名称
UserPass string `protobuf:"bytes,7,opt,name=user_pass,json=userPass,proto3" json:"user_pass,omitempty" dc:"客户端登录密码"` // 客户端登录密码
ProductKey string `protobuf:"bytes,8,opt,name=product_key,json=productKey,proto3" json:"product_key,omitempty" dc:"绑定主产品KEY"` // 绑定主产品KEY
DeviceKey string `protobuf:"bytes,9,opt,name=device_key,json=deviceKey,proto3" json:"device_key,omitempty" dc:"绑定主设备KEY"` // 绑定主设备KEY
RemoteAddr string `protobuf:"bytes,10,opt,name=remote_addr,json=remoteAddr,proto3" json:"remote_addr,omitempty"`
LocalAddr string `protobuf:"bytes,11,opt,name=local_addr,json=localAddr,proto3" json:"local_addr,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Conn) Reset() {
*x = Conn{}
mi := &file_msgbus_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Conn) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Conn) ProtoMessage() {}
func (x *Conn) ProtoReflect() protoreflect.Message {
mi := &file_msgbus_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Conn.ProtoReflect.Descriptor instead.
func (*Conn) Descriptor() ([]byte, []int) {
return file_msgbus_proto_rawDescGZIP(), []int{1}
}
func (x *Conn) GetConnId() int64 {
if x != nil {
return x.ConnId
}
return 0
}
func (x *Conn) GetCreateTime() int64 {
if x != nil {
return x.CreateTime
}
return 0
}
func (x *Conn) GetLastRecvTime() int64 {
if x != nil {
return x.LastRecvTime
}
return 0
}
func (x *Conn) GetLastSendTime() int64 {
if x != nil {
return x.LastSendTime
}
return 0
}
func (x *Conn) GetClientId() string {
if x != nil {
return x.ClientId
}
return ""
}
func (x *Conn) GetUserName() string {
if x != nil {
return x.UserName
}
return ""
}
func (x *Conn) GetUserPass() string {
if x != nil {
return x.UserPass
}
return ""
}
func (x *Conn) GetProductKey() string {
if x != nil {
return x.ProductKey
}
return ""
}
func (x *Conn) GetDeviceKey() string {
if x != nil {
return x.DeviceKey
}
return ""
}
func (x *Conn) GetRemoteAddr() string {
if x != nil {
return x.RemoteAddr
}
return ""
}
func (x *Conn) GetLocalAddr() string {
if x != nil {
return x.LocalAddr
}
return ""
}
type SendMsgReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Head *HeadReq `protobuf:"bytes,1,opt,name=head,proto3" json:"head,omitempty"`
Channel *Channel `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty" dc:"渠道信息"` // 渠道信息
Conn *Conn `protobuf:"bytes,3,opt,name=conn,proto3" json:"conn,omitempty" dc:"链接信息"` // 链接信息
MsgType int32 `protobuf:"varint,4,opt,name=msg_type,json=msgType,proto3" json:"msg_type,omitempty" dc:"消息类型"` // 消息类型
Topic string `protobuf:"bytes,5,opt,name=topic,proto3" json:"topic,omitempty"`
Data []byte `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SendMsgReq) Reset() {
*x = SendMsgReq{}
mi := &file_msgbus_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SendMsgReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SendMsgReq) ProtoMessage() {}
func (x *SendMsgReq) ProtoReflect() protoreflect.Message {
mi := &file_msgbus_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SendMsgReq.ProtoReflect.Descriptor instead.
func (*SendMsgReq) Descriptor() ([]byte, []int) {
return file_msgbus_proto_rawDescGZIP(), []int{2}
}
func (x *SendMsgReq) GetHead() *HeadReq {
if x != nil {
return x.Head
}
return nil
}
func (x *SendMsgReq) GetChannel() *Channel {
if x != nil {
return x.Channel
}
return nil
}
func (x *SendMsgReq) GetConn() *Conn {
if x != nil {
return x.Conn
}
return nil
}
func (x *SendMsgReq) GetMsgType() int32 {
if x != nil {
return x.MsgType
}
return 0
}
func (x *SendMsgReq) GetTopic() string {
if x != nil {
return x.Topic
}
return ""
}
func (x *SendMsgReq) GetData() []byte {
if x != nil {
return x.Data
}
return nil
}
type SendMsgRes struct {
state protoimpl.MessageState `protogen:"open.v1"`
Head *HeadRes `protobuf:"bytes,1,opt,name=head,proto3" json:"head,omitempty"`
Conn *Conn `protobuf:"bytes,2,opt,name=conn,proto3" json:"conn,omitempty"`
Topic string `protobuf:"bytes,3,opt,name=topic,proto3" json:"topic,omitempty"`
Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SendMsgRes) Reset() {
*x = SendMsgRes{}
mi := &file_msgbus_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SendMsgRes) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SendMsgRes) ProtoMessage() {}
func (x *SendMsgRes) ProtoReflect() protoreflect.Message {
mi := &file_msgbus_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SendMsgRes.ProtoReflect.Descriptor instead.
func (*SendMsgRes) Descriptor() ([]byte, []int) {
return file_msgbus_proto_rawDescGZIP(), []int{3}
}
func (x *SendMsgRes) GetHead() *HeadRes {
if x != nil {
return x.Head
}
return nil
}
func (x *SendMsgRes) GetConn() *Conn {
if x != nil {
return x.Conn
}
return nil
}
func (x *SendMsgRes) GetTopic() string {
if x != nil {
return x.Topic
}
return ""
}
func (x *SendMsgRes) GetData() []byte {
if x != nil {
return x.Data
}
return nil
}
var File_msgbus_proto protoreflect.FileDescriptor
const file_msgbus_proto_rawDesc = "" +
"\n" +
"\fmsgbus.proto\x12\bPbMsgBus\x1a\fcommon.proto\"\xa6\x01\n" +
"\aChannel\x12\x1d\n" +
"\n" +
"channel_id\x18\x01 \x01(\x03R\tchannelId\x12!\n" +
"\fchannel_type\x18\x02 \x01(\x05R\vchannelType\x12\x1b\n" +
"\tserver_id\x18\x03 \x01(\x03R\bserverId\x12\x1f\n" +
"\vcreate_time\x18\x04 \x01(\x03R\n" +
"createTime\x12\x1b\n" +
"\ttenant_id\x18\x05 \x01(\tR\btenantId\"\xe3\x02\n" +
"\x04Conn\x12\x17\n" +
"\aconn_id\x18\x01 \x01(\x03R\x06connId\x12\x1f\n" +
"\vcreate_time\x18\x02 \x01(\x03R\n" +
"createTime\x12$\n" +
"\x0elast_recv_time\x18\x03 \x01(\x03R\flastRecvTime\x12$\n" +
"\x0elast_send_time\x18\x04 \x01(\x03R\flastSendTime\x12\x1b\n" +
"\tclient_id\x18\x05 \x01(\tR\bclientId\x12\x1b\n" +
"\tuser_name\x18\x06 \x01(\tR\buserName\x12\x1b\n" +
"\tuser_pass\x18\a \x01(\tR\buserPass\x12\x1f\n" +
"\vproduct_key\x18\b \x01(\tR\n" +
"productKey\x12\x1d\n" +
"\n" +
"device_key\x18\t \x01(\tR\tdeviceKey\x12\x1f\n" +
"\vremote_addr\x18\n" +
" \x01(\tR\n" +
"remoteAddr\x12\x1d\n" +
"\n" +
"local_addr\x18\v \x01(\tR\tlocalAddr\"\xc9\x01\n" +
"\n" +
"SendMsgReq\x12%\n" +
"\x04head\x18\x01 \x01(\v2\x11.PbCommon.HeadReqR\x04head\x12+\n" +
"\achannel\x18\x02 \x01(\v2\x11.PbMsgBus.ChannelR\achannel\x12\"\n" +
"\x04conn\x18\x03 \x01(\v2\x0e.PbMsgBus.ConnR\x04conn\x12\x19\n" +
"\bmsg_type\x18\x04 \x01(\x05R\amsgType\x12\x14\n" +
"\x05topic\x18\x05 \x01(\tR\x05topic\x12\x12\n" +
"\x04data\x18\x06 \x01(\fR\x04data\"\x81\x01\n" +
"\n" +
"SendMsgRes\x12%\n" +
"\x04head\x18\x01 \x01(\v2\x11.PbCommon.HeadResR\x04head\x12\"\n" +
"\x04conn\x18\x02 \x01(\v2\x0e.PbMsgBus.ConnR\x04conn\x12\x14\n" +
"\x05topic\x18\x03 \x01(\tR\x05topic\x12\x12\n" +
"\x04data\x18\x04 \x01(\fR\x04data*\x7f\n" +
"\vEnumMsgType\x12\x0f\n" +
"\vMsgTypeNone\x10\x00\x12\x10\n" +
"\fMsgTypeLogin\x10\x01\x12\x11\n" +
"\rMsgTypeLogout\x10\x02\x12\x12\n" +
"\x0eMsgTypeConnect\x10\x03\x12\x15\n" +
"\x11MsgTypeDisconnect\x10\x04\x12\x0f\n" +
"\vMsgTypeData\x10\x05*\xb4\x01\n" +
"\x0fEnumChannelType\x12\x13\n" +
"\x0fChannelTypeNone\x10\x00\x12\x13\n" +
"\x0fChannelTypeMqtt\x10\x01\x12\x12\n" +
"\x0eChannelTypeTcp\x10\x02\x12\x12\n" +
"\x0eChannelTypeUdp\x10\x03\x12\x13\n" +
"\x0fChannelTypeHttp\x10\x04\x12\x11\n" +
"\rChannelTypeWs\x10\x05\x12\x11\n" +
"\rChannelTypeDb\x10\x06\x12\x14\n" +
"\x10ChannelTypeInner\x10d2x\n" +
"\x06MsgBus\x122\n" +
"\x04Send\x12\x14.PbMsgBus.SendMsgReq\x1a\x14.PbMsgBus.SendMsgRes\x12:\n" +
"\bLongSend\x12\x14.PbMsgBus.SendMsgReq\x1a\x14.PbMsgBus.SendMsgRes(\x010\x01B\x05Z\x03pb/b\x06proto3"
var (
file_msgbus_proto_rawDescOnce sync.Once
file_msgbus_proto_rawDescData []byte
)
func file_msgbus_proto_rawDescGZIP() []byte {
file_msgbus_proto_rawDescOnce.Do(func() {
file_msgbus_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_msgbus_proto_rawDesc), len(file_msgbus_proto_rawDesc)))
})
return file_msgbus_proto_rawDescData
}
var file_msgbus_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_msgbus_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_msgbus_proto_goTypes = []any{
(EnumMsgType)(0), // 0: PbMsgBus.EnumMsgType
(EnumChannelType)(0), // 1: PbMsgBus.EnumChannelType
(*Channel)(nil), // 2: PbMsgBus.Channel
(*Conn)(nil), // 3: PbMsgBus.Conn
(*SendMsgReq)(nil), // 4: PbMsgBus.SendMsgReq
(*SendMsgRes)(nil), // 5: PbMsgBus.SendMsgRes
(*HeadReq)(nil), // 6: PbCommon.HeadReq
(*HeadRes)(nil), // 7: PbCommon.HeadRes
}
var file_msgbus_proto_depIdxs = []int32{
6, // 0: PbMsgBus.SendMsgReq.head:type_name -> PbCommon.HeadReq
2, // 1: PbMsgBus.SendMsgReq.channel:type_name -> PbMsgBus.Channel
3, // 2: PbMsgBus.SendMsgReq.conn:type_name -> PbMsgBus.Conn
7, // 3: PbMsgBus.SendMsgRes.head:type_name -> PbCommon.HeadRes
3, // 4: PbMsgBus.SendMsgRes.conn:type_name -> PbMsgBus.Conn
4, // 5: PbMsgBus.MsgBus.Send:input_type -> PbMsgBus.SendMsgReq
4, // 6: PbMsgBus.MsgBus.LongSend:input_type -> PbMsgBus.SendMsgReq
5, // 7: PbMsgBus.MsgBus.Send:output_type -> PbMsgBus.SendMsgRes
5, // 8: PbMsgBus.MsgBus.LongSend:output_type -> PbMsgBus.SendMsgRes
7, // [7:9] is the sub-list for method output_type
5, // [5:7] 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_msgbus_proto_init() }
func file_msgbus_proto_init() {
if File_msgbus_proto != nil {
return
}
file_common_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_msgbus_proto_rawDesc), len(file_msgbus_proto_rawDesc)),
NumEnums: 2,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_msgbus_proto_goTypes,
DependencyIndexes: file_msgbus_proto_depIdxs,
EnumInfos: file_msgbus_proto_enumTypes,
MessageInfos: file_msgbus_proto_msgTypes,
}.Build()
File_msgbus_proto = out.File
file_msgbus_proto_goTypes = nil
file_msgbus_proto_depIdxs = nil
}
+155
View File
@@ -0,0 +1,155 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc v5.29.3
// source: msgbus.proto
package 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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
MsgBus_Send_FullMethodName = "/PbMsgBus.MsgBus/Send"
MsgBus_LongSend_FullMethodName = "/PbMsgBus.MsgBus/LongSend"
)
// MsgBusClient is the client API for MsgBus 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 MsgBusClient interface {
Send(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgRes, error)
LongSend(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SendMsgReq, SendMsgRes], error)
}
type msgBusClient struct {
cc grpc.ClientConnInterface
}
func NewMsgBusClient(cc grpc.ClientConnInterface) MsgBusClient {
return &msgBusClient{cc}
}
func (c *msgBusClient) Send(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgRes, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SendMsgRes)
err := c.cc.Invoke(ctx, MsgBus_Send_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgBusClient) LongSend(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SendMsgReq, SendMsgRes], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &MsgBus_ServiceDesc.Streams[0], MsgBus_LongSend_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[SendMsgReq, SendMsgRes]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type MsgBus_LongSendClient = grpc.BidiStreamingClient[SendMsgReq, SendMsgRes]
// MsgBusServer is the server API for MsgBus service.
// All implementations must embed UnimplementedMsgBusServer
// for forward compatibility.
type MsgBusServer interface {
Send(context.Context, *SendMsgReq) (*SendMsgRes, error)
LongSend(grpc.BidiStreamingServer[SendMsgReq, SendMsgRes]) error
mustEmbedUnimplementedMsgBusServer()
}
// UnimplementedMsgBusServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedMsgBusServer struct{}
func (UnimplementedMsgBusServer) Send(context.Context, *SendMsgReq) (*SendMsgRes, error) {
return nil, status.Error(codes.Unimplemented, "method Send not implemented")
}
func (UnimplementedMsgBusServer) LongSend(grpc.BidiStreamingServer[SendMsgReq, SendMsgRes]) error {
return status.Error(codes.Unimplemented, "method LongSend not implemented")
}
func (UnimplementedMsgBusServer) mustEmbedUnimplementedMsgBusServer() {}
func (UnimplementedMsgBusServer) testEmbeddedByValue() {}
// UnsafeMsgBusServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgBusServer will
// result in compilation errors.
type UnsafeMsgBusServer interface {
mustEmbedUnimplementedMsgBusServer()
}
func RegisterMsgBusServer(s grpc.ServiceRegistrar, srv MsgBusServer) {
// If the following call panics, it indicates UnimplementedMsgBusServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&MsgBus_ServiceDesc, srv)
}
func _MsgBus_Send_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SendMsgReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgBusServer).Send(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: MsgBus_Send_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgBusServer).Send(ctx, req.(*SendMsgReq))
}
return interceptor(ctx, in, info, handler)
}
func _MsgBus_LongSend_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(MsgBusServer).LongSend(&grpc.GenericServerStream[SendMsgReq, SendMsgRes]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type MsgBus_LongSendServer = grpc.BidiStreamingServer[SendMsgReq, SendMsgRes]
// MsgBus_ServiceDesc is the grpc.ServiceDesc for MsgBus service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var MsgBus_ServiceDesc = grpc.ServiceDesc{
ServiceName: "PbMsgBus.MsgBus",
HandlerType: (*MsgBusServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Send",
Handler: _MsgBus_Send_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "LongSend",
Handler: _MsgBus_LongSend_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "msgbus.proto",
}
+237
View File
@@ -0,0 +1,237 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v5.29.3
// source: msgcall.proto
package pb
import (
reflect "reflect"
sync "sync"
unsafe "unsafe"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
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 MsgReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Head *HeadReq `protobuf:"bytes,1,opt,name=head,proto3" json:"head,omitempty"`
Service string `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"`
Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"`
Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *MsgReq) Reset() {
*x = MsgReq{}
mi := &file_msgcall_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *MsgReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MsgReq) ProtoMessage() {}
func (x *MsgReq) ProtoReflect() protoreflect.Message {
mi := &file_msgcall_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MsgReq.ProtoReflect.Descriptor instead.
func (*MsgReq) Descriptor() ([]byte, []int) {
return file_msgcall_proto_rawDescGZIP(), []int{0}
}
func (x *MsgReq) GetHead() *HeadReq {
if x != nil {
return x.Head
}
return nil
}
func (x *MsgReq) GetService() string {
if x != nil {
return x.Service
}
return ""
}
func (x *MsgReq) GetMethod() string {
if x != nil {
return x.Method
}
return ""
}
func (x *MsgReq) GetData() []byte {
if x != nil {
return x.Data
}
return nil
}
type MsgRes struct {
state protoimpl.MessageState `protogen:"open.v1"`
Head *HeadRes `protobuf:"bytes,1,opt,name=head,proto3" json:"head,omitempty"`
Service string `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"`
Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"`
Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *MsgRes) Reset() {
*x = MsgRes{}
mi := &file_msgcall_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *MsgRes) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MsgRes) ProtoMessage() {}
func (x *MsgRes) ProtoReflect() protoreflect.Message {
mi := &file_msgcall_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MsgRes.ProtoReflect.Descriptor instead.
func (*MsgRes) Descriptor() ([]byte, []int) {
return file_msgcall_proto_rawDescGZIP(), []int{1}
}
func (x *MsgRes) GetHead() *HeadRes {
if x != nil {
return x.Head
}
return nil
}
func (x *MsgRes) GetService() string {
if x != nil {
return x.Service
}
return ""
}
func (x *MsgRes) GetMethod() string {
if x != nil {
return x.Method
}
return ""
}
func (x *MsgRes) GetData() []byte {
if x != nil {
return x.Data
}
return nil
}
var File_msgcall_proto protoreflect.FileDescriptor
const file_msgcall_proto_rawDesc = "" +
"\n" +
"\rmsgcall.proto\x12\tPbMsgCall\x1a\fcommon.proto\"u\n" +
"\x06MsgReq\x12%\n" +
"\x04head\x18\x01 \x01(\v2\x11.PbCommon.HeadReqR\x04head\x12\x18\n" +
"\aservice\x18\x02 \x01(\tR\aservice\x12\x16\n" +
"\x06method\x18\x03 \x01(\tR\x06method\x12\x12\n" +
"\x04data\x18\x04 \x01(\fR\x04data\"u\n" +
"\x06MsgRes\x12%\n" +
"\x04head\x18\x01 \x01(\v2\x11.PbCommon.HeadResR\x04head\x12\x18\n" +
"\aservice\x18\x02 \x01(\tR\aservice\x12\x16\n" +
"\x06method\x18\x03 \x01(\tR\x06method\x12\x12\n" +
"\x04data\x18\x04 \x01(\fR\x04data2r\n" +
"\aMsgCall\x12/\n" +
"\aOneCall\x12\x11.PbMsgCall.MsgReq\x1a\x11.PbMsgCall.MsgRes\x126\n" +
"\n" +
"StreamCall\x12\x11.PbMsgCall.MsgReq\x1a\x11.PbMsgCall.MsgRes(\x010\x01B\x05Z\x03pb/b\x06proto3"
var (
file_msgcall_proto_rawDescOnce sync.Once
file_msgcall_proto_rawDescData []byte
)
func file_msgcall_proto_rawDescGZIP() []byte {
file_msgcall_proto_rawDescOnce.Do(func() {
file_msgcall_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_msgcall_proto_rawDesc), len(file_msgcall_proto_rawDesc)))
})
return file_msgcall_proto_rawDescData
}
var file_msgcall_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_msgcall_proto_goTypes = []any{
(*MsgReq)(nil), // 0: PbMsgCall.MsgReq
(*MsgRes)(nil), // 1: PbMsgCall.MsgRes
(*HeadReq)(nil), // 2: PbCommon.HeadReq
(*HeadRes)(nil), // 3: PbCommon.HeadRes
}
var file_msgcall_proto_depIdxs = []int32{
2, // 0: PbMsgCall.MsgReq.head:type_name -> PbCommon.HeadReq
3, // 1: PbMsgCall.MsgRes.head:type_name -> PbCommon.HeadRes
0, // 2: PbMsgCall.MsgCall.OneCall:input_type -> PbMsgCall.MsgReq
0, // 3: PbMsgCall.MsgCall.StreamCall:input_type -> PbMsgCall.MsgReq
1, // 4: PbMsgCall.MsgCall.OneCall:output_type -> PbMsgCall.MsgRes
1, // 5: PbMsgCall.MsgCall.StreamCall:output_type -> PbMsgCall.MsgRes
4, // [4:6] is the sub-list for method output_type
2, // [2:4] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_msgcall_proto_init() }
func file_msgcall_proto_init() {
if File_msgcall_proto != nil {
return
}
file_common_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_msgcall_proto_rawDesc), len(file_msgcall_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_msgcall_proto_goTypes,
DependencyIndexes: file_msgcall_proto_depIdxs,
MessageInfos: file_msgcall_proto_msgTypes,
}.Build()
File_msgcall_proto = out.File
file_msgcall_proto_goTypes = nil
file_msgcall_proto_depIdxs = nil
}
+155
View File
@@ -0,0 +1,155 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc v5.29.3
// source: msgcall.proto
package 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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
MsgCall_OneCall_FullMethodName = "/PbMsgCall.MsgCall/OneCall"
MsgCall_StreamCall_FullMethodName = "/PbMsgCall.MsgCall/StreamCall"
)
// MsgCallClient is the client API for MsgCall 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 MsgCallClient interface {
OneCall(ctx context.Context, in *MsgReq, opts ...grpc.CallOption) (*MsgRes, error)
StreamCall(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[MsgReq, MsgRes], error)
}
type msgCallClient struct {
cc grpc.ClientConnInterface
}
func NewMsgCallClient(cc grpc.ClientConnInterface) MsgCallClient {
return &msgCallClient{cc}
}
func (c *msgCallClient) OneCall(ctx context.Context, in *MsgReq, opts ...grpc.CallOption) (*MsgRes, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgRes)
err := c.cc.Invoke(ctx, MsgCall_OneCall_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgCallClient) StreamCall(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[MsgReq, MsgRes], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &MsgCall_ServiceDesc.Streams[0], MsgCall_StreamCall_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[MsgReq, MsgRes]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type MsgCall_StreamCallClient = grpc.BidiStreamingClient[MsgReq, MsgRes]
// MsgCallServer is the server API for MsgCall service.
// All implementations must embed UnimplementedMsgCallServer
// for forward compatibility.
type MsgCallServer interface {
OneCall(context.Context, *MsgReq) (*MsgRes, error)
StreamCall(grpc.BidiStreamingServer[MsgReq, MsgRes]) error
mustEmbedUnimplementedMsgCallServer()
}
// UnimplementedMsgCallServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedMsgCallServer struct{}
func (UnimplementedMsgCallServer) OneCall(context.Context, *MsgReq) (*MsgRes, error) {
return nil, status.Error(codes.Unimplemented, "method OneCall not implemented")
}
func (UnimplementedMsgCallServer) StreamCall(grpc.BidiStreamingServer[MsgReq, MsgRes]) error {
return status.Error(codes.Unimplemented, "method StreamCall not implemented")
}
func (UnimplementedMsgCallServer) mustEmbedUnimplementedMsgCallServer() {}
func (UnimplementedMsgCallServer) testEmbeddedByValue() {}
// UnsafeMsgCallServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgCallServer will
// result in compilation errors.
type UnsafeMsgCallServer interface {
mustEmbedUnimplementedMsgCallServer()
}
func RegisterMsgCallServer(s grpc.ServiceRegistrar, srv MsgCallServer) {
// If the following call panics, it indicates UnimplementedMsgCallServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&MsgCall_ServiceDesc, srv)
}
func _MsgCall_OneCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgCallServer).OneCall(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: MsgCall_OneCall_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgCallServer).OneCall(ctx, req.(*MsgReq))
}
return interceptor(ctx, in, info, handler)
}
func _MsgCall_StreamCall_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(MsgCallServer).StreamCall(&grpc.GenericServerStream[MsgReq, MsgRes]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type MsgCall_StreamCallServer = grpc.BidiStreamingServer[MsgReq, MsgRes]
// MsgCall_ServiceDesc is the grpc.ServiceDesc for MsgCall service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var MsgCall_ServiceDesc = grpc.ServiceDesc{
ServiceName: "PbMsgCall.MsgCall",
HandlerType: (*MsgCallServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "OneCall",
Handler: _MsgCall_OneCall_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "StreamCall",
Handler: _MsgCall_StreamCall_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "msgcall.proto",
}
+197
View File
@@ -0,0 +1,197 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v5.29.3
// source: notice.proto
package pb
import (
reflect "reflect"
sync "sync"
unsafe "unsafe"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
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 SendReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Head *HeadReq `protobuf:"bytes,1,opt,name=head,proto3" json:"head,omitempty"`
Config []byte `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"`
Params []byte `protobuf:"bytes,3,opt,name=params,proto3" json:"params,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SendReq) Reset() {
*x = SendReq{}
mi := &file_notice_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SendReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SendReq) ProtoMessage() {}
func (x *SendReq) ProtoReflect() protoreflect.Message {
mi := &file_notice_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SendReq.ProtoReflect.Descriptor instead.
func (*SendReq) Descriptor() ([]byte, []int) {
return file_notice_proto_rawDescGZIP(), []int{0}
}
func (x *SendReq) GetHead() *HeadReq {
if x != nil {
return x.Head
}
return nil
}
func (x *SendReq) GetConfig() []byte {
if x != nil {
return x.Config
}
return nil
}
func (x *SendReq) GetParams() []byte {
if x != nil {
return x.Params
}
return nil
}
type SendRes struct {
state protoimpl.MessageState `protogen:"open.v1"`
Head *HeadRes `protobuf:"bytes,1,opt,name=head,proto3" json:"head,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SendRes) Reset() {
*x = SendRes{}
mi := &file_notice_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SendRes) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SendRes) ProtoMessage() {}
func (x *SendRes) ProtoReflect() protoreflect.Message {
mi := &file_notice_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SendRes.ProtoReflect.Descriptor instead.
func (*SendRes) Descriptor() ([]byte, []int) {
return file_notice_proto_rawDescGZIP(), []int{1}
}
func (x *SendRes) GetHead() *HeadRes {
if x != nil {
return x.Head
}
return nil
}
var File_notice_proto protoreflect.FileDescriptor
const file_notice_proto_rawDesc = "" +
"\n" +
"\fnotice.proto\x12\bPbNotice\x1a\fcommon.proto\"`\n" +
"\aSendReq\x12%\n" +
"\x04head\x18\x01 \x01(\v2\x11.PbCommon.HeadReqR\x04head\x12\x16\n" +
"\x06config\x18\x02 \x01(\fR\x06config\x12\x16\n" +
"\x06params\x18\x03 \x01(\fR\x06params\"0\n" +
"\aSendRes\x12%\n" +
"\x04head\x18\x01 \x01(\v2\x11.PbCommon.HeadResR\x04head28\n" +
"\x06Notice\x12.\n" +
"\x04Send\x12\x11.PbNotice.SendReq\x1a\x11.PbNotice.SendRes\"\x00B\x05Z\x03pb/b\x06proto3"
var (
file_notice_proto_rawDescOnce sync.Once
file_notice_proto_rawDescData []byte
)
func file_notice_proto_rawDescGZIP() []byte {
file_notice_proto_rawDescOnce.Do(func() {
file_notice_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_notice_proto_rawDesc), len(file_notice_proto_rawDesc)))
})
return file_notice_proto_rawDescData
}
var file_notice_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_notice_proto_goTypes = []any{
(*SendReq)(nil), // 0: PbNotice.SendReq
(*SendRes)(nil), // 1: PbNotice.SendRes
(*HeadReq)(nil), // 2: PbCommon.HeadReq
(*HeadRes)(nil), // 3: PbCommon.HeadRes
}
var file_notice_proto_depIdxs = []int32{
2, // 0: PbNotice.SendReq.head:type_name -> PbCommon.HeadReq
3, // 1: PbNotice.SendRes.head:type_name -> PbCommon.HeadRes
0, // 2: PbNotice.Notice.Send:input_type -> PbNotice.SendReq
1, // 3: PbNotice.Notice.Send:output_type -> PbNotice.SendRes
3, // [3:4] is the sub-list for method output_type
2, // [2:3] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_notice_proto_init() }
func file_notice_proto_init() {
if File_notice_proto != nil {
return
}
file_common_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_notice_proto_rawDesc), len(file_notice_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_notice_proto_goTypes,
DependencyIndexes: file_notice_proto_depIdxs,
MessageInfos: file_notice_proto_msgTypes,
}.Build()
File_notice_proto = out.File
file_notice_proto_goTypes = nil
file_notice_proto_depIdxs = nil
}
+122
View File
@@ -0,0 +1,122 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc v5.29.3
// source: notice.proto
package 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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Notice_Send_FullMethodName = "/PbNotice.Notice/Send"
)
// NoticeClient is the client API for Notice 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 NoticeClient interface {
Send(ctx context.Context, in *SendReq, opts ...grpc.CallOption) (*SendRes, error)
}
type noticeClient struct {
cc grpc.ClientConnInterface
}
func NewNoticeClient(cc grpc.ClientConnInterface) NoticeClient {
return &noticeClient{cc}
}
func (c *noticeClient) Send(ctx context.Context, in *SendReq, opts ...grpc.CallOption) (*SendRes, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SendRes)
err := c.cc.Invoke(ctx, Notice_Send_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// NoticeServer is the server API for Notice service.
// All implementations must embed UnimplementedNoticeServer
// for forward compatibility.
type NoticeServer interface {
Send(context.Context, *SendReq) (*SendRes, error)
mustEmbedUnimplementedNoticeServer()
}
// UnimplementedNoticeServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedNoticeServer struct{}
func (UnimplementedNoticeServer) Send(context.Context, *SendReq) (*SendRes, error) {
return nil, status.Error(codes.Unimplemented, "method Send not implemented")
}
func (UnimplementedNoticeServer) mustEmbedUnimplementedNoticeServer() {}
func (UnimplementedNoticeServer) testEmbeddedByValue() {}
// UnsafeNoticeServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to NoticeServer will
// result in compilation errors.
type UnsafeNoticeServer interface {
mustEmbedUnimplementedNoticeServer()
}
func RegisterNoticeServer(s grpc.ServiceRegistrar, srv NoticeServer) {
// If the following call panics, it indicates UnimplementedNoticeServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Notice_ServiceDesc, srv)
}
func _Notice_Send_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SendReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NoticeServer).Send(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Notice_Send_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NoticeServer).Send(ctx, req.(*SendReq))
}
return interceptor(ctx, in, info, handler)
}
// Notice_ServiceDesc is the grpc.ServiceDesc for Notice service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Notice_ServiceDesc = grpc.ServiceDesc{
ServiceName: "PbNotice.Notice",
HandlerType: (*NoticeServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Send",
Handler: _Notice_Send_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "notice.proto",
}