From 0f7f724f54f50093944fbe8ce1307749364c4cd8 Mon Sep 17 00:00:00 2001 From: alber Date: Tue, 7 Feb 2023 23:04:49 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B6=88=E6=81=AF=E5=8D=8F=E8=AE=AE=E9=87=8D?= =?UTF-8?q?=E6=9E=84=202.=E6=94=AF=E6=8C=81k8s=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + build_proto.sh | 13 +- cmd/business/main.go | 8 +- cmd/connect/main.go | 14 +- cmd/connect/run.sh | 2 +- cmd/logic/main.go | 15 +- config/config.go | 79 +- config/default_builder.go | 65 + config/k8s_builder.go | 89 + internal/business/api/business_ext.go | 20 +- internal/business/api/business_ext_test.go | 8 +- internal/business/api/business_int.go | 18 +- internal/business/api/business_int_test.go | 2 +- .../{ => domain/user}/app/auth_app.go | 0 .../{ => domain/user}/app/user_app.go | 2 +- internal/business/domain/user/model/user.go | 2 +- .../domain/user/repo/user_dao_test.go | 6 - internal/business/domain/user/service/auth.go | 2 +- internal/connect/api.go | 14 +- internal/connect/conn.go | 6 +- internal/connect/conn_manager.go | 4 +- internal/connect/mq.go | 10 +- internal/connect/room.go | 6 +- internal/connect/tcp_server.go | 4 +- internal/logic/api/logic_ext.go | 102 +- internal/logic/api/logic_ext_test.go | 59 +- internal/logic/api/logic_int.go | 65 +- internal/logic/api/logic_int_test.go | 33 +- internal/logic/app/device_app.go | 85 - internal/logic/app/friend_app.go | 53 - internal/logic/app/message_app.go | 59 - internal/logic/app/room_app.go | 21 - .../domain/device/{device_dao.go => dao.go} | 14 +- .../{device_dao_test.go => dao_test.go} | 12 +- internal/logic/domain/device/device_app.go | 84 + .../domain/device/{device.go => entity.go} | 2 +- .../domain/device/{device_repo.go => repo.go} | 24 +- .../device/{device_service.go => service.go} | 28 +- internal/logic/domain/friend/app.go | 52 + .../domain/friend/{friend.go => entity.go} | 0 .../domain/friend/{friend_repo.go => repo.go} | 10 +- .../{friend_repo_test.go => repo_test.go} | 6 +- .../friend/{friend_service.go => service.go} | 56 +- .../{app/group_app.go => domain/group/app.go} | 34 +- .../domain/group/{model => entity}/group.go | 90 +- .../logic/domain/group/repo/group_cache.go | 8 +- internal/logic/domain/group/repo/group_dao.go | 8 +- .../logic/domain/group/repo/group_repo.go | 10 +- .../domain/group/repo/group_user_repo.go | 16 +- internal/logic/domain/message/app.go | 31 + .../logic/domain/message/model/message.go | 71 +- internal/logic/domain/message/model/sender.go | 13 +- .../logic/domain/message/repo/message_repo.go | 2 +- .../domain/message/repo/message_repo_test.go | 23 +- .../domain/message/service/device_ack_test.go | 5 - .../domain/message/service/message_service.go | 97 +- internal/logic/domain/message/service/push.go | 60 +- internal/logic/domain/room/app.go | 20 + .../{room_message_repo.go => message_repo.go} | 28 +- internal/logic/domain/room/room_seq_repo.go | 21 - internal/logic/domain/room/room_service.go | 148 -- internal/logic/domain/room/seq_repo.go | 21 + internal/logic/domain/room/service.go | 125 ++ .../{room_service_test.go => service_test.go} | 2 +- internal/logic/proxy/device_proxy.go | 2 +- internal/logic/proxy/message_proxy.go | 33 +- pkg/db/db.go | 11 +- pkg/grpclib/resolver/addrs/addrs_resolver.go | 6 +- pkg/interceptor/interceptor.go | 2 +- pkg/pb/business.int.pb.go | 488 ----- pkg/pb/common.ext.pb.go | 131 -- pkg/pb/connect.ext.pb.go | 1915 ----------------- pkg/pb/logic.int.pb.go | 1547 ------------- pkg/proto/common.ext.proto | 5 - pkg/proto/connect.ext.proto | 174 -- pkg/proto/connect.int.proto | 28 - pkg/{ => protocol}/pb/business.ext.pb.go | 326 +-- pkg/protocol/pb/business.ext_grpc.pb.go | 222 ++ pkg/protocol/pb/business.int.pb.go | 328 +++ pkg/protocol/pb/business.int_grpc.pb.go | 184 ++ pkg/protocol/pb/connect.ext.pb.go | 706 ++++++ pkg/{ => protocol}/pb/connect.int.pb.go | 178 +- pkg/protocol/pb/connect.int_grpc.pb.go | 108 + pkg/{ => protocol}/pb/logic.ext.pb.go | 1244 +++-------- pkg/protocol/pb/logic.ext_grpc.pb.go | 678 ++++++ pkg/protocol/pb/logic.int.pb.go | 1260 +++++++++++ pkg/protocol/pb/logic.int_grpc.pb.go | 450 ++++ pkg/protocol/pb/message.ext.pb.go | 235 ++ pkg/{ => protocol}/pb/push.ext.pb.go | 405 +++- pkg/{ => protocol}/proto/business.ext.proto | 6 +- pkg/{ => protocol}/proto/business.int.proto | 6 +- pkg/protocol/proto/connect.ext.proto | 62 + pkg/protocol/proto/connect.int.proto | 28 + pkg/{ => protocol}/proto/logic.ext.proto | 41 +- pkg/{ => protocol}/proto/logic.int.proto | 39 +- pkg/protocol/proto/message.ext.proto | 17 + pkg/{ => protocol}/proto/push.ext.proto | 39 +- pkg/rpc/rpc.go | 63 +- pkg/util/json.go | 65 +- pkg/util/message.go | 38 + pkg/util/sql.go | 19 - sql/create_table.sql | 29 +- test/tcp_conn/main.go | 18 +- test/ws_conn/main.go | 14 +- 104 files changed, 6126 insertions(+), 7012 deletions(-) create mode 100644 config/default_builder.go create mode 100644 config/k8s_builder.go rename internal/business/{ => domain/user}/app/auth_app.go (100%) rename internal/business/{ => domain/user}/app/user_app.go (98%) delete mode 100644 internal/logic/app/device_app.go delete mode 100644 internal/logic/app/friend_app.go delete mode 100644 internal/logic/app/message_app.go delete mode 100644 internal/logic/app/room_app.go rename internal/logic/domain/device/{device_dao.go => dao.go} (77%) rename internal/logic/domain/device/{device_dao_test.go => dao_test.go} (73%) create mode 100644 internal/logic/domain/device/device_app.go rename internal/logic/domain/device/{device.go => entity.go} (98%) rename internal/logic/domain/device/{device_repo.go => repo.go} (58%) rename internal/logic/domain/device/{device_service.go => service.go} (61%) create mode 100644 internal/logic/domain/friend/app.go rename internal/logic/domain/friend/{friend.go => entity.go} (100%) rename internal/logic/domain/friend/{friend_repo.go => repo.go} (72%) rename internal/logic/domain/friend/{friend_repo_test.go => repo_test.go} (69%) rename internal/logic/domain/friend/{friend_service.go => service.go} (62%) rename internal/logic/{app/group_app.go => domain/group/app.go} (66%) rename internal/logic/domain/group/{model => entity}/group.go (84%) create mode 100644 internal/logic/domain/message/app.go create mode 100644 internal/logic/domain/room/app.go rename internal/logic/domain/room/{room_message_repo.go => message_repo.go} (68%) delete mode 100644 internal/logic/domain/room/room_seq_repo.go delete mode 100644 internal/logic/domain/room/room_service.go create mode 100644 internal/logic/domain/room/seq_repo.go create mode 100644 internal/logic/domain/room/service.go rename internal/logic/domain/room/{room_service_test.go => service_test.go} (96%) delete mode 100644 pkg/pb/business.int.pb.go delete mode 100644 pkg/pb/common.ext.pb.go delete mode 100644 pkg/pb/connect.ext.pb.go delete mode 100644 pkg/pb/logic.int.pb.go delete mode 100644 pkg/proto/common.ext.proto delete mode 100644 pkg/proto/connect.ext.proto delete mode 100644 pkg/proto/connect.int.proto rename pkg/{ => protocol}/pb/business.ext.pb.go (58%) create mode 100644 pkg/protocol/pb/business.ext_grpc.pb.go create mode 100644 pkg/protocol/pb/business.int.pb.go create mode 100644 pkg/protocol/pb/business.int_grpc.pb.go create mode 100644 pkg/protocol/pb/connect.ext.pb.go rename pkg/{ => protocol}/pb/connect.int.pb.go (50%) create mode 100644 pkg/protocol/pb/connect.int_grpc.pb.go rename pkg/{ => protocol}/pb/logic.ext.pb.go (52%) create mode 100644 pkg/protocol/pb/logic.ext_grpc.pb.go create mode 100644 pkg/protocol/pb/logic.int.pb.go create mode 100644 pkg/protocol/pb/logic.int_grpc.pb.go create mode 100644 pkg/protocol/pb/message.ext.pb.go rename pkg/{ => protocol}/pb/push.ext.pb.go (52%) rename pkg/{ => protocol}/proto/business.ext.proto (89%) rename pkg/{ => protocol}/proto/business.int.proto (78%) create mode 100644 pkg/protocol/proto/connect.ext.proto create mode 100644 pkg/protocol/proto/connect.int.proto rename pkg/{ => protocol}/proto/logic.ext.proto (79%) rename pkg/{ => protocol}/proto/logic.int.proto (71%) create mode 100644 pkg/protocol/proto/message.ext.proto rename pkg/{ => protocol}/proto/push.ext.proto (50%) create mode 100644 pkg/util/message.go delete mode 100644 pkg/util/sql.go diff --git a/README.md b/README.md index 8d4530aa..0e99f7d2 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ gim是一个即时通讯服务器,代码全部使用golang完成。主要特 4.单聊,群聊,以及房间聊天场景 5.支持服务水平扩展 6.使用领域驱动设计 +7.支持裸机部署和k8s部署 gim可以作为以业务服务器的一个组件,为现有业务服务器提供im的能力,业务服务器 只需要实现business.int.proto协议中定义的GRPC接口,为gim服务提供基本的用户功能即可 ### 使用技术: diff --git a/build_proto.sh b/build_proto.sh index 31f810a5..24884727 100755 --- a/build_proto.sh +++ b/build_proto.sh @@ -1,3 +1,10 @@ -cd pkg/proto -protoc --go_out=plugins=grpc:../../../ *.proto -cd ../../ \ No newline at end of file +#!/usr/bin/env bash + +set -e + +root_path=$(pwd) +rm -rf pkg/protocol/pb/* +cd pkg/protocol/proto +pb_root_path=$root_path/../ +protoc --proto_path=$root_path/pkg/protocol/proto --go_out=$pb_root_path --go-grpc_out=$pb_root_path *.proto +cd $root_path \ No newline at end of file diff --git a/cmd/business/main.go b/cmd/business/main.go index 1c1b9efc..f14e02c8 100644 --- a/cmd/business/main.go +++ b/cmd/business/main.go @@ -3,10 +3,9 @@ package main import ( "gim/config" "gim/internal/business/api" - "gim/pkg/db" "gim/pkg/interceptor" "gim/pkg/logger" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/urlwhitelist" "net" "os" @@ -18,9 +17,6 @@ import ( ) func main() { - config.Init() - db.Init() - server := grpc.NewServer(grpc.UnaryInterceptor(interceptor.NewInterceptor("business_interceptor", urlwhitelist.Business))) // 监听服务关闭信号,服务平滑重启 @@ -34,7 +30,7 @@ func main() { pb.RegisterBusinessIntServer(server, &api.BusinessIntServer{}) pb.RegisterBusinessExtServer(server, &api.BusinessExtServer{}) - listen, err := net.Listen("tcp", config.RPCListenAddr) + listen, err := net.Listen("tcp", config.Config.BusinessRPCListenAddr) if err != nil { panic(err) } diff --git a/cmd/connect/main.go b/cmd/connect/main.go index 224f71eb..71412aba 100644 --- a/cmd/connect/main.go +++ b/cmd/connect/main.go @@ -4,10 +4,9 @@ import ( "context" "gim/config" "gim/internal/connect" - "gim/pkg/db" "gim/pkg/interceptor" "gim/pkg/logger" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/rpc" "net" "os" @@ -20,17 +19,14 @@ import ( ) func main() { - config.Init() - db.Init() - // 启动TCP长链接服务器 go func() { - connect.StartTCPServer(config.TCPListenAddr) + connect.StartTCPServer(config.Config.ConnectTCPListenAddr) }() // 启动WebSocket长链接服务器 go func() { - connect.StartWSServer(config.WSListenAddr) + connect.StartWSServer(config.Config.ConnectWSListenAddr) }() // 启动服务订阅 @@ -44,14 +40,14 @@ func main() { signal.Notify(c, syscall.SIGTERM) s := <-c logger.Logger.Info("server stop start", zap.Any("signal", s)) - _, _ = rpc.GetLogicIntClient().ServerStop(context.TODO(), &pb.ServerStopReq{ConnAddr: config.LocalAddr}) + _, _ = rpc.GetLogicIntClient().ServerStop(context.TODO(), &pb.ServerStopReq{ConnAddr: config.Config.ConnectLocalAddr}) logger.Logger.Info("server stop end") server.GracefulStop() }() pb.RegisterConnectIntServer(server, &connect.ConnIntServer{}) - listener, err := net.Listen("tcp", config.RPCListenAddr) + listener, err := net.Listen("tcp", config.Config.ConnectRPCListenAddr) if err != nil { panic(err) } diff --git a/cmd/connect/run.sh b/cmd/connect/run.sh index b03a442b..06d1ddd7 100755 --- a/cmd/connect/run.sh +++ b/cmd/connect/run.sh @@ -1,3 +1,3 @@ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go echo "打包完成" -docker run -v $(pwd)/:/app -p 8080:8080 -p 8081:8081 -p 50100:50100 alpine .//app/main +docker run -v $(pwd)/:/app -p 8000:8000 -p 8002:8002 -p 8003:8003 alpine .//app/main diff --git a/cmd/logic/main.go b/cmd/logic/main.go index c74867ce..c25f73c5 100644 --- a/cmd/logic/main.go +++ b/cmd/logic/main.go @@ -3,12 +3,12 @@ package main import ( "gim/config" "gim/internal/logic/api" - "gim/internal/logic/app" + "gim/internal/logic/domain/device" + "gim/internal/logic/domain/message" "gim/internal/logic/proxy" - "gim/pkg/db" "gim/pkg/interceptor" "gim/pkg/logger" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/urlwhitelist" "net" "os" @@ -20,14 +20,11 @@ import ( ) func init() { - proxy.MessageProxy = app.MessageApp - proxy.DeviceProxy = app.DeviceApp + proxy.MessageProxy = message.App + proxy.DeviceProxy = device.App } func main() { - config.Init() - db.Init() - server := grpc.NewServer(grpc.UnaryInterceptor(interceptor.NewInterceptor("logic_interceptor", urlwhitelist.Logic))) // 监听服务关闭信号,服务平滑重启 @@ -41,7 +38,7 @@ func main() { pb.RegisterLogicIntServer(server, &api.LogicIntServer{}) pb.RegisterLogicExtServer(server, &api.LogicExtServer{}) - listen, err := net.Listen("tcp", config.RPCListenAddr) + listen, err := net.Listen("tcp", config.Config.LogicRPCListenAddr) if err != nil { panic(err) } diff --git a/config/config.go b/config/config.go index df0e155f..19e8e88e 100644 --- a/config/config.go +++ b/config/config.go @@ -2,57 +2,56 @@ package config import ( "context" - "gim/pkg/k8sutil" - "gim/pkg/logger" + "gim/pkg/gerrors" + "gim/pkg/protocol/pb" "os" - "strconv" - "go.uber.org/zap" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "google.golang.org/grpc" ) -const ( - RPCListenAddr = ":8000" - TCPListenAddr = ":8080" - WSListenAddr = ":8001" -) +var builders = map[string]Builder{ + "default": &defaultBuilder{}, + "k8s": &k8sBuilder{}, +} -var ( - Namespace = "gimns" - MySQL string - RedisIP string - RedisPassword string +var Config Configuration - LocalAddr string +type Builder interface { + Build() Configuration +} + +type Configuration struct { + MySQL string + RedisHost string + RedisPassword string PushRoomSubscribeNum int PushAllSubscribeNum int -) -func Init() { - k8sClient, err := k8sutil.GetK8sClient() - if err != nil { - panic(err) - } - configmap, err := k8sClient.CoreV1().ConfigMaps(Namespace).Get(context.TODO(), "config", metav1.GetOptions{}) - if err != nil { - panic(err) - } + ConnectLocalAddr string + ConnectWSListenAddr string + ConnectTCPListenAddr string + ConnectRPCListenAddr string - MySQL = configmap.Data["mysql"] - RedisIP = configmap.Data["redisIP"] - RedisPassword = configmap.Data["redisPassword"] - PushRoomSubscribeNum, _ = strconv.Atoi(configmap.Data["pushRoomSubscribeNum"]) - if PushRoomSubscribeNum == 0 { - panic("PushRoomSubscribeNum == 0") - } - PushAllSubscribeNum, _ = strconv.Atoi(configmap.Data["pushAllSubscribeNum"]) - if PushRoomSubscribeNum == 0 { - panic("PushAllSubscribeNum == 0") + LogicRPCListenAddr string + BusinessRPCListenAddr string + FileHTTPListenAddr string + + ConnectIntClientBuilder func() pb.ConnectIntClient + LogicIntClientBuilder func() pb.LogicIntClient + BusinessIntClientBuilder func() pb.BusinessIntClient +} + +func init() { + env := os.Getenv("GIM_ENV") + builder, ok := builders[env] + if !ok { + builder = new(defaultBuilder) } + Config = builder.Build() - LocalAddr = os.Getenv("POD_IP") + RPCListenAddr +} - logger.Level = zap.DebugLevel - logger.Target = logger.Console +func interceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + err := invoker(ctx, method, req, reply, cc, opts...) + return gerrors.WrapRPCError(err) } diff --git a/config/default_builder.go b/config/default_builder.go new file mode 100644 index 00000000..a3d1ce41 --- /dev/null +++ b/config/default_builder.go @@ -0,0 +1,65 @@ +package config + +import ( + "context" + "fmt" + "gim/pkg/grpclib/picker" + "gim/pkg/logger" + "gim/pkg/protocol/pb" + + "go.uber.org/zap" + + _ "gim/pkg/grpclib/resolver/addrs" + + "google.golang.org/grpc" + "google.golang.org/grpc/balancer/roundrobin" +) + +type defaultBuilder struct{} + +func (*defaultBuilder) Build() Configuration { + logger.Level = zap.DebugLevel + logger.Target = logger.Console + + return Configuration{ + MySQL: "root:gim123456@tcp(111.229.238.28:3306)/gim?charset=utf8&parseTime=true", + RedisHost: "111.229.238.28:6379", + RedisPassword: "alber123456", + PushRoomSubscribeNum: 100, + PushAllSubscribeNum: 100, + + ConnectLocalAddr: "127.0.0.1:8000", + ConnectRPCListenAddr: ":8000", + ConnectWSListenAddr: ":8001", + ConnectTCPListenAddr: ":8002", + + LogicRPCListenAddr: ":8010", + BusinessRPCListenAddr: ":8020", + FileHTTPListenAddr: "8030", + + ConnectIntClientBuilder: func() pb.ConnectIntClient { + conn, err := grpc.DialContext(context.TODO(), "addrs:///127.0.0.1:8000", grpc.WithInsecure(), grpc.WithUnaryInterceptor(interceptor), + grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, picker.AddrPickerName))) + if err != nil { + panic(err) + } + return pb.NewConnectIntClient(conn) + }, + LogicIntClientBuilder: func() pb.LogicIntClient { + conn, err := grpc.DialContext(context.TODO(), "addrs:///docker.for.mac.host.internal:8010", grpc.WithInsecure(), grpc.WithUnaryInterceptor(interceptor), + grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name))) + if err != nil { + panic(err) + } + return pb.NewLogicIntClient(conn) + }, + BusinessIntClientBuilder: func() pb.BusinessIntClient { + conn, err := grpc.DialContext(context.TODO(), "addrs:///127.0.0.1:8020", grpc.WithInsecure(), grpc.WithUnaryInterceptor(interceptor), + grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name))) + if err != nil { + panic(err) + } + return pb.NewBusinessIntClient(conn) + }, + } +} diff --git a/config/k8s_builder.go b/config/k8s_builder.go new file mode 100644 index 00000000..c44d27be --- /dev/null +++ b/config/k8s_builder.go @@ -0,0 +1,89 @@ +package config + +import ( + "context" + "fmt" + "gim/pkg/grpclib/picker" + "gim/pkg/grpclib/resolver/k8s" + "gim/pkg/k8sutil" + "gim/pkg/logger" + "gim/pkg/protocol/pb" + "os" + "strconv" + + "google.golang.org/grpc/balancer/roundrobin" + + "google.golang.org/grpc" + + "go.uber.org/zap" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type k8sBuilder struct{} + +func (*k8sBuilder) Build() Configuration { + const ( + RPCListenAddr = ":8000" + RPCDialAddr = "8000" + ) + const namespace = "gim" + + k8sClient, err := k8sutil.GetK8sClient() + if err != nil { + panic(err) + } + configmap, err := k8sClient.CoreV1().ConfigMaps(namespace).Get(context.TODO(), "config", metav1.GetOptions{}) + if err != nil { + panic(err) + } + + logger.Level = zap.DebugLevel + logger.Target = logger.Console + + return Configuration{ + MySQL: configmap.Data["mysql"], + RedisHost: configmap.Data["redisIP"], + RedisPassword: configmap.Data["redisPassword"], + PushRoomSubscribeNum: getInt(configmap.Data, "pushRoomSubscribeNum"), + PushAllSubscribeNum: getInt(configmap.Data, "pushAllSubscribeNum"), + + ConnectLocalAddr: os.Getenv("POD_IP") + RPCListenAddr, + ConnectRPCListenAddr: RPCListenAddr, + ConnectWSListenAddr: ":8001", + ConnectTCPListenAddr: ":8002", + + LogicRPCListenAddr: RPCListenAddr, + BusinessRPCListenAddr: RPCListenAddr, + FileHTTPListenAddr: "8030", + + ConnectIntClientBuilder: func() pb.ConnectIntClient { + conn, err := grpc.DialContext(context.TODO(), k8s.GetK8STarget(namespace, "connect", RPCDialAddr), grpc.WithInsecure(), + grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, picker.AddrPickerName))) + if err != nil { + panic(err) + } + return pb.NewConnectIntClient(conn) + }, + LogicIntClientBuilder: func() pb.LogicIntClient { + conn, err := grpc.DialContext(context.TODO(), k8s.GetK8STarget(namespace, "logic", RPCDialAddr), grpc.WithInsecure(), + grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name))) + if err != nil { + panic(err) + } + return pb.NewLogicIntClient(conn) + }, + BusinessIntClientBuilder: func() pb.BusinessIntClient { + conn, err := grpc.DialContext(context.TODO(), k8s.GetK8STarget(namespace, "business", RPCDialAddr), grpc.WithInsecure(), + grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name))) + if err != nil { + panic(err) + } + return pb.NewBusinessIntClient(conn) + }, + } +} + +func getInt(m map[string]string, key string) int { + value, _ := strconv.Atoi(m[key]) + return value +} diff --git a/internal/business/api/business_ext.go b/internal/business/api/business_ext.go index 3bfa4666..419956f3 100644 --- a/internal/business/api/business_ext.go +++ b/internal/business/api/business_ext.go @@ -2,15 +2,19 @@ package api import ( "context" - "gim/internal/business/app" + app2 "gim/internal/business/domain/user/app" "gim/pkg/grpclib" - "gim/pkg/pb" + "gim/pkg/protocol/pb" + + "google.golang.org/protobuf/types/known/emptypb" ) -type BusinessExtServer struct{} +type BusinessExtServer struct { + pb.UnsafeBusinessExtServer +} func (s *BusinessExtServer) SignIn(ctx context.Context, req *pb.SignInReq) (*pb.SignInResp, error) { - isNew, userId, token, err := app.AuthApp.SignIn(ctx, req.PhoneNumber, req.Code, req.DeviceId) + isNew, userId, token, err := app2.AuthApp.SignIn(ctx, req.PhoneNumber, req.Code, req.DeviceId) if err != nil { return nil, err } @@ -27,20 +31,20 @@ func (s *BusinessExtServer) GetUser(ctx context.Context, req *pb.GetUserReq) (*p return nil, err } - user, err := app.UserApp.Get(ctx, userId) + user, err := app2.UserApp.Get(ctx, userId) return &pb.GetUserResp{User: user}, err } -func (s *BusinessExtServer) UpdateUser(ctx context.Context, req *pb.UpdateUserReq) (*pb.Empty, error) { +func (s *BusinessExtServer) UpdateUser(ctx context.Context, req *pb.UpdateUserReq) (*emptypb.Empty, error) { userId, _, err := grpclib.GetCtxData(ctx) if err != nil { return nil, err } - return new(pb.Empty), app.UserApp.Update(ctx, userId, req) + return new(emptypb.Empty), app2.UserApp.Update(ctx, userId, req) } func (s *BusinessExtServer) SearchUser(ctx context.Context, req *pb.SearchUserReq) (*pb.SearchUserResp, error) { - users, err := app.UserApp.Search(ctx, req.Key) + users, err := app2.UserApp.Search(ctx, req.Key) return &pb.SearchUserResp{Users: users}, err } diff --git a/internal/business/api/business_ext_test.go b/internal/business/api/business_ext_test.go index 24efaac9..a05c2ebe 100644 --- a/internal/business/api/business_ext_test.go +++ b/internal/business/api/business_ext_test.go @@ -3,7 +3,7 @@ package api import ( "context" "fmt" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "strconv" "testing" "time" @@ -13,7 +13,7 @@ import ( ) func getBusinessExtClient() pb.BusinessExtClient { - conn, err := grpc.Dial("127.0.0.1:8000", grpc.WithInsecure()) + conn, err := grpc.Dial("127.0.0.1:8020", grpc.WithInsecure()) if err != nil { fmt.Println(err) return nil @@ -32,9 +32,9 @@ func getCtx() context.Context { func TestUserExtServer_SignIn(t *testing.T) { resp, err := getBusinessExtClient().SignIn(getCtx(), &pb.SignInReq{ - PhoneNumber: "11111111111", + PhoneNumber: "22222222222", Code: "0", - DeviceId: 1, + DeviceId: 3, }) if err != nil { fmt.Println(err) diff --git a/internal/business/api/business_int.go b/internal/business/api/business_int.go index 788653f4..b6021554 100644 --- a/internal/business/api/business_int.go +++ b/internal/business/api/business_int.go @@ -2,18 +2,22 @@ package api import ( "context" - "gim/internal/business/app" - "gim/pkg/pb" + app2 "gim/internal/business/domain/user/app" + "gim/pkg/protocol/pb" + + "google.golang.org/protobuf/types/known/emptypb" ) -type BusinessIntServer struct{} +type BusinessIntServer struct { + pb.UnsafeBusinessIntServer +} -func (*BusinessIntServer) Auth(ctx context.Context, req *pb.AuthReq) (*pb.Empty, error) { - return &pb.Empty{}, app.AuthApp.Auth(ctx, req.UserId, req.DeviceId, req.Token) +func (*BusinessIntServer) Auth(ctx context.Context, req *pb.AuthReq) (*emptypb.Empty, error) { + return &emptypb.Empty{}, app2.AuthApp.Auth(ctx, req.UserId, req.DeviceId, req.Token) } func (*BusinessIntServer) GetUser(ctx context.Context, req *pb.GetUserReq) (*pb.GetUserResp, error) { - user, err := app.UserApp.Get(ctx, req.UserId) + user, err := app2.UserApp.Get(ctx, req.UserId) return &pb.GetUserResp{User: user}, err } @@ -23,6 +27,6 @@ func (*BusinessIntServer) GetUsers(ctx context.Context, req *pb.GetUsersReq) (*p userIds = append(userIds, k) } - users, err := app.UserApp.GetByIds(ctx, userIds) + users, err := app2.UserApp.GetByIds(ctx, userIds) return &pb.GetUsersResp{Users: users}, err } diff --git a/internal/business/api/business_int_test.go b/internal/business/api/business_int_test.go index cc0de5ae..4b54c8df 100644 --- a/internal/business/api/business_int_test.go +++ b/internal/business/api/business_int_test.go @@ -2,7 +2,7 @@ package api import ( "fmt" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "testing" "google.golang.org/grpc" diff --git a/internal/business/app/auth_app.go b/internal/business/domain/user/app/auth_app.go similarity index 100% rename from internal/business/app/auth_app.go rename to internal/business/domain/user/app/auth_app.go diff --git a/internal/business/app/user_app.go b/internal/business/domain/user/app/user_app.go similarity index 98% rename from internal/business/app/user_app.go rename to internal/business/domain/user/app/user_app.go index 7b58ef2e..958a96e9 100644 --- a/internal/business/app/user_app.go +++ b/internal/business/domain/user/app/user_app.go @@ -3,7 +3,7 @@ package app import ( "context" "gim/internal/business/domain/user/repo" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "time" ) diff --git a/internal/business/domain/user/model/user.go b/internal/business/domain/user/model/user.go index 2a30327a..e50681bd 100644 --- a/internal/business/domain/user/model/user.go +++ b/internal/business/domain/user/model/user.go @@ -1,7 +1,7 @@ package model import ( - "gim/pkg/pb" + "gim/pkg/protocol/pb" "time" ) diff --git a/internal/business/domain/user/repo/user_dao_test.go b/internal/business/domain/user/repo/user_dao_test.go index 779c3adc..9e34eb7f 100644 --- a/internal/business/domain/user/repo/user_dao_test.go +++ b/internal/business/domain/user/repo/user_dao_test.go @@ -3,15 +3,9 @@ package repo import ( "fmt" "gim/internal/business/domain/user/model" - "gim/pkg/db" "testing" ) -func init() { - fmt.Println("init db") - db.InitByTest() -} - func TestUserDao_Add(t *testing.T) { id, err := UserDao.Add(model.User{ PhoneNumber: "18829291351", diff --git a/internal/business/domain/user/service/auth.go b/internal/business/domain/user/service/auth.go index b14deaae..f8758e5e 100644 --- a/internal/business/domain/user/service/auth.go +++ b/internal/business/domain/user/service/auth.go @@ -5,7 +5,7 @@ import ( "gim/internal/business/domain/user/model" "gim/internal/business/domain/user/repo" "gim/pkg/gerrors" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/rpc" "time" ) diff --git a/internal/connect/api.go b/internal/connect/api.go index decbaad1..fae6bb06 100644 --- a/internal/connect/api.go +++ b/internal/connect/api.go @@ -4,16 +4,20 @@ import ( "context" "gim/pkg/grpclib" "gim/pkg/logger" - "gim/pkg/pb" + "gim/pkg/protocol/pb" + + "google.golang.org/protobuf/types/known/emptypb" "go.uber.org/zap" ) -type ConnIntServer struct{} +type ConnIntServer struct { + pb.UnsafeConnectIntServer +} // DeliverMessage 投递消息 -func (s *ConnIntServer) DeliverMessage(ctx context.Context, req *pb.DeliverMessageReq) (*pb.Empty, error) { - resp := &pb.Empty{} +func (s *ConnIntServer) DeliverMessage(ctx context.Context, req *pb.DeliverMessageReq) (*emptypb.Empty, error) { + resp := &emptypb.Empty{} // 获取设备对应的TCP连接 conn := GetConn(req.DeviceId) @@ -27,6 +31,6 @@ func (s *ConnIntServer) DeliverMessage(ctx context.Context, req *pb.DeliverMessa return resp, nil } - conn.Send(pb.PackageType_PT_MESSAGE, grpclib.GetCtxRequestId(ctx), req.MessageSend, nil) + conn.Send(pb.PackageType_PT_MESSAGE, grpclib.GetCtxRequestId(ctx), req.Message, nil) return resp, nil } diff --git a/internal/connect/conn.go b/internal/connect/conn.go index 6afe75d1..4da8b895 100644 --- a/internal/connect/conn.go +++ b/internal/connect/conn.go @@ -6,7 +6,7 @@ import ( "gim/config" "gim/pkg/grpclib" "gim/pkg/logger" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/rpc" "sync" "time" @@ -177,7 +177,7 @@ func (c *Conn) SignIn(input *pb.Input) { UserId: signIn.UserId, DeviceId: signIn.DeviceId, Token: signIn.Token, - ConnAddr: config.LocalAddr, + ConnAddr: config.Config.ConnectLocalAddr, ClientAddr: c.GetAddr(), }) @@ -253,7 +253,7 @@ func (c *Conn) SubscribedRoom(input *pb.Input) { DeviceId: c.DeviceId, RoomId: subscribeRoom.RoomId, Seq: subscribeRoom.Seq, - ConnAddr: config.LocalAddr, + ConnAddr: config.Config.ConnectLocalAddr, }) if err != nil { logger.Logger.Error("SubscribedRoom error", zap.Error(err)) diff --git a/internal/connect/conn_manager.go b/internal/connect/conn_manager.go index 2cec6f0e..7455c7df 100644 --- a/internal/connect/conn_manager.go +++ b/internal/connect/conn_manager.go @@ -1,7 +1,7 @@ package connect import ( - "gim/pkg/pb" + "gim/pkg/protocol/pb" "sync" ) @@ -27,7 +27,7 @@ func DeleteConn(deviceId int64) { } // PushAll 全服推送 -func PushAll(message *pb.MessageSend) { +func PushAll(message *pb.Message) { ConnsManager.Range(func(key, value interface{}) bool { conn := value.(*Conn) conn.Send(pb.PackageType_PT_MESSAGE, 0, message, nil) diff --git a/internal/connect/mq.go b/internal/connect/mq.go index 7475a05b..e4708e18 100644 --- a/internal/connect/mq.go +++ b/internal/connect/mq.go @@ -5,7 +5,7 @@ import ( "gim/pkg/db" "gim/pkg/logger" "gim/pkg/mq" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "time" "github.com/go-redis/redis" @@ -18,12 +18,12 @@ import ( func StartSubscribe() { pushRoomPriorityChannel := db.RedisCli.Subscribe(mq.PushRoomPriorityTopic).Channel() pushRoomChannel := db.RedisCli.Subscribe(mq.PushRoomTopic).Channel() - for i := 0; i < config.PushRoomSubscribeNum; i++ { + for i := 0; i < config.Config.PushRoomSubscribeNum; i++ { go handlePushRoomMsg(pushRoomPriorityChannel, pushRoomChannel) } pushAllChannel := db.RedisCli.Subscribe(mq.PushAllTopic).Channel() - for i := 0; i < config.PushAllSubscribeNum; i++ { + for i := 0; i < config.Config.PushAllSubscribeNum; i++ { go handlePushAllMsg(pushAllChannel) } } @@ -58,7 +58,7 @@ func handlePushRoom(bytes []byte) { logger.Logger.Error("handlePushRoom error", zap.Error(err)) return } - PushRoom(msg.RoomId, msg.MessageSend) + PushRoom(msg.RoomId, msg.Message) } func handlePushAll(bytes []byte) { @@ -68,5 +68,5 @@ func handlePushAll(bytes []byte) { logger.Logger.Error("handlePushRoom error", zap.Error(err)) return } - PushAll(msg.MessageSend) + PushAll(msg.Message) } diff --git a/internal/connect/room.go b/internal/connect/room.go index 8b933f6a..579323b4 100644 --- a/internal/connect/room.go +++ b/internal/connect/room.go @@ -2,7 +2,7 @@ package connect import ( "container/list" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "sync" ) @@ -46,7 +46,7 @@ func SubscribedRoom(conn *Conn, roomId int64) { } // PushRoom 房间消息推送 -func PushRoom(roomId int64, message *pb.MessageSend) { +func PushRoom(roomId int64, message *pb.Message) { value, ok := RoomsManager.Load(roomId) if !ok { return @@ -88,7 +88,7 @@ func (r *Room) Unsubscribe(conn *Conn) { } // Push 推送消息到房间 -func (r *Room) Push(message *pb.MessageSend) { +func (r *Room) Push(message *pb.Message) { r.lock.RLock() defer r.lock.RUnlock() diff --git a/internal/connect/tcp_server.go b/internal/connect/tcp_server.go index 35fb8726..4512354a 100644 --- a/internal/connect/tcp_server.go +++ b/internal/connect/tcp_server.go @@ -3,7 +3,7 @@ package connect import ( "context" "gim/pkg/logger" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/rpc" "time" @@ -12,8 +12,6 @@ import ( "github.com/alberliu/gn" ) -var encoder = gn.NewHeaderLenEncoder(2, 1024) - var server *gn.Server // StartTCPServer 启动TCP服务器 diff --git a/internal/logic/api/logic_ext.go b/internal/logic/api/logic_ext.go index b32ee4ba..47cf60ae 100644 --- a/internal/logic/api/logic_ext.go +++ b/internal/logic/api/logic_ext.go @@ -2,77 +2,71 @@ package api import ( "context" - "gim/internal/logic/app" + "gim/internal/logic/domain/device" + "gim/internal/logic/domain/friend" + "gim/internal/logic/domain/group" + "gim/internal/logic/domain/room" "gim/pkg/grpclib" - "gim/pkg/pb" + "gim/pkg/protocol/pb" + + "google.golang.org/protobuf/types/known/emptypb" ) -type LogicExtServer struct{} +type LogicExtServer struct { + pb.UnsafeLogicExtServer +} // RegisterDevice 注册设备 func (*LogicExtServer) RegisterDevice(ctx context.Context, in *pb.RegisterDeviceReq) (*pb.RegisterDeviceResp, error) { - deviceId, err := app.DeviceApp.Register(ctx, in) + deviceId, err := device.App.Register(ctx, in) return &pb.RegisterDeviceResp{DeviceId: deviceId}, err } -// SendMessage 发送消息 -func (*LogicExtServer) SendMessage(ctx context.Context, in *pb.SendMessageReq) (*pb.SendMessageResp, error) { +// PushRoom 推送房间 +func (s *LogicExtServer) PushRoom(ctx context.Context, req *pb.PushRoomReq) (*emptypb.Empty, error) { + return &emptypb.Empty{}, room.App.Push(ctx, req) +} + +// SendMessageToFriend 发送好友消息 +func (*LogicExtServer) SendMessageToFriend(ctx context.Context, in *pb.SendMessageReq) (*pb.SendMessageResp, error) { userId, deviceId, err := grpclib.GetCtxData(ctx) if err != nil { return nil, err } - sender := pb.Sender{ - SenderType: pb.SenderType_ST_USER, - SenderId: userId, - DeviceId: deviceId, - } - seq, err := app.MessageApp.SendMessage(ctx, &sender, in) + seq, err := friend.App.SendToFriend(ctx, deviceId, userId, in) if err != nil { return nil, err } return &pb.SendMessageResp{Seq: seq}, nil } -// PushRoom 推送房间 -func (s *LogicExtServer) PushRoom(ctx context.Context, req *pb.PushRoomReq) (*pb.Empty, error) { - userId, deviceId, err := grpclib.GetCtxData(ctx) - if err != nil { - return nil, err - } - return &pb.Empty{}, app.RoomApp.Push(ctx, &pb.Sender{ - SenderType: pb.SenderType_ST_USER, - SenderId: userId, - DeviceId: deviceId, - }, req) -} - -func (s *LogicExtServer) AddFriend(ctx context.Context, in *pb.AddFriendReq) (*pb.Empty, error) { +func (s *LogicExtServer) AddFriend(ctx context.Context, in *pb.AddFriendReq) (*emptypb.Empty, error) { userId, _, err := grpclib.GetCtxData(ctx) if err != nil { return nil, err } - err = app.FriendApp.AddFriend(ctx, userId, in.FriendId, in.Remarks, in.Description) + err = friend.App.AddFriend(ctx, userId, in.FriendId, in.Remarks, in.Description) if err != nil { return nil, err } - return &pb.Empty{}, nil + return &emptypb.Empty{}, nil } -func (s *LogicExtServer) AgreeAddFriend(ctx context.Context, in *pb.AgreeAddFriendReq) (*pb.Empty, error) { +func (s *LogicExtServer) AgreeAddFriend(ctx context.Context, in *pb.AgreeAddFriendReq) (*emptypb.Empty, error) { userId, _, err := grpclib.GetCtxData(ctx) if err != nil { return nil, err } - err = app.FriendApp.AgreeAddFriend(ctx, userId, in.UserId, in.Remarks) + err = friend.App.AgreeAddFriend(ctx, userId, in.UserId, in.Remarks) if err != nil { return nil, err } - return &pb.Empty{}, nil + return &emptypb.Empty{}, nil } func (s *LogicExtServer) SetFriend(ctx context.Context, req *pb.SetFriendReq) (*pb.SetFriendResp, error) { @@ -81,22 +75,36 @@ func (s *LogicExtServer) SetFriend(ctx context.Context, req *pb.SetFriendReq) (* return nil, err } - app.FriendApp.SetFriend(ctx, userId, req) + err = friend.App.SetFriend(ctx, userId, req) if err != nil { return nil, err } return &pb.SetFriendResp{}, nil } -func (s *LogicExtServer) GetFriends(ctx context.Context, in *pb.Empty) (*pb.GetFriendsResp, error) { +func (s *LogicExtServer) GetFriends(ctx context.Context, in *emptypb.Empty) (*pb.GetFriendsResp, error) { userId, _, err := grpclib.GetCtxData(ctx) if err != nil { return nil, err } - friends, err := app.FriendApp.List(ctx, userId) + friends, err := friend.App.List(ctx, userId) return &pb.GetFriendsResp{Friends: friends}, err } +// SendMessageToGroup 发送群组消息 +func (*LogicExtServer) SendMessageToGroup(ctx context.Context, in *pb.SendMessageReq) (*pb.SendMessageResp, error) { + userId, deviceId, err := grpclib.GetCtxData(ctx) + if err != nil { + return nil, err + } + + seq, err := group.App.SendMessage(ctx, deviceId, userId, in) + if err != nil { + return nil, err + } + return &pb.SendMessageResp{Seq: seq}, nil +} + // CreateGroup 创建群组 func (*LogicExtServer) CreateGroup(ctx context.Context, in *pb.CreateGroupReq) (*pb.CreateGroupResp, error) { userId, _, err := grpclib.GetCtxData(ctx) @@ -104,34 +112,34 @@ func (*LogicExtServer) CreateGroup(ctx context.Context, in *pb.CreateGroupReq) ( return nil, err } - groupId, err := app.GroupApp.CreateGroup(ctx, userId, in) + groupId, err := group.App.CreateGroup(ctx, userId, in) return &pb.CreateGroupResp{GroupId: groupId}, err } // UpdateGroup 更新群组 -func (*LogicExtServer) UpdateGroup(ctx context.Context, in *pb.UpdateGroupReq) (*pb.Empty, error) { +func (*LogicExtServer) UpdateGroup(ctx context.Context, in *pb.UpdateGroupReq) (*emptypb.Empty, error) { userId, _, err := grpclib.GetCtxData(ctx) if err != nil { return nil, err } - return &pb.Empty{}, app.GroupApp.Update(ctx, userId, in) + return &emptypb.Empty{}, group.App.Update(ctx, userId, in) } // GetGroup 获取群组信息 func (*LogicExtServer) GetGroup(ctx context.Context, in *pb.GetGroupReq) (*pb.GetGroupResp, error) { - group, err := app.GroupApp.GetGroup(ctx, in.GroupId) + group, err := group.App.GetGroup(ctx, in.GroupId) return &pb.GetGroupResp{Group: group}, err } // GetGroups 获取用户加入的所有群组 -func (*LogicExtServer) GetGroups(ctx context.Context, in *pb.Empty) (*pb.GetGroupsResp, error) { +func (*LogicExtServer) GetGroups(ctx context.Context, in *emptypb.Empty) (*pb.GetGroupsResp, error) { userId, _, err := grpclib.GetCtxData(ctx) if err != nil { return nil, err } - groups, err := app.GroupApp.GetUserGroups(ctx, userId) + groups, err := group.App.GetUserGroups(ctx, userId) return &pb.GetGroupsResp{Groups: groups}, err } @@ -141,28 +149,28 @@ func (s *LogicExtServer) AddGroupMembers(ctx context.Context, in *pb.AddGroupMem return nil, err } - userIds, err := app.GroupApp.AddMembers(ctx, userId, in.GroupId, in.UserIds) + userIds, err := group.App.AddMembers(ctx, userId, in.GroupId, in.UserIds) return &pb.AddGroupMembersResp{UserIds: userIds}, err } // UpdateGroupMember 更新群组成员信息 -func (*LogicExtServer) UpdateGroupMember(ctx context.Context, in *pb.UpdateGroupMemberReq) (*pb.Empty, error) { - return &pb.Empty{}, app.GroupApp.UpdateMember(ctx, in) +func (*LogicExtServer) UpdateGroupMember(ctx context.Context, in *pb.UpdateGroupMemberReq) (*emptypb.Empty, error) { + return &emptypb.Empty{}, group.App.UpdateMember(ctx, in) } // DeleteGroupMember 添加群组成员 -func (*LogicExtServer) DeleteGroupMember(ctx context.Context, in *pb.DeleteGroupMemberReq) (*pb.Empty, error) { +func (*LogicExtServer) DeleteGroupMember(ctx context.Context, in *pb.DeleteGroupMemberReq) (*emptypb.Empty, error) { userId, _, err := grpclib.GetCtxData(ctx) if err != nil { return nil, err } - err = app.GroupApp.DeleteMember(ctx, in.GroupId, in.UserId, userId) - return &pb.Empty{}, err + err = group.App.DeleteMember(ctx, in.GroupId, in.UserId, userId) + return &emptypb.Empty{}, err } // GetGroupMembers 获取群组成员信息 func (s *LogicExtServer) GetGroupMembers(ctx context.Context, in *pb.GetGroupMembersReq) (*pb.GetGroupMembersResp, error) { - members, err := app.GroupApp.GetMembers(ctx, in.GroupId) + members, err := group.App.GetMembers(ctx, in.GroupId) return &pb.GetGroupMembersResp{Members: members}, err } diff --git a/internal/logic/api/logic_ext_test.go b/internal/logic/api/logic_ext_test.go index ef96cadc..d3576466 100644 --- a/internal/logic/api/logic_ext_test.go +++ b/internal/logic/api/logic_ext_test.go @@ -3,7 +3,7 @@ package api import ( "context" "fmt" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/util" "strconv" "testing" @@ -11,11 +11,10 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/metadata" - "google.golang.org/protobuf/proto" ) func getLogicExtClient() pb.LogicExtClient { - conn, err := grpc.Dial("127.0.0.1:8000", grpc.WithInsecure()) + conn, err := grpc.Dial("127.0.0.1:8010", grpc.WithInsecure()) if err != nil { fmt.Println(err) return nil @@ -26,8 +25,8 @@ func getLogicExtClient() pb.LogicExtClient { func getCtx() context.Context { token := "0" return metadata.NewOutgoingContext(context.TODO(), metadata.Pairs( - "user_id", "2", - "device_id", "1", + "user_id", "3", + "device_id", "3", "token", token, "request_id", strconv.FormatInt(time.Now().UnixNano(), 10))) } @@ -48,52 +47,12 @@ func TestLogicExtServer_RegisterDevice(t *testing.T) { fmt.Printf("%+v\n", resp) } -func TestLogicExtServer_SendMessage(t *testing.T) { - buf, err := proto.Marshal(&pb.Text{ - Text: "hello alber ", - }) - if err != nil { - fmt.Println(err) - return - } - resp, err := getLogicExtClient().SendMessage(getCtx(), - &pb.SendMessageReq{ - ReceiverType: pb.ReceiverType_RT_USER, - ReceiverId: 1, - ToUserIds: nil, - MessageType: pb.MessageType_MT_TEXT, - MessageContent: buf, - IsPersist: true, - SendTime: util.UnixMilliTime(time.Now()), - }) - if err != nil { - fmt.Println(err) - return - } - fmt.Printf("%+v\n", resp) -} - -func TestLogicExtServer_SendImageMessage(t *testing.T) { - buf, err := proto.Marshal(&pb.Image{ - Id: "", - Width: 0, - Height: 0, - Url: "https://img.iplaysoft.com/wp-content/uploads/2019/free-images/free_stock_photo.jpg", - ThumbnailUrl: "", - }) - if err != nil { - fmt.Println(err) - return - } - resp, err := getLogicExtClient().SendMessage(getCtx(), +func TestLogicExtServer_SendMessageToFriend(t *testing.T) { + resp, err := getLogicExtClient().SendMessageToFriend(getCtx(), &pb.SendMessageReq{ - ReceiverType: pb.ReceiverType_RT_USER, - ReceiverId: 1, - ToUserIds: nil, - MessageType: pb.MessageType_MT_IMAGE, - MessageContent: buf, - IsPersist: true, - SendTime: util.UnixMilliTime(time.Now()), + ReceiverId: 2, + Content: []byte("hahaha"), + SendTime: util.UnixMilliTime(time.Now()), }) if err != nil { fmt.Println(err) diff --git a/internal/logic/api/logic_int.go b/internal/logic/api/logic_int.go index 9e98f3e6..07f020db 100644 --- a/internal/logic/api/logic_int.go +++ b/internal/logic/api/logic_int.go @@ -2,78 +2,77 @@ package api import ( "context" - "gim/internal/logic/app" + "gim/internal/logic/domain/device" + "gim/internal/logic/domain/message" + "gim/internal/logic/domain/room" + "gim/internal/logic/proxy" "gim/pkg/logger" - "gim/pkg/pb" + "gim/pkg/protocol/pb" + + "google.golang.org/protobuf/types/known/emptypb" ) -type LogicIntServer struct{} +type LogicIntServer struct { + pb.UnsafeLogicIntServer +} // ConnSignIn 设备登录 -func (*LogicIntServer) ConnSignIn(ctx context.Context, req *pb.ConnSignInReq) (*pb.Empty, error) { - return &pb.Empty{}, - app.DeviceApp.SignIn(ctx, req.UserId, req.DeviceId, req.Token, req.ConnAddr, req.ClientAddr) +func (*LogicIntServer) ConnSignIn(ctx context.Context, req *pb.ConnSignInReq) (*emptypb.Empty, error) { + return &emptypb.Empty{}, + device.App.SignIn(ctx, req.UserId, req.DeviceId, req.Token, req.ConnAddr, req.ClientAddr) } // Sync 设备同步消息 func (*LogicIntServer) Sync(ctx context.Context, req *pb.SyncReq) (*pb.SyncResp, error) { - return app.MessageApp.Sync(ctx, req.UserId, req.Seq) + return message.App.Sync(ctx, req.UserId, req.Seq) } // MessageACK 设备收到消息ack -func (*LogicIntServer) MessageACK(ctx context.Context, req *pb.MessageACKReq) (*pb.Empty, error) { - return &pb.Empty{}, app.MessageApp.MessageAck(ctx, req.UserId, req.DeviceId, req.DeviceAck) +func (*LogicIntServer) MessageACK(ctx context.Context, req *pb.MessageACKReq) (*emptypb.Empty, error) { + return &emptypb.Empty{}, message.App.MessageAck(ctx, req.UserId, req.DeviceId, req.DeviceAck) } // Offline 设备离线 -func (*LogicIntServer) Offline(ctx context.Context, req *pb.OfflineReq) (*pb.Empty, error) { - return &pb.Empty{}, app.DeviceApp.Offline(ctx, req.DeviceId, req.ClientAddr) +func (*LogicIntServer) Offline(ctx context.Context, req *pb.OfflineReq) (*emptypb.Empty, error) { + return &emptypb.Empty{}, device.App.Offline(ctx, req.DeviceId, req.ClientAddr) } -func (s *LogicIntServer) SubscribeRoom(ctx context.Context, req *pb.SubscribeRoomReq) (*pb.Empty, error) { - return &pb.Empty{}, app.RoomApp.SubscribeRoom(ctx, req) +func (s *LogicIntServer) SubscribeRoom(ctx context.Context, req *pb.SubscribeRoomReq) (*emptypb.Empty, error) { + return &emptypb.Empty{}, room.App.SubscribeRoom(ctx, req) } -// SendMessage 发送消息 -func (*LogicIntServer) SendMessage(ctx context.Context, req *pb.SendMessageReq) (*pb.SendMessageResp, error) { - sender := pb.Sender{ - SenderType: pb.SenderType_ST_BUSINESS, - SenderId: 0, - DeviceId: 0, - } - - seq, err := app.MessageApp.SendMessage(ctx, &sender, req) +// Push 推送 +func (*LogicIntServer) Push(ctx context.Context, req *pb.PushReq) (*pb.PushResp, error) { + seq, err := proxy.PushToUserBytes(ctx, req.UserId, req.Code, req.Content, req.IsPersist) if err != nil { return nil, err } - return &pb.SendMessageResp{Seq: seq}, nil + return &pb.PushResp{Seq: seq}, nil } // PushRoom 推送房间 -func (s *LogicIntServer) PushRoom(ctx context.Context, req *pb.PushRoomReq) (*pb.Empty, error) { - return &pb.Empty{}, app.RoomApp.Push(ctx, &pb.Sender{ - SenderType: pb.SenderType_ST_BUSINESS, - }, req) +func (s *LogicIntServer) PushRoom(ctx context.Context, req *pb.PushRoomReq) (*emptypb.Empty, error) { + return &emptypb.Empty{}, room.App.Push(ctx, req) } // PushAll 全服推送 -func (s *LogicIntServer) PushAll(ctx context.Context, req *pb.PushAllReq) (*pb.Empty, error) { - return &pb.Empty{}, app.MessageApp.PushAll(ctx, req) +func (s *LogicIntServer) PushAll(ctx context.Context, req *pb.PushAllReq) (*emptypb.Empty, error) { + return &emptypb.Empty{}, message.App.PushAll(ctx, req) } // GetDevice 获取设备信息 func (*LogicIntServer) GetDevice(ctx context.Context, req *pb.GetDeviceReq) (*pb.GetDeviceResp, error) { - device, err := app.DeviceApp.GetDevice(ctx, req.DeviceId) + device, err := device.App.GetDevice(ctx, req.DeviceId) return &pb.GetDeviceResp{Device: device}, err } // ServerStop 服务停止 -func (s *LogicIntServer) ServerStop(ctx context.Context, in *pb.ServerStopReq) (*pb.Empty, error) { +func (s *LogicIntServer) ServerStop(ctx context.Context, in *pb.ServerStopReq) (*emptypb.Empty, error) { go func() { - err := app.DeviceApp.ServerStop(ctx, in.ConnAddr) + err := device.App.ServerStop(ctx, in.ConnAddr) if err != nil { logger.Sugar.Error(err) } }() - return &pb.Empty{}, nil + return &emptypb.Empty{}, nil } diff --git a/internal/logic/api/logic_int_test.go b/internal/logic/api/logic_int_test.go index a2fa4de7..25506529 100644 --- a/internal/logic/api/logic_int_test.go +++ b/internal/logic/api/logic_int_test.go @@ -4,12 +4,8 @@ import ( "context" "fmt" "gim/pkg/logger" - "gim/pkg/pb" - "gim/pkg/util" + "gim/pkg/protocol/pb" "testing" - "time" - - "google.golang.org/protobuf/proto" "google.golang.org/grpc" "google.golang.org/grpc/metadata" @@ -84,20 +80,11 @@ func TestLogicIntServer_Offline(t *testing.T) { } func TestLogicIntServer_PushRoom(t *testing.T) { - buf, err := proto.Marshal(&pb.Text{ - Text: "hello alber ", - }) - if err != nil { - fmt.Println(err) - return - } resp, err := getLogicIntClient().PushRoom(getCtx(), &pb.PushRoomReq{ - RoomId: 1, - MessageType: pb.MessageType_MT_TEXT, - MessageContent: buf, - SendTime: util.UnixMilliTime(time.Now()), - IsPersist: true, + RoomId: 1, + Code: 1, + Content: []byte("hahaha"), }) if err != nil { fmt.Println(err) @@ -107,18 +94,10 @@ func TestLogicIntServer_PushRoom(t *testing.T) { } func TestLogicIntServer_PushAll(t *testing.T) { - buf, err := proto.Marshal(&pb.Text{ - Text: "hello alber ", - }) - if err != nil { - fmt.Println(err) - return - } resp, err := getLogicIntClient().PushAll(getCtx(), &pb.PushAllReq{ - MessageType: pb.MessageType_MT_TEXT, - MessageContent: buf, - SendTime: util.UnixMilliTime(time.Now()), + Code: 1, + Content: []byte("hahaha"), }) if err != nil { fmt.Println(err) diff --git a/internal/logic/app/device_app.go b/internal/logic/app/device_app.go deleted file mode 100644 index 0bca312e..00000000 --- a/internal/logic/app/device_app.go +++ /dev/null @@ -1,85 +0,0 @@ -package app - -import ( - "context" - devicedomain "gim/internal/logic/domain/device" - "gim/pkg/gerrors" - "gim/pkg/pb" -) - -type deviceApp struct{} - -var DeviceApp = new(deviceApp) - -// Register 注册设备 -func (*deviceApp) Register(ctx context.Context, in *pb.RegisterDeviceReq) (int64, error) { - device := devicedomain.Device{ - Type: in.Type, - Brand: in.Brand, - Model: in.Model, - SystemVersion: in.SystemVersion, - SDKVersion: in.SdkVersion, - } - - // 判断设备信息是否合法 - if !device.IsLegal() { - return 0, gerrors.ErrBadRequest - } - - err := devicedomain.DeviceRepo.Save(&device) - if err != nil { - return 0, err - } - - return device.Id, nil -} - -// SignIn 登录 -func (*deviceApp) SignIn(ctx context.Context, userId, deviceId int64, token string, connAddr string, clientAddr string) error { - return devicedomain.DeviceService.SignIn(ctx, userId, deviceId, token, connAddr, clientAddr) -} - -// Offline 设备离线 -func (*deviceApp) Offline(ctx context.Context, deviceId int64, clientAddr string) error { - device, err := devicedomain.DeviceRepo.Get(deviceId) - if err != nil { - return err - } - if device == nil { - return nil - } - - if device.ClientAddr != clientAddr { - return nil - } - device.Status = devicedomain.DeviceOffLine - - err = devicedomain.DeviceRepo.Save(device) - if err != nil { - return err - } - return nil -} - -// ListOnlineByUserId 获取用户所有在线设备 -func (*deviceApp) ListOnlineByUserId(ctx context.Context, userId int64) ([]*pb.Device, error) { - return devicedomain.DeviceService.ListOnlineByUserId(ctx, userId) -} - -// GetDevice 获取设备信息 -func (*deviceApp) GetDevice(ctx context.Context, deviceId int64) (*pb.Device, error) { - device, err := devicedomain.DeviceRepo.Get(deviceId) - if err != nil { - return nil, err - } - if device == nil { - return nil, gerrors.ErrDeviceNotExist - } - - return device.ToProto(), err -} - -// ServerStop connect服务停止 -func (*deviceApp) ServerStop(ctx context.Context, connAddr string) error { - return devicedomain.DeviceService.ServerStop(ctx, connAddr) -} diff --git a/internal/logic/app/friend_app.go b/internal/logic/app/friend_app.go deleted file mode 100644 index a016d135..00000000 --- a/internal/logic/app/friend_app.go +++ /dev/null @@ -1,53 +0,0 @@ -package app - -import ( - "context" - frienddomain "gim/internal/logic/domain/friend" - "gim/pkg/pb" - "time" -) - -type friendApp struct{} - -var FriendApp = new(friendApp) - -// List 获取好友列表 -func (s *friendApp) List(ctx context.Context, userId int64) ([]*pb.Friend, error) { - return frienddomain.FriendService.List(ctx, userId) -} - -// AddFriend 添加好友 -func (*friendApp) AddFriend(ctx context.Context, userId, friendId int64, remarks, description string) error { - return frienddomain.FriendService.AddFriend(ctx, userId, friendId, remarks, description) -} - -// AgreeAddFriend 同意添加好友 -func (*friendApp) AgreeAddFriend(ctx context.Context, userId, friendId int64, remarks string) error { - return frienddomain.FriendService.AgreeAddFriend(ctx, userId, friendId, remarks) -} - -// SetFriend 设置好友信息 -func (*friendApp) SetFriend(ctx context.Context, userId int64, req *pb.SetFriendReq) error { - friend, err := frienddomain.FriendRepo.Get(userId, req.FriendId) - if err != nil { - return err - } - if friend == nil { - return nil - } - - friend.Remarks = req.Remarks - friend.Extra = req.Extra - friend.UpdateTime = time.Now() - - err = frienddomain.FriendRepo.Save(friend) - if err != nil { - return err - } - return nil -} - -// SendToFriend 消息发送至好友 -func (*friendApp) SendToFriend(ctx context.Context, sender *pb.Sender, req *pb.SendMessageReq) (int64, error) { - return frienddomain.FriendService.SendToFriend(ctx, sender, req) -} diff --git a/internal/logic/app/message_app.go b/internal/logic/app/message_app.go deleted file mode 100644 index 0fa85cf8..00000000 --- a/internal/logic/app/message_app.go +++ /dev/null @@ -1,59 +0,0 @@ -package app - -import ( - "context" - "gim/internal/logic/domain/message/service" - "gim/pkg/pb" - - "google.golang.org/protobuf/proto" -) - -type messageApp struct{} - -var MessageApp = new(messageApp) - -// SendToUser 发送消息给用户 -func (*messageApp) SendToUser(ctx context.Context, sender *pb.Sender, toUserId int64, req *pb.SendMessageReq) (int64, error) { - return service.MessageService.SendToUser(ctx, sender, toUserId, req) -} - -// PushToUser 推送消息给用户 -func (*messageApp) PushToUser(ctx context.Context, userId int64, code pb.PushCode, message proto.Message, isPersist bool) error { - return service.PushService.PushToUser(ctx, userId, code, message, isPersist) -} - -// PushAll 全服推送 -func (*messageApp) PushAll(ctx context.Context, req *pb.PushAllReq) error { - return service.PushService.PushAll(ctx, req) -} - -// Sync 消息同步 -func (*messageApp) Sync(ctx context.Context, userId, seq int64) (*pb.SyncResp, error) { - return service.MessageService.Sync(ctx, userId, seq) -} - -// MessageAck 收到消息回执 -func (*messageApp) MessageAck(ctx context.Context, userId, deviceId, ack int64) error { - return service.DeviceAckService.Update(ctx, userId, deviceId, ack) -} - -// SendMessage 发送消息 -func (s *messageApp) SendMessage(ctx context.Context, sender *pb.Sender, req *pb.SendMessageReq) (int64, error) { - // 如果发送者是用户,需要补充用户的信息 - service.MessageService.AddSenderInfo(sender) - - switch req.ReceiverType { - // 消息接收者为用户 - case pb.ReceiverType_RT_USER: - // 发送者为用户 - if sender.SenderType == pb.SenderType_ST_USER { - return FriendApp.SendToFriend(ctx, sender, req) - } else { - return s.SendToUser(ctx, sender, req.ReceiverId, req) - } - // 消息接收者是群组 - case pb.ReceiverType_RT_GROUP: - return GroupApp.SendMessage(ctx, sender, req) - } - return 0, nil -} diff --git a/internal/logic/app/room_app.go b/internal/logic/app/room_app.go deleted file mode 100644 index 0eb1a800..00000000 --- a/internal/logic/app/room_app.go +++ /dev/null @@ -1,21 +0,0 @@ -package app - -import ( - "context" - "gim/internal/logic/domain/room" - "gim/pkg/pb" -) - -type roomApp struct{} - -var RoomApp = new(roomApp) - -// Push 推送房间消息 -func (s *roomApp) Push(ctx context.Context, sender *pb.Sender, req *pb.PushRoomReq) error { - return room.RoomService.Push(ctx, sender, req) -} - -// SubscribeRoom 订阅房间 -func (s *roomApp) SubscribeRoom(ctx context.Context, req *pb.SubscribeRoomReq) error { - return room.RoomService.SubscribeRoom(ctx, req) -} diff --git a/internal/logic/domain/device/device_dao.go b/internal/logic/domain/device/dao.go similarity index 77% rename from internal/logic/domain/device/device_dao.go rename to internal/logic/domain/device/dao.go index da0b8d74..f7ce0856 100644 --- a/internal/logic/domain/device/device_dao.go +++ b/internal/logic/domain/device/dao.go @@ -9,12 +9,12 @@ import ( "github.com/jinzhu/gorm" ) -type deviceDao struct{} +type dao struct{} -var DeviceDao = new(deviceDao) +var Dao = new(dao) // Save 插入一条设备信息 -func (*deviceDao) Save(device *Device) error { +func (*dao) Save(device *Device) error { device.CreateTime = time.Now() device.UpdateTime = time.Now() err := db.DB.Save(&device).Error @@ -25,7 +25,7 @@ func (*deviceDao) Save(device *Device) error { } // Get 获取设备 -func (*deviceDao) Get(deviceId int64) (*Device, error) { +func (*dao) Get(deviceId int64) (*Device, error) { var device = Device{Id: deviceId} err := db.DB.First(&device).Error if err != nil && err != gorm.ErrRecordNotFound { @@ -38,7 +38,7 @@ func (*deviceDao) Get(deviceId int64) (*Device, error) { } // ListOnlineByUserId 查询用户所有的在线设备 -func (*deviceDao) ListOnlineByUserId(userId int64) ([]Device, error) { +func (*dao) ListOnlineByUserId(userId int64) ([]Device, error) { var devices []Device err := db.DB.Find(&devices, "user_id = ? and status = ?", userId, DeviceOnLine).Error if err != nil { @@ -48,7 +48,7 @@ func (*deviceDao) ListOnlineByUserId(userId int64) ([]Device, error) { } // ListOnlineByConnAddr 查询用户所有的在线设备 -func (*deviceDao) ListOnlineByConnAddr(connAddr string) ([]Device, error) { +func (*dao) ListOnlineByConnAddr(connAddr string) ([]Device, error) { var devices []Device err := db.DB.Find(&devices, "conn_addr = ? and status = ?", connAddr, DeviceOnLine).Error if err != nil { @@ -58,7 +58,7 @@ func (*deviceDao) ListOnlineByConnAddr(connAddr string) ([]Device, error) { } // UpdateStatus 更新在线状态 -func (*deviceDao) UpdateStatus(deviceId int64, connAddr string, status int) (int64, error) { +func (*dao) UpdateStatus(deviceId int64, connAddr string, status int) (int64, error) { db := db.DB.Model(&model.Device{}).Where("id = ? and conn_addr = ?", deviceId, connAddr). Update("status", status) if db.Error != nil { diff --git a/internal/logic/domain/device/device_dao_test.go b/internal/logic/domain/device/dao_test.go similarity index 73% rename from internal/logic/domain/device/device_dao_test.go rename to internal/logic/domain/device/dao_test.go index 5413f073..3d3acef8 100644 --- a/internal/logic/domain/device/device_dao_test.go +++ b/internal/logic/domain/device/dao_test.go @@ -2,15 +2,9 @@ package device import ( "fmt" - "gim/pkg/db" "testing" ) -func init() { - fmt.Println("start") - db.InitByTest() -} - func TestDeviceDao_Add(t *testing.T) { device := Device{ UserId: 1, @@ -21,18 +15,18 @@ func TestDeviceDao_Add(t *testing.T) { SDKVersion: "1.0.0", Status: 1, } - err := DeviceDao.Save(&device) + err := Dao.Save(&device) fmt.Println(err) fmt.Println(device) } func TestDeviceDao_Get(t *testing.T) { - device, err := DeviceDao.Get(1) + device, err := Dao.Get(1) fmt.Printf("%+v\n %+v\n", device, err) } func TestDeviceDao_ListOnlineByUserId(t *testing.T) { - devices, err := DeviceDao.ListOnlineByUserId(1) + devices, err := Dao.ListOnlineByUserId(1) fmt.Println(err) fmt.Printf("%+v \n", devices) } diff --git a/internal/logic/domain/device/device_app.go b/internal/logic/domain/device/device_app.go new file mode 100644 index 00000000..321790be --- /dev/null +++ b/internal/logic/domain/device/device_app.go @@ -0,0 +1,84 @@ +package device + +import ( + "context" + "gim/pkg/gerrors" + "gim/pkg/protocol/pb" +) + +type app struct{} + +var App = new(app) + +// Register 注册设备 +func (*app) Register(ctx context.Context, in *pb.RegisterDeviceReq) (int64, error) { + device := Device{ + Type: in.Type, + Brand: in.Brand, + Model: in.Model, + SystemVersion: in.SystemVersion, + SDKVersion: in.SdkVersion, + } + + // 判断设备信息是否合法 + if !device.IsLegal() { + return 0, gerrors.ErrBadRequest + } + + err := Repo.Save(&device) + if err != nil { + return 0, err + } + + return device.Id, nil +} + +// SignIn 登录 +func (*app) SignIn(ctx context.Context, userId, deviceId int64, token string, connAddr string, clientAddr string) error { + return Service.SignIn(ctx, userId, deviceId, token, connAddr, clientAddr) +} + +// Offline 设备离线 +func (*app) Offline(ctx context.Context, deviceId int64, clientAddr string) error { + device, err := Repo.Get(deviceId) + if err != nil { + return err + } + if device == nil { + return nil + } + + if device.ClientAddr != clientAddr { + return nil + } + device.Status = DeviceOffLine + + err = Repo.Save(device) + if err != nil { + return err + } + return nil +} + +// ListOnlineByUserId 获取用户所有在线设备 +func (*app) ListOnlineByUserId(ctx context.Context, userId int64) ([]*pb.Device, error) { + return Service.ListOnlineByUserId(ctx, userId) +} + +// GetDevice 获取设备信息 +func (*app) GetDevice(ctx context.Context, deviceId int64) (*pb.Device, error) { + device, err := Repo.Get(deviceId) + if err != nil { + return nil, err + } + if device == nil { + return nil, gerrors.ErrDeviceNotExist + } + + return device.ToProto(), err +} + +// ServerStop connect服务停止 +func (*app) ServerStop(ctx context.Context, connAddr string) error { + return Service.ServerStop(ctx, connAddr) +} diff --git a/internal/logic/domain/device/device.go b/internal/logic/domain/device/entity.go similarity index 98% rename from internal/logic/domain/device/device.go rename to internal/logic/domain/device/entity.go index cc73b587..a60c7481 100644 --- a/internal/logic/domain/device/device.go +++ b/internal/logic/domain/device/entity.go @@ -1,7 +1,7 @@ package device import ( - "gim/pkg/pb" + "gim/pkg/protocol/pb" "time" ) diff --git a/internal/logic/domain/device/device_repo.go b/internal/logic/domain/device/repo.go similarity index 58% rename from internal/logic/domain/device/device_repo.go rename to internal/logic/domain/device/repo.go index c78ce3ec..2e43dd6c 100644 --- a/internal/logic/domain/device/device_repo.go +++ b/internal/logic/domain/device/repo.go @@ -1,12 +1,12 @@ package device -type deviceRepo struct{} +type repo struct{} -var DeviceRepo = new(deviceRepo) +var Repo = new(repo) // Get 获取设备 -func (*deviceRepo) Get(deviceId int64) (*Device, error) { - device, err := DeviceDao.Get(deviceId) +func (*repo) Get(deviceId int64) (*Device, error) { + device, err := Dao.Get(deviceId) if err != nil { return nil, err } @@ -14,8 +14,8 @@ func (*deviceRepo) Get(deviceId int64) (*Device, error) { } // Save 保存设备信息 -func (*deviceRepo) Save(device *Device) error { - err := DeviceDao.Save(device) +func (*repo) Save(device *Device) error { + err := Dao.Save(device) if err != nil { return err } @@ -30,7 +30,7 @@ func (*deviceRepo) Save(device *Device) error { } // ListOnlineByUserId 获取用户的所有在线设备 -func (*deviceRepo) ListOnlineByUserId(userId int64) ([]Device, error) { +func (*repo) ListOnlineByUserId(userId int64) ([]Device, error) { devices, err := UserDeviceCache.Get(userId) if err != nil { return nil, err @@ -40,7 +40,7 @@ func (*deviceRepo) ListOnlineByUserId(userId int64) ([]Device, error) { return devices, nil } - devices, err = DeviceDao.ListOnlineByUserId(userId) + devices, err = Dao.ListOnlineByUserId(userId) if err != nil { return nil, err } @@ -54,13 +54,13 @@ func (*deviceRepo) ListOnlineByUserId(userId int64) ([]Device, error) { } // ListOnlineByConnAddr 查询用户所有的在线设备 -func (*deviceRepo) ListOnlineByConnAddr(connAddr string) ([]Device, error) { - return DeviceDao.ListOnlineByConnAddr(connAddr) +func (*repo) ListOnlineByConnAddr(connAddr string) ([]Device, error) { + return Dao.ListOnlineByConnAddr(connAddr) } // UpdateStatusOffline 更新设备为离线状态 -func (*deviceRepo) UpdateStatusOffline(device Device) error { - affected, err := DeviceDao.UpdateStatus(device.Id, device.ConnAddr, DeviceOffLine) +func (*repo) UpdateStatusOffline(device Device) error { + affected, err := Dao.UpdateStatus(device.Id, device.ConnAddr, DeviceOffLine) if err != nil { return err } diff --git a/internal/logic/domain/device/device_service.go b/internal/logic/domain/device/service.go similarity index 61% rename from internal/logic/domain/device/device_service.go rename to internal/logic/domain/device/service.go index 32283ed1..e378f5cf 100644 --- a/internal/logic/domain/device/device_service.go +++ b/internal/logic/domain/device/service.go @@ -3,20 +3,20 @@ package device import ( "context" "gim/pkg/logger" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/rpc" "time" "go.uber.org/zap" ) -type deviceService struct{} +type service struct{} -var DeviceService = new(deviceService) +var Service = new(service) // Register 注册设备 -func (*deviceService) Register(ctx context.Context, device *Device) error { - err := DeviceDao.Save(device) +func (*service) Register(ctx context.Context, device *Device) error { + err := Repo.Save(device) if err != nil { return err } @@ -25,14 +25,14 @@ func (*deviceService) Register(ctx context.Context, device *Device) error { } // SignIn 长连接登录 -func (*deviceService) SignIn(ctx context.Context, userId, deviceId int64, token string, connAddr string, clientAddr string) error { +func (*service) SignIn(ctx context.Context, userId, deviceId int64, token string, connAddr string, clientAddr string) error { _, err := rpc.GetBusinessIntClient().Auth(ctx, &pb.AuthReq{UserId: userId, DeviceId: deviceId, Token: token}) if err != nil { return err } // 标记用户在设备上登录 - device, err := DeviceRepo.Get(deviceId) + device, err := Repo.Get(deviceId) if err != nil { return err } @@ -42,7 +42,7 @@ func (*deviceService) SignIn(ctx context.Context, userId, deviceId int64, token device.Online(userId, connAddr, clientAddr) - err = DeviceRepo.Save(device) + err = Repo.Save(device) if err != nil { return err } @@ -50,7 +50,7 @@ func (*deviceService) SignIn(ctx context.Context, userId, deviceId int64, token } // Auth 权限验证 -func (*deviceService) Auth(ctx context.Context, userId, deviceId int64, token string) error { +func (*service) Auth(ctx context.Context, userId, deviceId int64, token string) error { _, err := rpc.GetBusinessIntClient().Auth(ctx, &pb.AuthReq{UserId: userId, DeviceId: deviceId, Token: token}) if err != nil { return err @@ -58,8 +58,8 @@ func (*deviceService) Auth(ctx context.Context, userId, deviceId int64, token st return nil } -func (*deviceService) ListOnlineByUserId(ctx context.Context, userId int64) ([]*pb.Device, error) { - devices, err := DeviceRepo.ListOnlineByUserId(userId) +func (*service) ListOnlineByUserId(ctx context.Context, userId int64) ([]*pb.Device, error) { + devices, err := Repo.ListOnlineByUserId(userId) if err != nil { return nil, err } @@ -71,15 +71,15 @@ func (*deviceService) ListOnlineByUserId(ctx context.Context, userId int64) ([]* } // ServerStop connect服务停止,需要将连接在这台connect上的设备标记为下线 -func (*deviceService) ServerStop(ctx context.Context, connAddr string) error { - devices, err := DeviceRepo.ListOnlineByConnAddr(connAddr) +func (*service) ServerStop(ctx context.Context, connAddr string) error { + devices, err := Repo.ListOnlineByConnAddr(connAddr) if err != nil { return err } for i := range devices { // 因为是异步修改设备转台,要避免设备重连,导致状态不一致 - err = DeviceRepo.UpdateStatusOffline(devices[i]) + err = Repo.UpdateStatusOffline(devices[i]) if err != nil { logger.Logger.Error("DeviceRepo.Save error", zap.Any("device", devices[i]), zap.Error(err)) } diff --git a/internal/logic/domain/friend/app.go b/internal/logic/domain/friend/app.go new file mode 100644 index 00000000..cefca373 --- /dev/null +++ b/internal/logic/domain/friend/app.go @@ -0,0 +1,52 @@ +package friend + +import ( + "context" + "gim/pkg/protocol/pb" + "time" +) + +type app struct{} + +var App = new(app) + +// List 获取好友列表 +func (s *app) List(ctx context.Context, userId int64) ([]*pb.Friend, error) { + return Service.List(ctx, userId) +} + +// AddFriend 添加好友 +func (*app) AddFriend(ctx context.Context, userId, friendId int64, remarks, description string) error { + return Service.AddFriend(ctx, userId, friendId, remarks, description) +} + +// AgreeAddFriend 同意添加好友 +func (*app) AgreeAddFriend(ctx context.Context, userId, friendId int64, remarks string) error { + return Service.AgreeAddFriend(ctx, userId, friendId, remarks) +} + +// SetFriend 设置好友信息 +func (*app) SetFriend(ctx context.Context, userId int64, req *pb.SetFriendReq) error { + friend, err := Repo.Get(userId, req.FriendId) + if err != nil { + return err + } + if friend == nil { + return nil + } + + friend.Remarks = req.Remarks + friend.Extra = req.Extra + friend.UpdateTime = time.Now() + + err = Repo.Save(friend) + if err != nil { + return err + } + return nil +} + +// SendToFriend 消息发送至好友 +func (*app) SendToFriend(ctx context.Context, fromDeviceID, fromUserID int64, req *pb.SendMessageReq) (int64, error) { + return Service.SendToFriend(ctx, fromDeviceID, fromUserID, req) +} diff --git a/internal/logic/domain/friend/friend.go b/internal/logic/domain/friend/entity.go similarity index 100% rename from internal/logic/domain/friend/friend.go rename to internal/logic/domain/friend/entity.go diff --git a/internal/logic/domain/friend/friend_repo.go b/internal/logic/domain/friend/repo.go similarity index 72% rename from internal/logic/domain/friend/friend_repo.go rename to internal/logic/domain/friend/repo.go index 1f26c08e..4ea3b1b1 100644 --- a/internal/logic/domain/friend/friend_repo.go +++ b/internal/logic/domain/friend/repo.go @@ -7,12 +7,12 @@ import ( "github.com/jinzhu/gorm" ) -type friendRepo struct{} +type repo struct{} -var FriendRepo = new(friendRepo) +var Repo = new(repo) // Get 获取好友 -func (*friendRepo) Get(userId, friendId int64) (*Friend, error) { +func (*repo) Get(userId, friendId int64) (*Friend, error) { friend := Friend{} err := db.DB.First(&friend, "user_id = ? and friend_id = ?", userId, friendId).Error if err != nil && err != gorm.ErrRecordNotFound { @@ -25,12 +25,12 @@ func (*friendRepo) Get(userId, friendId int64) (*Friend, error) { } // Save 添加好友 -func (*friendRepo) Save(friend *Friend) error { +func (*repo) Save(friend *Friend) error { return gerrors.WrapError(db.DB.Save(&friend).Error) } // List 获取好友列表 -func (*friendRepo) List(userId int64, status int) ([]Friend, error) { +func (*repo) List(userId int64, status int) ([]Friend, error) { var friends []Friend err := db.DB.Where("user_id = ? and status = ?", userId, status).Find(&friends).Error return friends, gerrors.WrapError(err) diff --git a/internal/logic/domain/friend/friend_repo_test.go b/internal/logic/domain/friend/repo_test.go similarity index 69% rename from internal/logic/domain/friend/friend_repo_test.go rename to internal/logic/domain/friend/repo_test.go index e2573aa5..acdb6fd3 100644 --- a/internal/logic/domain/friend/friend_repo_test.go +++ b/internal/logic/domain/friend/repo_test.go @@ -6,18 +6,18 @@ import ( ) func Test_friendDao_Get(t *testing.T) { - friend, err := FriendRepo.Get(1, 2) + friend, err := Repo.Get(1, 2) fmt.Printf("%+v \n %+v \n", friend, err) } func Test_friendDao_Save(t *testing.T) { - fmt.Println(FriendRepo.Save(&Friend{ + fmt.Println(Repo.Save(&Friend{ UserId: 1, FriendId: 2, })) } func Test_friendDao_List(t *testing.T) { - friends, err := FriendRepo.List(1, FriendStatusAgree) + friends, err := Repo.List(1, FriendStatusAgree) fmt.Printf("%+v \n %+v \n", friends, err) } diff --git a/internal/logic/domain/friend/friend_service.go b/internal/logic/domain/friend/service.go similarity index 62% rename from internal/logic/domain/friend/friend_service.go rename to internal/logic/domain/friend/service.go index a235f32f..de2a8ae2 100644 --- a/internal/logic/domain/friend/friend_service.go +++ b/internal/logic/domain/friend/service.go @@ -4,18 +4,20 @@ import ( "context" "gim/internal/logic/proxy" "gim/pkg/gerrors" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/rpc" "time" + + "google.golang.org/protobuf/proto" ) -type friendService struct{} +type service struct{} -var FriendService = new(friendService) +var Service = new(service) // List 获取好友列表 -func (s *friendService) List(ctx context.Context, userId int64) ([]*pb.Friend, error) { - friends, err := FriendRepo.List(userId, FriendStatusAgree) +func (s *service) List(ctx context.Context, userId int64) ([]*pb.Friend, error) { + friends, err := Repo.List(userId, FriendStatusAgree) if err != nil { return nil, err } @@ -51,8 +53,8 @@ func (s *friendService) List(ctx context.Context, userId int64) ([]*pb.Friend, e } // AddFriend 添加好友 -func (*friendService) AddFriend(ctx context.Context, userId, friendId int64, remarks, description string) error { - friend, err := FriendRepo.Get(userId, friendId) +func (*service) AddFriend(ctx context.Context, userId, friendId int64, remarks, description string) error { + friend, err := Repo.Get(userId, friendId) if err != nil { return err } @@ -66,7 +68,7 @@ func (*friendService) AddFriend(ctx context.Context, userId, friendId int64, rem } now := time.Now() - err = FriendRepo.Save(&Friend{ + err = Repo.Save(&Friend{ UserId: userId, FriendId: friendId, Remarks: remarks, @@ -83,7 +85,7 @@ func (*friendService) AddFriend(ctx context.Context, userId, friendId int64, rem return err } - err = proxy.MessageProxy.PushToUser(ctx, friendId, pb.PushCode_PC_ADD_FRIEND, &pb.AddFriendPush{ + _, err = proxy.PushToUser(ctx, friendId, pb.PushCode_PC_ADD_FRIEND, &pb.AddFriendPush{ FriendId: userId, Nickname: resp.User.Nickname, AvatarUrl: resp.User.AvatarUrl, @@ -96,8 +98,8 @@ func (*friendService) AddFriend(ctx context.Context, userId, friendId int64, rem } // AgreeAddFriend 同意添加好友 -func (*friendService) AgreeAddFriend(ctx context.Context, userId, friendId int64, remarks string) error { - friend, err := FriendRepo.Get(friendId, userId) +func (*service) AgreeAddFriend(ctx context.Context, userId, friendId int64, remarks string) error { + friend, err := Repo.Get(friendId, userId) if err != nil { return err } @@ -108,13 +110,13 @@ func (*friendService) AgreeAddFriend(ctx context.Context, userId, friendId int64 return nil } friend.Status = FriendStatusAgree - err = FriendRepo.Save(friend) + err = Repo.Save(friend) if err != nil { return err } now := time.Now() - err = FriendRepo.Save(&Friend{ + err = Repo.Save(&Friend{ UserId: userId, FriendId: friendId, Remarks: remarks, @@ -131,7 +133,7 @@ func (*friendService) AgreeAddFriend(ctx context.Context, userId, friendId int64 return err } - err = proxy.MessageProxy.PushToUser(ctx, friendId, pb.PushCode_PC_AGREE_ADD_FRIEND, &pb.AgreeAddFriendPush{ + _, err = proxy.PushToUser(ctx, friendId, pb.PushCode_PC_AGREE_ADD_FRIEND, &pb.AgreeAddFriendPush{ FriendId: userId, Nickname: resp.User.Nickname, AvatarUrl: resp.User.AvatarUrl, @@ -143,15 +145,35 @@ func (*friendService) AgreeAddFriend(ctx context.Context, userId, friendId int64 } // SendToFriend 消息发送至好友 -func (*friendService) SendToFriend(ctx context.Context, sender *pb.Sender, req *pb.SendMessageReq) (int64, error) { +func (*service) SendToFriend(ctx context.Context, fromDeviceID, fromUserID int64, req *pb.SendMessageReq) (int64, error) { + sender, err := rpc.GetSender(fromDeviceID, fromUserID) + if err != nil { + return 0, err + } + // 发给发送者 - seq, err := proxy.MessageProxy.SendToUser(ctx, sender, sender.SenderId, req) + push := pb.UserMessagePush{ + Sender: sender, + ReceiverId: req.ReceiverId, + Content: req.Content, + } + bytes, err := proto.Marshal(&push) + if err != nil { + return 0, err + } + + msg := &pb.Message{ + Code: int32(pb.PushCode_PC_USER_MESSAGE), + Content: bytes, + SendTime: req.SendTime, + } + seq, err := proxy.MessageProxy.SendToUser(ctx, fromDeviceID, fromUserID, msg, true) if err != nil { return 0, err } // 发给接收者 - _, err = proxy.MessageProxy.SendToUser(ctx, sender, req.ReceiverId, req) + _, err = proxy.MessageProxy.SendToUser(ctx, fromDeviceID, req.ReceiverId, msg, true) if err != nil { return 0, err } diff --git a/internal/logic/app/group_app.go b/internal/logic/domain/group/app.go similarity index 66% rename from internal/logic/app/group_app.go rename to internal/logic/domain/group/app.go index 30fbb61d..a3f10fdf 100644 --- a/internal/logic/app/group_app.go +++ b/internal/logic/domain/group/app.go @@ -1,19 +1,19 @@ -package app +package group import ( "context" - "gim/internal/logic/domain/group/model" + "gim/internal/logic/domain/group/entity" "gim/internal/logic/domain/group/repo" - "gim/pkg/pb" + "gim/pkg/protocol/pb" ) -type groupApp struct{} +type app struct{} -var GroupApp = new(groupApp) +var App = new(app) // CreateGroup 创建群组 -func (*groupApp) CreateGroup(ctx context.Context, userId int64, in *pb.CreateGroupReq) (int64, error) { - group := model.CreateGroup(userId, in) +func (*app) CreateGroup(ctx context.Context, userId int64, in *pb.CreateGroupReq) (int64, error) { + group := entity.CreateGroup(userId, in) err := repo.GroupRepo.Save(group) if err != nil { return 0, err @@ -22,7 +22,7 @@ func (*groupApp) CreateGroup(ctx context.Context, userId int64, in *pb.CreateGro } // GetGroup 获取群组信息 -func (*groupApp) GetGroup(ctx context.Context, groupId int64) (*pb.Group, error) { +func (*app) GetGroup(ctx context.Context, groupId int64) (*pb.Group, error) { group, err := repo.GroupRepo.Get(groupId) if err != nil { return nil, err @@ -32,7 +32,7 @@ func (*groupApp) GetGroup(ctx context.Context, groupId int64) (*pb.Group, error) } // GetUserGroups 获取用户加入的群组列表 -func (*groupApp) GetUserGroups(ctx context.Context, userId int64) ([]*pb.Group, error) { +func (*app) GetUserGroups(ctx context.Context, userId int64) ([]*pb.Group, error) { groups, err := repo.GroupUserRepo.ListByUserId(userId) if err != nil { return nil, err @@ -46,7 +46,7 @@ func (*groupApp) GetUserGroups(ctx context.Context, userId int64) ([]*pb.Group, } // Update 更新群组 -func (*groupApp) Update(ctx context.Context, userId int64, update *pb.UpdateGroupReq) error { +func (*app) Update(ctx context.Context, userId int64, update *pb.UpdateGroupReq) error { group, err := repo.GroupRepo.Get(update.GroupId) if err != nil { return err @@ -70,7 +70,7 @@ func (*groupApp) Update(ctx context.Context, userId int64, update *pb.UpdateGrou } // AddMembers 添加群组成员 -func (*groupApp) AddMembers(ctx context.Context, userId, groupId int64, userIds []int64) ([]int64, error) { +func (*app) AddMembers(ctx context.Context, userId, groupId int64, userIds []int64) ([]int64, error) { group, err := repo.GroupRepo.Get(groupId) if err != nil { return nil, err @@ -92,7 +92,7 @@ func (*groupApp) AddMembers(ctx context.Context, userId, groupId int64, userIds } // UpdateMember 更新群组用户 -func (*groupApp) UpdateMember(ctx context.Context, in *pb.UpdateGroupMemberReq) error { +func (*app) UpdateMember(ctx context.Context, in *pb.UpdateGroupMemberReq) error { group, err := repo.GroupRepo.Get(in.GroupId) if err != nil { return err @@ -109,7 +109,7 @@ func (*groupApp) UpdateMember(ctx context.Context, in *pb.UpdateGroupMemberReq) } // DeleteMember 删除群组成员 -func (*groupApp) DeleteMember(ctx context.Context, groupId int64, userId int64, optId int64) error { +func (*app) DeleteMember(ctx context.Context, groupId int64, userId int64, optId int64) error { group, err := repo.GroupRepo.Get(groupId) if err != nil { return err @@ -131,7 +131,7 @@ func (*groupApp) DeleteMember(ctx context.Context, groupId int64, userId int64, } // GetMembers 获取群组成员 -func (*groupApp) GetMembers(ctx context.Context, groupId int64) ([]*pb.GroupMember, error) { +func (*app) GetMembers(ctx context.Context, groupId int64) ([]*pb.GroupMember, error) { group, err := repo.GroupRepo.Get(groupId) if err != nil { return nil, err @@ -139,12 +139,12 @@ func (*groupApp) GetMembers(ctx context.Context, groupId int64) ([]*pb.GroupMemb return group.GetMembers(ctx) } -// SendMessage 获取群组成员 -func (*groupApp) SendMessage(ctx context.Context, sender *pb.Sender, req *pb.SendMessageReq) (int64, error) { +// SendMessage 发送群组消息 +func (*app) SendMessage(ctx context.Context, fromDeviceID, fromUserID int64, req *pb.SendMessageReq) (int64, error) { group, err := repo.GroupRepo.Get(req.ReceiverId) if err != nil { return 0, err } - return group.SendMessage(ctx, sender, req) + return group.SendMessage(ctx, fromDeviceID, fromUserID, req) } diff --git a/internal/logic/domain/group/model/group.go b/internal/logic/domain/group/entity/group.go similarity index 84% rename from internal/logic/domain/group/model/group.go rename to internal/logic/domain/group/entity/group.go index 650d8cef..bab574de 100644 --- a/internal/logic/domain/group/model/group.go +++ b/internal/logic/domain/group/entity/group.go @@ -1,4 +1,4 @@ -package model +package entity import ( "context" @@ -6,12 +6,11 @@ import ( "gim/pkg/gerrors" "gim/pkg/grpclib" "gim/pkg/logger" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/rpc" "gim/pkg/util" "time" - "go.uber.org/zap" "google.golang.org/protobuf/proto" ) @@ -127,20 +126,37 @@ func (g *Group) PushUpdate(ctx context.Context, userId int64) error { } // SendMessage 消息发送至群组 -func (g *Group) SendMessage(ctx context.Context, sender *pb.Sender, req *pb.SendMessageReq) (int64, error) { - if sender.SenderType == pb.SenderType_ST_USER && !g.IsMember(sender.SenderId) { - logger.Sugar.Error(ctx, sender.SenderId, req.ReceiverId, "不在群组内") +func (g *Group) SendMessage(ctx context.Context, fromDeviceID, fromUserID int64, req *pb.SendMessageReq) (int64, error) { + if !g.IsMember(fromUserID) { + logger.Sugar.Error(ctx, fromUserID, req.ReceiverId, "不在群组内") return 0, gerrors.ErrNotInGroup } + sender, err := rpc.GetSender(fromDeviceID, fromUserID) + if err != nil { + return 0, err + } + + push := pb.UserMessagePush{ + Sender: sender, + ReceiverId: req.ReceiverId, + Content: req.Content, + } + bytes, err := proto.Marshal(&push) + if err != nil { + return 0, err + } + + msg := &pb.Message{ + Code: int32(pb.PushCode_PC_GROUP_MESSAGE), + Content: bytes, + SendTime: req.SendTime, + } + // 如果发送者是用户,将消息发送给发送者,获取用户seq - var userSeq int64 - var err error - if sender.SenderType == pb.SenderType_ST_USER { - userSeq, err = proxy.MessageProxy.SendToUser(ctx, sender, sender.SenderId, req) - if err != nil { - return 0, err - } + userSeq, err := proxy.MessageProxy.SendToUser(ctx, fromDeviceID, fromUserID, msg, true) + if err != nil { + return 0, err } go func() { @@ -148,10 +164,10 @@ func (g *Group) SendMessage(ctx context.Context, sender *pb.Sender, req *pb.Send // 将消息发送给群组用户,使用写扩散 for _, user := range g.Members { // 前面已经发送过,这里不需要再发送 - if sender.SenderType == pb.SenderType_ST_USER && user.UserId == sender.SenderId { + if user.UserId == sender.UserId { continue } - _, err := proxy.MessageProxy.SendToUser(grpclib.NewAndCopyRequestId(ctx), sender, user.UserId, req) + _, err := proxy.MessageProxy.SendToUser(grpclib.NewAndCopyRequestId(ctx), fromDeviceID, user.UserId, msg, true) if err != nil { return } @@ -172,40 +188,16 @@ func (g *Group) IsMember(userId int64) bool { // PushMessage 向群组推送消息 func (g *Group) PushMessage(ctx context.Context, code pb.PushCode, message proto.Message, isPersist bool) error { - logger.Logger.Debug("push_to_group", - zap.Int64("request_id", grpclib.GetCtxRequestId(ctx)), - zap.Int64("group_id", g.Id), - zap.Int32("code", int32(code)), - zap.Any("message", message)) - - messageBuf, err := proto.Marshal(message) - if err != nil { - return gerrors.WrapError(err) - } - - commandBuf, err := proto.Marshal(&pb.Command{Code: int32(code), Data: messageBuf}) - if err != nil { - return gerrors.WrapError(err) - } - - _, err = g.SendMessage(ctx, - &pb.Sender{ - SenderType: pb.SenderType_ST_SYSTEM, - SenderId: 0, - }, - &pb.SendMessageReq{ - ReceiverType: pb.ReceiverType_RT_GROUP, - ReceiverId: g.Id, - ToUserIds: nil, - MessageType: pb.MessageType_MT_COMMAND, - MessageContent: commandBuf, - SendTime: util.UnixMilliTime(time.Now()), - IsPersist: isPersist, - }, - ) - if err != nil { - return err - } + go func() { + defer util.RecoverPanic() + // 将消息发送给群组用户,使用写扩散 + for _, user := range g.Members { + _, err := proxy.PushToUser(grpclib.NewAndCopyRequestId(ctx), user.UserId, code, message, isPersist) + if err != nil { + return + } + } + }() return nil } diff --git a/internal/logic/domain/group/repo/group_cache.go b/internal/logic/domain/group/repo/group_cache.go index 7911219c..b7547c7a 100644 --- a/internal/logic/domain/group/repo/group_cache.go +++ b/internal/logic/domain/group/repo/group_cache.go @@ -1,7 +1,7 @@ package repo import ( - "gim/internal/logic/domain/group/model" + "gim/internal/logic/domain/group/entity" "gim/pkg/db" "gim/pkg/gerrors" "strconv" @@ -17,8 +17,8 @@ type groupCache struct{} var GroupCache = new(groupCache) // Get 获取群组缓存 -func (c *groupCache) Get(groupId int64) (*model.Group, error) { - var user model.Group +func (c *groupCache) Get(groupId int64) (*entity.Group, error) { + var user entity.Group err := db.RedisUtil.Get(GroupKey+strconv.FormatInt(groupId, 10), &user) if err != nil && err != redis.Nil { return nil, gerrors.WrapError(err) @@ -30,7 +30,7 @@ func (c *groupCache) Get(groupId int64) (*model.Group, error) { } // Set 设置群组缓存 -func (c *groupCache) Set(group *model.Group) error { +func (c *groupCache) Set(group *entity.Group) error { err := db.RedisUtil.Set(GroupKey+strconv.FormatInt(group.Id, 10), group, 24*time.Hour) if err != nil { return gerrors.WrapError(err) diff --git a/internal/logic/domain/group/repo/group_dao.go b/internal/logic/domain/group/repo/group_dao.go index 847688fc..9152108f 100644 --- a/internal/logic/domain/group/repo/group_dao.go +++ b/internal/logic/domain/group/repo/group_dao.go @@ -1,7 +1,7 @@ package repo import ( - "gim/internal/logic/domain/group/model" + "gim/internal/logic/domain/group/entity" "gim/pkg/db" "gim/pkg/gerrors" @@ -13,8 +13,8 @@ type groupDao struct{} var GroupDao = new(groupDao) // Get 获取群组信息 -func (*groupDao) Get(groupId int64) (*model.Group, error) { - var group = model.Group{Id: groupId} +func (*groupDao) Get(groupId int64) (*entity.Group, error) { + var group = entity.Group{Id: groupId} err := db.DB.First(&group).Error if err != nil && err != gorm.ErrRecordNotFound { return nil, gerrors.WrapError(err) @@ -26,7 +26,7 @@ func (*groupDao) Get(groupId int64) (*model.Group, error) { } // Save 插入一条群组 -func (*groupDao) Save(group *model.Group) error { +func (*groupDao) Save(group *entity.Group) error { err := db.DB.Save(&group).Error if err != nil { return gerrors.WrapError(err) diff --git a/internal/logic/domain/group/repo/group_repo.go b/internal/logic/domain/group/repo/group_repo.go index 6433918f..e18ab4c7 100644 --- a/internal/logic/domain/group/repo/group_repo.go +++ b/internal/logic/domain/group/repo/group_repo.go @@ -1,7 +1,7 @@ package repo import ( - "gim/internal/logic/domain/group/model" + "gim/internal/logic/domain/group/entity" ) type groupRepo struct{} @@ -9,7 +9,7 @@ type groupRepo struct{} var GroupRepo = new(groupRepo) // Get 获取群组信息 -func (*groupRepo) Get(groupId int64) (*model.Group, error) { +func (*groupRepo) Get(groupId int64) (*entity.Group, error) { group, err := GroupCache.Get(groupId) if err != nil { return nil, err @@ -36,7 +36,7 @@ func (*groupRepo) Get(groupId int64) (*model.Group, error) { } // Save 获取群组信息 -func (*groupRepo) Save(group *model.Group) error { +func (*groupRepo) Save(group *entity.Group) error { groupId := group.Id err := GroupDao.Save(group) if err != nil { @@ -46,13 +46,13 @@ func (*groupRepo) Save(group *model.Group) error { members := group.Members for i := range members { members[i].GroupId = group.Id - if members[i].UpdateType == model.UpdateTypeUpdate { + if members[i].UpdateType == entity.UpdateTypeUpdate { err = GroupUserRepo.Save(&(members[i])) if err != nil { return err } } - if members[i].UpdateType == model.UpdateTypeDelete { + if members[i].UpdateType == entity.UpdateTypeDelete { err = GroupUserRepo.Delete(group.Id, members[i].UserId) if err != nil { return err diff --git a/internal/logic/domain/group/repo/group_user_repo.go b/internal/logic/domain/group/repo/group_user_repo.go index 1d4a0798..ebd93f9e 100644 --- a/internal/logic/domain/group/repo/group_user_repo.go +++ b/internal/logic/domain/group/repo/group_user_repo.go @@ -1,7 +1,7 @@ package repo import ( - "gim/internal/logic/domain/group/model" + "gim/internal/logic/domain/group/entity" "gim/pkg/db" "gim/pkg/gerrors" @@ -13,8 +13,8 @@ type groupUserRepo struct{} var GroupUserRepo = new(groupUserRepo) // ListByUserId 获取用户加入的群组信息 -func (*groupUserRepo) ListByUserId(userId int64) ([]model.Group, error) { - var groups []model.Group +func (*groupUserRepo) ListByUserId(userId int64) ([]entity.Group, error) { + var groups []entity.Group err := db.DB.Select("g.id,g.name,g.avatar_url,g.introduction,g.user_num,g.extra,g.create_time,g.update_time"). Table("group_user u"). Joins("join `group` g on u.group_id = g.id"). @@ -27,8 +27,8 @@ func (*groupUserRepo) ListByUserId(userId int64) ([]model.Group, error) { } // ListUser 获取群组用户信息 -func (*groupUserRepo) ListUser(groupId int64) ([]model.GroupUser, error) { - var groupUsers []model.GroupUser +func (*groupUserRepo) ListUser(groupId int64) ([]entity.GroupUser, error) { + var groupUsers []entity.GroupUser err := db.DB.Find(&groupUsers, "group_id = ?", groupId).Error if err != nil { return nil, gerrors.WrapError(err) @@ -37,8 +37,8 @@ func (*groupUserRepo) ListUser(groupId int64) ([]model.GroupUser, error) { } // Get 获取群组用户信息,用户不存在返回nil -func (*groupUserRepo) Get(groupId, userId int64) (*model.GroupUser, error) { - var groupUser model.GroupUser +func (*groupUserRepo) Get(groupId, userId int64) (*entity.GroupUser, error) { + var groupUser entity.GroupUser err := db.DB.First(&groupUser, "group_id = ? and user_id = ?", groupId, userId).Error if err != nil && err != gorm.ErrRecordNotFound { return nil, gerrors.WrapError(err) @@ -50,7 +50,7 @@ func (*groupUserRepo) Get(groupId, userId int64) (*model.GroupUser, error) { } // Save 将用户添加到群组 -func (*groupUserRepo) Save(groupUser *model.GroupUser) error { +func (*groupUserRepo) Save(groupUser *entity.GroupUser) error { err := db.DB.Save(&groupUser).Error if err != nil { return gerrors.WrapError(err) diff --git a/internal/logic/domain/message/app.go b/internal/logic/domain/message/app.go new file mode 100644 index 00000000..3e8d63ed --- /dev/null +++ b/internal/logic/domain/message/app.go @@ -0,0 +1,31 @@ +package message + +import ( + "context" + "gim/internal/logic/domain/message/service" + "gim/pkg/protocol/pb" +) + +type app struct{} + +var App = new(app) + +// SendToUser 发送消息给用户 +func (*app) SendToUser(ctx context.Context, fromDeviceID, toUserID int64, message *pb.Message, isPersist bool) (int64, error) { + return service.MessageService.SendToUser(ctx, fromDeviceID, toUserID, message, isPersist) +} + +// PushAll 全服推送 +func (*app) PushAll(ctx context.Context, req *pb.PushAllReq) error { + return service.PushService.PushAll(ctx, req) +} + +// Sync 消息同步 +func (*app) Sync(ctx context.Context, userId, seq int64) (*pb.SyncResp, error) { + return service.MessageService.Sync(ctx, userId, seq) +} + +// MessageAck 收到消息回执 +func (*app) MessageAck(ctx context.Context, userId, deviceId, ack int64) error { + return service.DeviceAckService.Update(ctx, userId, deviceId, ack) +} diff --git a/internal/logic/domain/message/model/message.go b/internal/logic/domain/message/model/message.go index 85be9687..e46a146a 100644 --- a/internal/logic/domain/message/model/message.go +++ b/internal/logic/domain/message/model/message.go @@ -1,76 +1,33 @@ package model import ( - "gim/pkg/logger" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/util" - "strconv" - "strings" "time" ) // Message 消息 type Message struct { - Id int64 // 自增主键 - UserId int64 // 所属类型id - RequestId int64 // 请求id - SenderType int32 // 发送者类型 - SenderId int64 // 发送者账户id - ReceiverType int32 // 接收者账户id - ReceiverId int64 // 接收者id,如果是单聊信息,则为user_id,如果是群组消息,则为group_id - ToUserIds string // 需要@的用户id列表,多个用户用,隔开 - Type int // 消息类型 - Content []byte // 消息内容 - Seq int64 // 消息同步序列 - SendTime time.Time // 消息发送时间 - Status int32 // 创建时间 + Id int64 // 自增主键 + UserId int64 // 所属类型id + RequestId int64 // 请求id + Code int32 // 推送码 + Content []byte // 推送内容 + Seq int64 // 消息同步序列 + SendTime time.Time // 消息发送时间 + Status int32 // 创建时间 } func (m *Message) MessageToPB() *pb.Message { return &pb.Message{ - Sender: &pb.Sender{ - SenderType: pb.SenderType(m.SenderType), - SenderId: m.SenderId, - }, - ReceiverType: pb.ReceiverType(m.ReceiverType), - ReceiverId: m.ReceiverId, - ToUserIds: UnformatUserIds(m.ToUserIds), - MessageType: pb.MessageType(m.Type), - MessageContent: m.Content, - Seq: m.Seq, - SendTime: util.UnixMilliTime(m.SendTime), - Status: pb.MessageStatus(m.Status), + Code: m.Code, + Content: m.Content, + Seq: m.Seq, + SendTime: util.UnixMilliTime(m.SendTime), + Status: pb.MessageStatus(m.Status), } } -func FormatUserIds(userId []int64) string { - build := strings.Builder{} - for i, v := range userId { - build.WriteString(strconv.FormatInt(v, 10)) - if i != len(userId)-1 { - build.WriteString(",") - } - } - return build.String() -} - -func UnformatUserIds(userIdStr string) []int64 { - if userIdStr == "" { - return []int64{} - } - toUserIdStrs := strings.Split(userIdStr, ",") - toUserIds := make([]int64, 0, len(toUserIdStrs)) - for i := range toUserIdStrs { - userId, err := strconv.ParseInt(toUserIdStrs[i], 10, 64) - if err != nil { - logger.Sugar.Error(err) - continue - } - toUserIds = append(toUserIds, userId) - } - return toUserIds -} - func MessagesToPB(messages []Message) []*pb.Message { pbMessages := make([]*pb.Message, 0, len(messages)) for i := range messages { diff --git a/internal/logic/domain/message/model/sender.go b/internal/logic/domain/message/model/sender.go index e729f5bf..52cd4f76 100644 --- a/internal/logic/domain/message/model/sender.go +++ b/internal/logic/domain/message/model/sender.go @@ -1,12 +1,9 @@ package model -import "gim/pkg/pb" - type Sender struct { - SenderType pb.SenderType // 发送者类型,1:系统,2:用户,3:业务方 - SenderId int64 // 发送者id - DeviceId int64 // 发送者设备id - Nickname string // 昵称 - AvatarUrl string // 头像 - Extra string // 扩展字段 + UserId int64 // 发送者id + DeviceId int64 // 发送者设备id + Nickname string // 昵称 + AvatarUrl string // 头像 + Extra string // 扩展字段 } diff --git a/internal/logic/domain/message/repo/message_repo.go b/internal/logic/domain/message/repo/message_repo.go index 010bf6c0..04b1e532 100644 --- a/internal/logic/domain/message/repo/message_repo.go +++ b/internal/logic/domain/message/repo/message_repo.go @@ -14,7 +14,7 @@ type messageRepo struct{} var MessageRepo = new(messageRepo) func (*messageRepo) tableName(userId int64) string { - return fmt.Sprintf("message_%03d", userId%messageTableNum) + return fmt.Sprintf("message") } // Save 插入一条消息 diff --git a/internal/logic/domain/message/repo/message_repo_test.go b/internal/logic/domain/message/repo/message_repo_test.go index 9d507b23..8c003502 100644 --- a/internal/logic/domain/message/repo/message_repo_test.go +++ b/internal/logic/domain/message/repo/message_repo_test.go @@ -9,20 +9,15 @@ import ( func TestMessageDao_Add(t *testing.T) { message := model.Message{ - UserId: 1, - RequestId: 1, - SenderType: 1, - SenderId: 1, - ReceiverType: 1, - ReceiverId: 1, - ToUserIds: "1", - Type: 1, - Content: []byte("123456"), - Seq: 2, - SendTime: time.Now(), - Status: 0, + UserId: 1, + RequestId: 1, + Code: 1, + Content: []byte("123456"), + Seq: 2, + SendTime: time.Now(), + Status: 0, } - fmt.Println(MessageRepo.Save(message)) + t.Log(MessageRepo.Save(message)) } func TestMessageDao_ListByUserIdAndUserSeq(t *testing.T) { @@ -30,7 +25,7 @@ func TestMessageDao_ListByUserIdAndUserSeq(t *testing.T) { fmt.Println(err) fmt.Println(hasMore) for i := range messages { - fmt.Printf("%+v\n", messages[i]) + t.Logf("%+v\n", messages[i]) } } diff --git a/internal/logic/domain/message/service/device_ack_test.go b/internal/logic/domain/message/service/device_ack_test.go index 51f52b31..3f23eaf8 100644 --- a/internal/logic/domain/message/service/device_ack_test.go +++ b/internal/logic/domain/message/service/device_ack_test.go @@ -3,14 +3,9 @@ package service import ( "context" "fmt" - "gim/pkg/db" "testing" ) -func init() { - db.InitByTest() -} - func Test_deviceAckService_GetMaxByUserId(t *testing.T) { fmt.Println(DeviceAckService.Update(context.TODO(), 1, 2, 2)) } diff --git a/internal/logic/domain/message/service/message_service.go b/internal/logic/domain/message/service/message_service.go index d4d01651..67584d82 100644 --- a/internal/logic/domain/message/service/message_service.go +++ b/internal/logic/domain/message/service/message_service.go @@ -8,7 +8,7 @@ import ( "gim/pkg/grpclib" "gim/pkg/grpclib/picker" "gim/pkg/logger" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/rpc" "gim/pkg/util" @@ -49,29 +49,6 @@ func (*messageService) Sync(ctx context.Context, userId, seq int64) (*pb.SyncRes } } - var userIds = make(map[int64]int32, len(resp.Messages)) - for i := range resp.Messages { - if resp.Messages[i].Sender.SenderType == pb.SenderType_ST_USER { - userIds[resp.Messages[i].Sender.SenderId] = 0 - } - } - usersResp, err := rpc.GetBusinessIntClient().GetUsers(ctx, &pb.GetUsersReq{UserIds: userIds}) - if err != nil { - return nil, err - } - for i := range resp.Messages { - if resp.Messages[i].Sender.SenderType == pb.SenderType_ST_USER { - user, ok := usersResp.Users[resp.Messages[i].Sender.SenderId] - if ok { - resp.Messages[i].Sender.Nickname = user.Nickname - resp.Messages[i].Sender.AvatarUrl = user.AvatarUrl - resp.Messages[i].Sender.Extra = user.Extra - } else { - logger.Logger.Warn("get user failed", zap.Int64("user_id", resp.Messages[i].Sender.SenderId)) - } - } - } - return resp, nil } @@ -88,64 +65,40 @@ func (*messageService) ListByUserIdAndSeq(ctx context.Context, userId, seq int64 } // SendToUser 将消息发送给用户 -func (*messageService) SendToUser(ctx context.Context, sender *pb.Sender, toUserId int64, req *pb.SendMessageReq) (int64, error) { +func (*messageService) SendToUser(ctx context.Context, fromDeviceID, toUserID int64, message *pb.Message, isPersist bool) (int64, error) { logger.Logger.Debug("SendToUser", zap.Int64("request_id", grpclib.GetCtxRequestId(ctx)), - zap.Int64("to_user_id", toUserId)) + zap.Int64("to_user_id", toUserID)) var ( seq int64 = 0 err error ) - if req.IsPersist { - seq, err = SeqService.GetUserNext(ctx, toUserId) + if isPersist { + seq, err = SeqService.GetUserNext(ctx, toUserID) if err != nil { return 0, err } + message.Seq = seq selfMessage := model.Message{ - UserId: toUserId, - RequestId: grpclib.GetCtxRequestId(ctx), - SenderType: int32(sender.SenderType), - SenderId: sender.SenderId, - ReceiverType: int32(req.ReceiverType), - ReceiverId: req.ReceiverId, - ToUserIds: model.FormatUserIds(req.ToUserIds), - Type: int(req.MessageType), - Content: req.MessageContent, - Seq: seq, - SendTime: util.UnunixMilliTime(req.SendTime), - Status: int32(pb.MessageStatus_MS_NORMAL), + UserId: toUserID, + RequestId: grpclib.GetCtxRequestId(ctx), + Code: message.Code, + Content: message.Content, + Seq: seq, + SendTime: util.UnunixMilliTime(message.SendTime), + Status: int32(pb.MessageStatus_MS_NORMAL), } err = repo.MessageRepo.Save(selfMessage) if err != nil { logger.Sugar.Error(err) return 0, err } - - if sender.SenderType == pb.SenderType_ST_USER && sender.SenderId == toUserId { - // 用户需要增加自己的已经同步的序列号 - err = repo.DeviceACKRepo.Set(sender.SenderId, sender.DeviceId, seq) - if err != nil { - return 0, err - } - } - } - - message := pb.Message{ - Sender: sender, - ReceiverType: req.ReceiverType, - ReceiverId: req.ReceiverId, - ToUserIds: req.ToUserIds, - MessageType: req.MessageType, - MessageContent: req.MessageContent, - Seq: seq, - SendTime: req.SendTime, - Status: pb.MessageStatus_MS_NORMAL, } // 查询用户在线设备 - devices, err := proxy.DeviceProxy.ListOnlineByUserId(ctx, toUserId) + devices, err := proxy.DeviceProxy.ListOnlineByUserId(ctx, toUserID) if err != nil { logger.Sugar.Error(err) return 0, err @@ -153,25 +106,23 @@ func (*messageService) SendToUser(ctx context.Context, sender *pb.Sender, toUser for i := range devices { // 消息不需要投递给发送消息的设备 - if sender.DeviceId == devices[i].DeviceId { + if fromDeviceID == devices[i].DeviceId { continue } - err = MessageService.SendToDevice(ctx, devices[i], &message) + err = MessageService.SendToDevice(ctx, devices[i], message) if err != nil { logger.Sugar.Error(err, zap.Any("SendToUser error", devices[i]), zap.Error(err)) } } - return seq, nil } // SendToDevice 将消息发送给设备 func (*messageService) SendToDevice(ctx context.Context, device *pb.Device, message *pb.Message) error { - messageSend := pb.MessageSend{Message: message} _, err := rpc.GetConnectIntClient().DeliverMessage(picker.ContextWithAddr(ctx, device.ConnAddr), &pb.DeliverMessageReq{ - DeviceId: device.DeviceId, - MessageSend: &messageSend, + DeviceId: device.DeviceId, + Message: message, }) if err != nil { logger.Logger.Error("SendToDevice error", zap.Error(err)) @@ -183,12 +134,10 @@ func (*messageService) SendToDevice(ctx context.Context, device *pb.Device, mess } func (*messageService) AddSenderInfo(sender *pb.Sender) { - if sender.SenderType == pb.SenderType_ST_USER { - user, err := rpc.GetBusinessIntClient().GetUser(context.TODO(), &pb.GetUserReq{UserId: sender.SenderId}) - if err == nil && user != nil { - sender.AvatarUrl = user.User.AvatarUrl - sender.Nickname = user.User.Nickname - sender.Extra = user.User.Extra - } + user, err := rpc.GetBusinessIntClient().GetUser(context.TODO(), &pb.GetUserReq{UserId: sender.UserId}) + if err == nil && user != nil { + sender.AvatarUrl = user.User.AvatarUrl + sender.Nickname = user.User.Nickname + sender.Extra = user.User.Extra } } diff --git a/internal/logic/domain/message/service/push.go b/internal/logic/domain/message/service/push.go index 0cd9e5cd..ed09842c 100644 --- a/internal/logic/domain/message/service/push.go +++ b/internal/logic/domain/message/service/push.go @@ -3,14 +3,11 @@ package service import ( "context" "gim/pkg/gerrors" - "gim/pkg/grpclib" - "gim/pkg/logger" "gim/pkg/mq" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/util" "time" - "go.uber.org/zap" "google.golang.org/protobuf/proto" ) @@ -18,60 +15,13 @@ type pushService struct{} var PushService = new(pushService) -// PushToUser 向用户推送消息 -func (s *pushService) PushToUser(ctx context.Context, userId int64, code pb.PushCode, message proto.Message, isPersist bool) error { - logger.Logger.Debug("push_to_user", - zap.Int64("request_id", grpclib.GetCtxRequestId(ctx)), - zap.Int64("user_id", userId), - zap.Int32("code", int32(code)), - zap.Any("message", message)) - - messageBuf, err := proto.Marshal(message) - if err != nil { - return gerrors.WrapError(err) - } - - commandBuf, err := proto.Marshal(&pb.Command{Code: int32(code), Data: messageBuf}) - if err != nil { - return gerrors.WrapError(err) - } - - _, err = MessageService.SendToUser(ctx, - &pb.Sender{ - SenderType: pb.SenderType_ST_SYSTEM, - SenderId: 0, - }, - userId, - &pb.SendMessageReq{ - ReceiverType: pb.ReceiverType_RT_USER, - ReceiverId: userId, - ToUserIds: nil, - MessageType: pb.MessageType_MT_COMMAND, - MessageContent: commandBuf, - SendTime: util.UnixMilliTime(time.Now()), - IsPersist: isPersist, - }, - ) - if err != nil { - return err - } - return nil -} - // PushAll 全服推送 func (s *pushService) PushAll(ctx context.Context, req *pb.PushAllReq) error { msg := pb.PushAllMsg{ - MessageSend: &pb.MessageSend{ - Message: &pb.Message{ - Sender: &pb.Sender{SenderType: pb.SenderType_ST_BUSINESS}, - ReceiverType: pb.ReceiverType_RT_ROOM, - ToUserIds: nil, - MessageType: req.MessageType, - MessageContent: req.MessageContent, - Seq: 0, - SendTime: util.UnixMilliTime(time.Now()), - Status: 0, - }, + Message: &pb.Message{ + Code: req.Code, + Content: req.Content, + SendTime: util.UnixMilliTime(time.Now()), }, } bytes, err := proto.Marshal(&msg) diff --git a/internal/logic/domain/room/app.go b/internal/logic/domain/room/app.go new file mode 100644 index 00000000..39d567ea --- /dev/null +++ b/internal/logic/domain/room/app.go @@ -0,0 +1,20 @@ +package room + +import ( + "context" + "gim/pkg/protocol/pb" +) + +type app struct{} + +var App = new(app) + +// Push 推送房间消息 +func (s *app) Push(ctx context.Context, req *pb.PushRoomReq) error { + return Service.Push(ctx, req) +} + +// SubscribeRoom 订阅房间 +func (s *app) SubscribeRoom(ctx context.Context, req *pb.SubscribeRoomReq) error { + return Service.SubscribeRoom(ctx, req) +} diff --git a/internal/logic/domain/room/room_message_repo.go b/internal/logic/domain/room/message_repo.go similarity index 68% rename from internal/logic/domain/room/room_message_repo.go rename to internal/logic/domain/room/message_repo.go index d240831d..822a8c0a 100644 --- a/internal/logic/domain/room/room_message_repo.go +++ b/internal/logic/domain/room/message_repo.go @@ -4,7 +4,7 @@ import ( "fmt" "gim/pkg/db" "gim/pkg/gerrors" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/util" "strconv" "time" @@ -13,17 +13,17 @@ import ( "google.golang.org/protobuf/proto" ) -const RoomMessageKey = "room_message:%d" +const MessageKey = "room_message:%d" -const RoomMessageExpireTime = 2 * time.Minute +const MessageExpireTime = 2 * time.Minute -type roomMessageRepo struct{} +type messageRepo struct{} -var RoomMessageRepo = new(roomMessageRepo) +var MessageRepo = new(messageRepo) // Add 将消息添加到队列 -func (*roomMessageRepo) Add(roomId int64, msg *pb.Message) error { - key := fmt.Sprintf(RoomMessageKey, roomId) +func (*messageRepo) Add(roomId int64, msg *pb.Message) error { + key := fmt.Sprintf(MessageKey, roomId) buf, err := proto.Marshal(msg) if err != nil { return gerrors.WrapError(err) @@ -33,7 +33,7 @@ func (*roomMessageRepo) Add(roomId int64, msg *pb.Message) error { Member: buf, }).Result() - db.RedisCli.Expire(key, RoomMessageExpireTime) + db.RedisCli.Expire(key, MessageExpireTime) if err != nil { return gerrors.WrapError(err) } @@ -41,8 +41,8 @@ func (*roomMessageRepo) Add(roomId int64, msg *pb.Message) error { } // List 获取指定房间序列号大于seq的消息 -func (*roomMessageRepo) List(roomId int64, seq int64) ([]*pb.Message, error) { - key := fmt.Sprintf(RoomMessageKey, roomId) +func (*messageRepo) List(roomId int64, seq int64) ([]*pb.Message, error) { + key := fmt.Sprintf(MessageKey, roomId) result, err := db.RedisCli.ZRangeByScore(key, redis.ZRangeBy{ Min: strconv.FormatInt(seq, 10), Max: "+inf", @@ -64,8 +64,8 @@ func (*roomMessageRepo) List(roomId int64, seq int64) ([]*pb.Message, error) { return msgs, nil } -func (*roomMessageRepo) ListByIndex(roomId int64, start, stop int64) ([]*pb.Message, error) { - key := fmt.Sprintf(RoomMessageKey, roomId) +func (*messageRepo) ListByIndex(roomId int64, start, stop int64) ([]*pb.Message, error) { + key := fmt.Sprintf(MessageKey, roomId) result, err := db.RedisCli.ZRange(key, start, stop).Result() if err != nil { return nil, gerrors.WrapError(err) @@ -84,11 +84,11 @@ func (*roomMessageRepo) ListByIndex(roomId int64, start, stop int64) ([]*pb.Mess return msgs, nil } -func (*roomMessageRepo) DelBySeq(roomId int64, min, max int64) error { +func (*messageRepo) DelBySeq(roomId int64, min, max int64) error { if min == 0 && max == 0 { return nil } - key := fmt.Sprintf(RoomMessageKey, roomId) + key := fmt.Sprintf(MessageKey, roomId) _, err := db.RedisCli.ZRemRangeByScore(key, strconv.FormatInt(min, 10), strconv.FormatInt(max, 10)).Result() return gerrors.WrapError(err) } diff --git a/internal/logic/domain/room/room_seq_repo.go b/internal/logic/domain/room/room_seq_repo.go deleted file mode 100644 index 909af4c2..00000000 --- a/internal/logic/domain/room/room_seq_repo.go +++ /dev/null @@ -1,21 +0,0 @@ -package room - -import ( - "fmt" - "gim/pkg/db" - "gim/pkg/gerrors" -) - -const RoomSeqKey = "room_seq:%d" - -type roomSeqRepo struct{} - -var RoomSeqRepo = new(roomSeqRepo) - -func (*roomSeqRepo) GetNextSeq(roomId int64) (int64, error) { - num, err := db.RedisCli.Incr(fmt.Sprintf(RoomSeqKey, roomId)).Result() - if err != nil { - return 0, gerrors.WrapError(err) - } - return num, err -} diff --git a/internal/logic/domain/room/room_service.go b/internal/logic/domain/room/room_service.go deleted file mode 100644 index 63e26897..00000000 --- a/internal/logic/domain/room/room_service.go +++ /dev/null @@ -1,148 +0,0 @@ -package room - -import ( - "context" - "gim/pkg/gerrors" - "gim/pkg/grpclib/picker" - "gim/pkg/logger" - "gim/pkg/mq" - "gim/pkg/pb" - "gim/pkg/rpc" - "gim/pkg/util" - "time" - - "google.golang.org/protobuf/proto" -) - -type roomService struct{} - -var RoomService = new(roomService) - -func (s *roomService) Push(ctx context.Context, sender *pb.Sender, req *pb.PushRoomReq) error { - s.AddSenderInfo(sender) - - seq, err := RoomSeqRepo.GetNextSeq(req.RoomId) - if err != nil { - return err - } - - msg := &pb.Message{ - Sender: sender, - ReceiverType: pb.ReceiverType_RT_ROOM, - ReceiverId: req.RoomId, - ToUserIds: nil, - MessageType: req.MessageType, - MessageContent: req.MessageContent, - Seq: seq, - SendTime: util.UnixMilliTime(time.Now()), - Status: 0, - } - - if req.IsPersist { - err = s.AddMessage(req.RoomId, msg) - if err != nil { - return err - } - } - - pushRoomMsg := pb.PushRoomMsg{ - RoomId: req.RoomId, - MessageSend: &pb.MessageSend{ - Message: msg, - }, - } - bytes, err := proto.Marshal(&pushRoomMsg) - if err != nil { - return gerrors.WrapError(err) - } - var topicName = mq.PushRoomTopic - if req.IsPriority { - topicName = mq.PushRoomPriorityTopic - } - err = mq.Publish(topicName, bytes) - if err != nil { - return err - } - return nil -} - -func (s *roomService) AddMessage(roomId int64, msg *pb.Message) error { - err := RoomMessageRepo.Add(roomId, msg) - if err != nil { - return err - } - return s.DelExpireMessage(roomId) -} - -// DelExpireMessage 删除过期消息 -func (s *roomService) DelExpireMessage(roomId int64) error { - var ( - index int64 = 0 - stop bool - min int64 - max int64 - ) - - for { - msgs, err := RoomMessageRepo.ListByIndex(roomId, index, index+20) - if err != nil { - return err - } - if len(msgs) == 0 { - break - } - - for _, v := range msgs { - if v.SendTime > util.UnixMilliTime(time.Now().Add(-RoomMessageExpireTime)) { - stop = true - break - } - - if min == 0 { - min = v.Seq - } - max = v.Seq - } - if stop { - break - } - } - - return RoomMessageRepo.DelBySeq(roomId, min, max) -} - -// SubscribeRoom 订阅房间 -func (s *roomService) SubscribeRoom(ctx context.Context, req *pb.SubscribeRoomReq) error { - if req.Seq == 0 { - return nil - } - - messages, err := RoomMessageRepo.List(req.RoomId, req.Seq) - if err != nil { - return err - } - - for i := range messages { - _, err := rpc.GetConnectIntClient().DeliverMessage(picker.ContextWithAddr(ctx, req.ConnAddr), &pb.DeliverMessageReq{ - DeviceId: req.DeviceId, - MessageSend: &pb.MessageSend{ - Message: messages[i], - }, - }) - if err != nil { - logger.Sugar.Error(err) - } - } - return nil -} - -func (*roomService) AddSenderInfo(sender *pb.Sender) { - if sender.SenderType == pb.SenderType_ST_USER { - user, err := rpc.GetBusinessIntClient().GetUser(context.TODO(), &pb.GetUserReq{UserId: sender.SenderId}) - if err == nil && user != nil { - sender.AvatarUrl = user.User.AvatarUrl - sender.Nickname = user.User.Nickname - sender.Extra = user.User.Extra - } - } -} diff --git a/internal/logic/domain/room/seq_repo.go b/internal/logic/domain/room/seq_repo.go new file mode 100644 index 00000000..bbb2a8fc --- /dev/null +++ b/internal/logic/domain/room/seq_repo.go @@ -0,0 +1,21 @@ +package room + +import ( + "fmt" + "gim/pkg/db" + "gim/pkg/gerrors" +) + +const SeqKey = "room_seq:%d" + +type seqRepo struct{} + +var SeqRepo = new(seqRepo) + +func (*seqRepo) GetNextSeq(roomId int64) (int64, error) { + num, err := db.RedisCli.Incr(fmt.Sprintf(SeqKey, roomId)).Result() + if err != nil { + return 0, gerrors.WrapError(err) + } + return num, err +} diff --git a/internal/logic/domain/room/service.go b/internal/logic/domain/room/service.go new file mode 100644 index 00000000..29050caf --- /dev/null +++ b/internal/logic/domain/room/service.go @@ -0,0 +1,125 @@ +package room + +import ( + "context" + "gim/pkg/gerrors" + "gim/pkg/grpclib/picker" + "gim/pkg/logger" + "gim/pkg/mq" + "gim/pkg/protocol/pb" + "gim/pkg/rpc" + "gim/pkg/util" + "time" + + "google.golang.org/protobuf/proto" +) + +type service struct{} + +var Service = new(service) + +func (s *service) Push(ctx context.Context, req *pb.PushRoomReq) error { + seq, err := SeqRepo.GetNextSeq(req.RoomId) + if err != nil { + return err + } + + msg := &pb.Message{ + Code: req.Code, + Content: req.Content, + Seq: seq, + SendTime: util.UnixMilliTime(time.Now()), + } + if req.IsPersist { + err = s.AddMessage(req.RoomId, msg) + if err != nil { + return err + } + } + + pushRoomMsg := pb.PushRoomMsg{ + RoomId: req.RoomId, + Message: msg, + } + bytes, err := proto.Marshal(&pushRoomMsg) + if err != nil { + return gerrors.WrapError(err) + } + var topicName = mq.PushRoomTopic + if req.IsPriority { + topicName = mq.PushRoomPriorityTopic + } + err = mq.Publish(topicName, bytes) + if err != nil { + return err + } + return nil +} + +func (s *service) AddMessage(roomId int64, msg *pb.Message) error { + err := MessageRepo.Add(roomId, msg) + if err != nil { + return err + } + return s.DelExpireMessage(roomId) +} + +// DelExpireMessage 删除过期消息 +func (s *service) DelExpireMessage(roomId int64) error { + var ( + index int64 = 0 + stop bool + min int64 + max int64 + ) + + for { + msgs, err := MessageRepo.ListByIndex(roomId, index, index+20) + if err != nil { + return err + } + if len(msgs) == 0 { + break + } + + for _, v := range msgs { + if v.SendTime > util.UnixMilliTime(time.Now().Add(-MessageExpireTime)) { + stop = true + break + } + + if min == 0 { + min = v.Seq + } + max = v.Seq + } + if stop { + break + } + } + + return MessageRepo.DelBySeq(roomId, min, max) +} + +// SubscribeRoom 订阅房间 +func (s *service) SubscribeRoom(ctx context.Context, req *pb.SubscribeRoomReq) error { + if req.Seq == 0 { + return nil + } + + messages, err := MessageRepo.List(req.RoomId, req.Seq) + if err != nil { + return err + } + + for i := range messages { + _, err := rpc.GetConnectIntClient().DeliverMessage(picker.ContextWithAddr(ctx, req.ConnAddr), &pb.DeliverMessageReq{ + DeviceId: req.DeviceId, + Message: messages[i], + }) + if err != nil { + logger.Sugar.Error(err) + } + } + return nil +} diff --git a/internal/logic/domain/room/room_service_test.go b/internal/logic/domain/room/service_test.go similarity index 96% rename from internal/logic/domain/room/room_service_test.go rename to internal/logic/domain/room/service_test.go index c6446e0e..6a69d27a 100644 --- a/internal/logic/domain/room/room_service_test.go +++ b/internal/logic/domain/room/service_test.go @@ -2,7 +2,7 @@ package room import ( "fmt" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/util" "testing" "time" diff --git a/internal/logic/proxy/device_proxy.go b/internal/logic/proxy/device_proxy.go index 8ff372a6..bd944eca 100644 --- a/internal/logic/proxy/device_proxy.go +++ b/internal/logic/proxy/device_proxy.go @@ -2,7 +2,7 @@ package proxy import ( "context" - "gim/pkg/pb" + "gim/pkg/protocol/pb" ) type deviceProxy interface { diff --git a/internal/logic/proxy/message_proxy.go b/internal/logic/proxy/message_proxy.go index a2e80448..6aea324b 100644 --- a/internal/logic/proxy/message_proxy.go +++ b/internal/logic/proxy/message_proxy.go @@ -2,7 +2,12 @@ package proxy import ( "context" - "gim/pkg/pb" + "gim/pkg/logger" + "gim/pkg/protocol/pb" + "gim/pkg/util" + "time" + + "go.uber.org/zap" "google.golang.org/protobuf/proto" ) @@ -10,6 +15,28 @@ import ( var MessageProxy messageProxy type messageProxy interface { - SendToUser(ctx context.Context, sender *pb.Sender, toUserId int64, req *pb.SendMessageReq) (int64, error) - PushToUser(ctx context.Context, userId int64, code pb.PushCode, message proto.Message, isPersist bool) error + SendToUser(ctx context.Context, fromDeviceID, toUserID int64, message *pb.Message, isPersist bool) (int64, error) +} + +func PushToUserBytes(ctx context.Context, toUserID int64, code int32, bytes []byte, isPersist bool) (int64, error) { + message := pb.Message{ + Code: code, + Content: bytes, + SendTime: util.UnixMilliTime(time.Now()), + } + seq, err := MessageProxy.SendToUser(ctx, 0, toUserID, &message, isPersist) + if err != nil { + logger.Logger.Error("PushToUser", zap.Error(err)) + return 0, err + } + return seq, nil +} + +func PushToUser(ctx context.Context, toUserID int64, code pb.PushCode, msg proto.Message, isPersist bool) (int64, error) { + bytes, err := proto.Marshal(msg) + if err != nil { + logger.Logger.Error("PushToUser", zap.Error(err)) + return 0, err + } + return PushToUserBytes(ctx, toUserID, int32(code), bytes, isPersist) } diff --git a/pkg/db/db.go b/pkg/db/db.go index 5b776e8f..c761fb4d 100644 --- a/pkg/db/db.go +++ b/pkg/db/db.go @@ -18,9 +18,9 @@ var ( RedisUtil *util.RedisUtil ) -func Init() { - InitMysql(config.MySQL) - InitRedis(config.RedisIP, config.RedisPassword) +func init() { + InitMysql(config.Config.MySQL) + InitRedis(config.Config.RedisHost, config.Config.RedisPassword) } // InitMysql 初始化MySQL @@ -58,7 +58,6 @@ func InitRedis(addr, password string) { func InitByTest() { fmt.Println("init db") logger.Target = logger.Console - - InitMysql(config.MySQL) - InitRedis(config.RedisIP, config.RedisPassword) + //InitMysql(config.MySQL) + //InitRedis(config.RedisIP, config.RedisPassword) } diff --git a/pkg/grpclib/resolver/addrs/addrs_resolver.go b/pkg/grpclib/resolver/addrs/addrs_resolver.go index aee64c55..403de99b 100644 --- a/pkg/grpclib/resolver/addrs/addrs_resolver.go +++ b/pkg/grpclib/resolver/addrs/addrs_resolver.go @@ -15,8 +15,7 @@ func RegisterResolver() { resolver.Register(NewAddrsBuilder()) } -type addrsBuilder struct { -} +type addrsBuilder struct{} func NewAddrsBuilder() resolver.Builder { return &addrsBuilder{} @@ -51,8 +50,7 @@ func (r *addrsResolver) ResolveNow(opt resolver.ResolveNowOptions) { r.clientConn.UpdateState(state) } -func (r *addrsResolver) Close() { -} +func (r *addrsResolver) Close() {} func getAddrs(ips []string) []resolver.Address { addresses := make([]resolver.Address, len(ips)) diff --git a/pkg/interceptor/interceptor.go b/pkg/interceptor/interceptor.go index 152415ee..1c25f11d 100644 --- a/pkg/interceptor/interceptor.go +++ b/pkg/interceptor/interceptor.go @@ -5,7 +5,7 @@ import ( "gim/pkg/gerrors" "gim/pkg/grpclib" "gim/pkg/logger" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/rpc" "strings" diff --git a/pkg/pb/business.int.pb.go b/pkg/pb/business.int.pb.go deleted file mode 100644 index 862945be..00000000 --- a/pkg/pb/business.int.pb.go +++ /dev/null @@ -1,488 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.14.0 -// source: business.int.proto - -package pb - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type AuthReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` - DeviceId int64 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` - Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` -} - -func (x *AuthReq) Reset() { - *x = AuthReq{} - if protoimpl.UnsafeEnabled { - mi := &file_business_int_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthReq) ProtoMessage() {} - -func (x *AuthReq) ProtoReflect() protoreflect.Message { - mi := &file_business_int_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 AuthReq.ProtoReflect.Descriptor instead. -func (*AuthReq) Descriptor() ([]byte, []int) { - return file_business_int_proto_rawDescGZIP(), []int{0} -} - -func (x *AuthReq) GetUserId() int64 { - if x != nil { - return x.UserId - } - return 0 -} - -func (x *AuthReq) GetDeviceId() int64 { - if x != nil { - return x.DeviceId - } - return 0 -} - -func (x *AuthReq) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -type GetUsersReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserIds map[int64]int32 `protobuf:"bytes,1,rep,name=user_ids,json=userIds,proto3" json:"user_ids,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 用户id -} - -func (x *GetUsersReq) Reset() { - *x = GetUsersReq{} - if protoimpl.UnsafeEnabled { - mi := &file_business_int_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetUsersReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUsersReq) ProtoMessage() {} - -func (x *GetUsersReq) ProtoReflect() protoreflect.Message { - mi := &file_business_int_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 GetUsersReq.ProtoReflect.Descriptor instead. -func (*GetUsersReq) Descriptor() ([]byte, []int) { - return file_business_int_proto_rawDescGZIP(), []int{1} -} - -func (x *GetUsersReq) GetUserIds() map[int64]int32 { - if x != nil { - return x.UserIds - } - return nil -} - -type GetUsersResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Users map[int64]*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // 用户信息 -} - -func (x *GetUsersResp) Reset() { - *x = GetUsersResp{} - if protoimpl.UnsafeEnabled { - mi := &file_business_int_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetUsersResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUsersResp) ProtoMessage() {} - -func (x *GetUsersResp) ProtoReflect() protoreflect.Message { - mi := &file_business_int_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 GetUsersResp.ProtoReflect.Descriptor instead. -func (*GetUsersResp) Descriptor() ([]byte, []int) { - return file_business_int_proto_rawDescGZIP(), []int{2} -} - -func (x *GetUsersResp) GetUsers() map[int64]*User { - if x != nil { - return x.Users - } - return nil -} - -var File_business_int_proto protoreflect.FileDescriptor - -var file_business_int_proto_rawDesc = []byte{ - 0x0a, 0x12, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, - 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x62, 0x75, 0x73, 0x69, - 0x6e, 0x65, 0x73, 0x73, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x55, - 0x0a, 0x07, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, - 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, - 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x82, 0x01, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, - 0x72, 0x73, 0x52, 0x65, 0x71, 0x12, 0x37, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, - 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x1a, 0x3a, - 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x85, 0x01, 0x0a, 0x0c, 0x47, - 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x31, 0x0a, 0x05, 0x75, - 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x62, 0x2e, - 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x55, 0x73, 0x65, - 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x1a, 0x42, - 0x0a, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1e, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, - 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x32, 0x88, 0x01, 0x0a, 0x0b, 0x42, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x49, - 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x0b, 0x2e, 0x70, 0x62, 0x2e, - 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x12, 0x2a, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x2e, - 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, - 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, - 0x0a, 0x08, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x0f, 0x2e, 0x70, 0x62, 0x2e, - 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x70, 0x62, - 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x42, 0x0d, 0x5a, - 0x0b, 0x67, 0x69, 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_business_int_proto_rawDescOnce sync.Once - file_business_int_proto_rawDescData = file_business_int_proto_rawDesc -) - -func file_business_int_proto_rawDescGZIP() []byte { - file_business_int_proto_rawDescOnce.Do(func() { - file_business_int_proto_rawDescData = protoimpl.X.CompressGZIP(file_business_int_proto_rawDescData) - }) - return file_business_int_proto_rawDescData -} - -var file_business_int_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_business_int_proto_goTypes = []interface{}{ - (*AuthReq)(nil), // 0: pb.AuthReq - (*GetUsersReq)(nil), // 1: pb.GetUsersReq - (*GetUsersResp)(nil), // 2: pb.GetUsersResp - nil, // 3: pb.GetUsersReq.UserIdsEntry - nil, // 4: pb.GetUsersResp.UsersEntry - (*User)(nil), // 5: pb.User - (*GetUserReq)(nil), // 6: pb.GetUserReq - (*Empty)(nil), // 7: pb.Empty - (*GetUserResp)(nil), // 8: pb.GetUserResp -} -var file_business_int_proto_depIdxs = []int32{ - 3, // 0: pb.GetUsersReq.user_ids:type_name -> pb.GetUsersReq.UserIdsEntry - 4, // 1: pb.GetUsersResp.users:type_name -> pb.GetUsersResp.UsersEntry - 5, // 2: pb.GetUsersResp.UsersEntry.value:type_name -> pb.User - 0, // 3: pb.BusinessInt.Auth:input_type -> pb.AuthReq - 6, // 4: pb.BusinessInt.GetUser:input_type -> pb.GetUserReq - 1, // 5: pb.BusinessInt.GetUsers:input_type -> pb.GetUsersReq - 7, // 6: pb.BusinessInt.Auth:output_type -> pb.Empty - 8, // 7: pb.BusinessInt.GetUser:output_type -> pb.GetUserResp - 2, // 8: pb.BusinessInt.GetUsers:output_type -> pb.GetUsersResp - 6, // [6:9] is the sub-list for method output_type - 3, // [3:6] 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_business_int_proto_init() } -func file_business_int_proto_init() { - if File_business_int_proto != nil { - return - } - file_common_ext_proto_init() - file_business_ext_proto_init() - if !protoimpl.UnsafeEnabled { - file_business_int_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_business_int_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetUsersReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_business_int_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetUsersResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_business_int_proto_rawDesc, - NumEnums: 0, - NumMessages: 5, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_business_int_proto_goTypes, - DependencyIndexes: file_business_int_proto_depIdxs, - MessageInfos: file_business_int_proto_msgTypes, - }.Build() - File_business_int_proto = out.File - file_business_int_proto_rawDesc = nil - file_business_int_proto_goTypes = nil - file_business_int_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// BusinessIntClient is the client API for BusinessInt service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type BusinessIntClient interface { - // 权限校验 - Auth(ctx context.Context, in *AuthReq, opts ...grpc.CallOption) (*Empty, error) - // 批量获取用户信息 - GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*GetUserResp, error) - // 批量获取用户信息 - GetUsers(ctx context.Context, in *GetUsersReq, opts ...grpc.CallOption) (*GetUsersResp, error) -} - -type businessIntClient struct { - cc grpc.ClientConnInterface -} - -func NewBusinessIntClient(cc grpc.ClientConnInterface) BusinessIntClient { - return &businessIntClient{cc} -} - -func (c *businessIntClient) Auth(ctx context.Context, in *AuthReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.BusinessInt/Auth", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *businessIntClient) GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*GetUserResp, error) { - out := new(GetUserResp) - err := c.cc.Invoke(ctx, "/pb.BusinessInt/GetUser", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *businessIntClient) GetUsers(ctx context.Context, in *GetUsersReq, opts ...grpc.CallOption) (*GetUsersResp, error) { - out := new(GetUsersResp) - err := c.cc.Invoke(ctx, "/pb.BusinessInt/GetUsers", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// BusinessIntServer is the server API for BusinessInt service. -type BusinessIntServer interface { - // 权限校验 - Auth(context.Context, *AuthReq) (*Empty, error) - // 批量获取用户信息 - GetUser(context.Context, *GetUserReq) (*GetUserResp, error) - // 批量获取用户信息 - GetUsers(context.Context, *GetUsersReq) (*GetUsersResp, error) -} - -// UnimplementedBusinessIntServer can be embedded to have forward compatible implementations. -type UnimplementedBusinessIntServer struct { -} - -func (*UnimplementedBusinessIntServer) Auth(context.Context, *AuthReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method Auth not implemented") -} -func (*UnimplementedBusinessIntServer) GetUser(context.Context, *GetUserReq) (*GetUserResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented") -} -func (*UnimplementedBusinessIntServer) GetUsers(context.Context, *GetUsersReq) (*GetUsersResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetUsers not implemented") -} - -func RegisterBusinessIntServer(s *grpc.Server, srv BusinessIntServer) { - s.RegisterService(&_BusinessInt_serviceDesc, srv) -} - -func _BusinessInt_Auth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BusinessIntServer).Auth(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.BusinessInt/Auth", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BusinessIntServer).Auth(ctx, req.(*AuthReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _BusinessInt_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetUserReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BusinessIntServer).GetUser(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.BusinessInt/GetUser", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BusinessIntServer).GetUser(ctx, req.(*GetUserReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _BusinessInt_GetUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetUsersReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BusinessIntServer).GetUsers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.BusinessInt/GetUsers", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BusinessIntServer).GetUsers(ctx, req.(*GetUsersReq)) - } - return interceptor(ctx, in, info, handler) -} - -var _BusinessInt_serviceDesc = grpc.ServiceDesc{ - ServiceName: "pb.BusinessInt", - HandlerType: (*BusinessIntServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Auth", - Handler: _BusinessInt_Auth_Handler, - }, - { - MethodName: "GetUser", - Handler: _BusinessInt_GetUser_Handler, - }, - { - MethodName: "GetUsers", - Handler: _BusinessInt_GetUsers_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "business.int.proto", -} diff --git a/pkg/pb/common.ext.pb.go b/pkg/pb/common.ext.pb.go deleted file mode 100644 index d6e8601d..00000000 --- a/pkg/pb/common.ext.pb.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.14.0 -// source: common.ext.proto - -package pb - -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) -) - -type Empty struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Empty) Reset() { - *x = Empty{} - if protoimpl.UnsafeEnabled { - mi := &file_common_ext_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Empty) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Empty) ProtoMessage() {} - -func (x *Empty) ProtoReflect() protoreflect.Message { - mi := &file_common_ext_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 Empty.ProtoReflect.Descriptor instead. -func (*Empty) Descriptor() ([]byte, []int) { - return file_common_ext_proto_rawDescGZIP(), []int{0} -} - -var File_common_ext_proto protoreflect.FileDescriptor - -var file_common_ext_proto_rawDesc = []byte{ - 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, - 0x0d, 0x5a, 0x0b, 0x67, 0x69, 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_common_ext_proto_rawDescOnce sync.Once - file_common_ext_proto_rawDescData = file_common_ext_proto_rawDesc -) - -func file_common_ext_proto_rawDescGZIP() []byte { - file_common_ext_proto_rawDescOnce.Do(func() { - file_common_ext_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_ext_proto_rawDescData) - }) - return file_common_ext_proto_rawDescData -} - -var file_common_ext_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_common_ext_proto_goTypes = []interface{}{ - (*Empty)(nil), // 0: pb.Empty -} -var file_common_ext_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_ext_proto_init() } -func file_common_ext_proto_init() { - if File_common_ext_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_common_ext_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Empty); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_common_ext_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_common_ext_proto_goTypes, - DependencyIndexes: file_common_ext_proto_depIdxs, - MessageInfos: file_common_ext_proto_msgTypes, - }.Build() - File_common_ext_proto = out.File - file_common_ext_proto_rawDesc = nil - file_common_ext_proto_goTypes = nil - file_common_ext_proto_depIdxs = nil -} diff --git a/pkg/pb/connect.ext.pb.go b/pkg/pb/connect.ext.pb.go deleted file mode 100644 index 48cf8705..00000000 --- a/pkg/pb/connect.ext.pb.go +++ /dev/null @@ -1,1915 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.14.0 -// source: connect.ext.proto - -package pb - -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) -) - -type PackageType int32 - -const ( - PackageType_PT_UNKNOWN PackageType = 0 // 未知 - PackageType_PT_SIGN_IN PackageType = 1 // 设备登录请求 - PackageType_PT_SYNC PackageType = 2 // 消息同步触发 - PackageType_PT_HEARTBEAT PackageType = 3 // 心跳 - PackageType_PT_MESSAGE PackageType = 4 // 消息投递 - PackageType_PT_SUBSCRIBE_ROOM PackageType = 5 // 订阅房间 -) - -// Enum value maps for PackageType. -var ( - PackageType_name = map[int32]string{ - 0: "PT_UNKNOWN", - 1: "PT_SIGN_IN", - 2: "PT_SYNC", - 3: "PT_HEARTBEAT", - 4: "PT_MESSAGE", - 5: "PT_SUBSCRIBE_ROOM", - } - PackageType_value = map[string]int32{ - "PT_UNKNOWN": 0, - "PT_SIGN_IN": 1, - "PT_SYNC": 2, - "PT_HEARTBEAT": 3, - "PT_MESSAGE": 4, - "PT_SUBSCRIBE_ROOM": 5, - } -) - -func (x PackageType) Enum() *PackageType { - p := new(PackageType) - *p = x - return p -} - -func (x PackageType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (PackageType) Descriptor() protoreflect.EnumDescriptor { - return file_connect_ext_proto_enumTypes[0].Descriptor() -} - -func (PackageType) Type() protoreflect.EnumType { - return &file_connect_ext_proto_enumTypes[0] -} - -func (x PackageType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use PackageType.Descriptor instead. -func (PackageType) EnumDescriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{0} -} - -// 消息类型 -type MessageType int32 - -const ( - MessageType_MT_UNKNOWN MessageType = 0 // 未知 - MessageType_MT_TEXT MessageType = 1 // 文本 - MessageType_MT_FACE MessageType = 2 // 表情 - MessageType_MT_VOICE MessageType = 3 // 语音消息 - MessageType_MT_IMAGE MessageType = 4 // 图片 - MessageType_MT_FILE MessageType = 5 // 文件 - MessageType_MT_LOCATION MessageType = 6 // 地理位置 - MessageType_MT_COMMAND MessageType = 7 // 指令推送 - MessageType_MT_CUSTOM MessageType = 8 // 自定义 -) - -// Enum value maps for MessageType. -var ( - MessageType_name = map[int32]string{ - 0: "MT_UNKNOWN", - 1: "MT_TEXT", - 2: "MT_FACE", - 3: "MT_VOICE", - 4: "MT_IMAGE", - 5: "MT_FILE", - 6: "MT_LOCATION", - 7: "MT_COMMAND", - 8: "MT_CUSTOM", - } - MessageType_value = map[string]int32{ - "MT_UNKNOWN": 0, - "MT_TEXT": 1, - "MT_FACE": 2, - "MT_VOICE": 3, - "MT_IMAGE": 4, - "MT_FILE": 5, - "MT_LOCATION": 6, - "MT_COMMAND": 7, - "MT_CUSTOM": 8, - } -) - -func (x MessageType) Enum() *MessageType { - p := new(MessageType) - *p = x - return p -} - -func (x MessageType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (MessageType) Descriptor() protoreflect.EnumDescriptor { - return file_connect_ext_proto_enumTypes[1].Descriptor() -} - -func (MessageType) Type() protoreflect.EnumType { - return &file_connect_ext_proto_enumTypes[1] -} - -func (x MessageType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use MessageType.Descriptor instead. -func (MessageType) EnumDescriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{1} -} - -type ReceiverType int32 - -const ( - ReceiverType_RT_UNKNOWN ReceiverType = 0 // 未知 - ReceiverType_RT_USER ReceiverType = 1 // 用户 - ReceiverType_RT_GROUP ReceiverType = 2 // 群组 - ReceiverType_RT_ROOM ReceiverType = 3 // 房间 -) - -// Enum value maps for ReceiverType. -var ( - ReceiverType_name = map[int32]string{ - 0: "RT_UNKNOWN", - 1: "RT_USER", - 2: "RT_GROUP", - 3: "RT_ROOM", - } - ReceiverType_value = map[string]int32{ - "RT_UNKNOWN": 0, - "RT_USER": 1, - "RT_GROUP": 2, - "RT_ROOM": 3, - } -) - -func (x ReceiverType) Enum() *ReceiverType { - p := new(ReceiverType) - *p = x - return p -} - -func (x ReceiverType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ReceiverType) Descriptor() protoreflect.EnumDescriptor { - return file_connect_ext_proto_enumTypes[2].Descriptor() -} - -func (ReceiverType) Type() protoreflect.EnumType { - return &file_connect_ext_proto_enumTypes[2] -} - -func (x ReceiverType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ReceiverType.Descriptor instead. -func (ReceiverType) EnumDescriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{2} -} - -type SenderType int32 - -const ( - SenderType_ST_UNKNOWN SenderType = 0 // 未知的 - SenderType_ST_SYSTEM SenderType = 1 // IM系统 - SenderType_ST_USER SenderType = 2 // 用户 - SenderType_ST_BUSINESS SenderType = 3 // 业务方 -) - -// Enum value maps for SenderType. -var ( - SenderType_name = map[int32]string{ - 0: "ST_UNKNOWN", - 1: "ST_SYSTEM", - 2: "ST_USER", - 3: "ST_BUSINESS", - } - SenderType_value = map[string]int32{ - "ST_UNKNOWN": 0, - "ST_SYSTEM": 1, - "ST_USER": 2, - "ST_BUSINESS": 3, - } -) - -func (x SenderType) Enum() *SenderType { - p := new(SenderType) - *p = x - return p -} - -func (x SenderType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (SenderType) Descriptor() protoreflect.EnumDescriptor { - return file_connect_ext_proto_enumTypes[3].Descriptor() -} - -func (SenderType) Type() protoreflect.EnumType { - return &file_connect_ext_proto_enumTypes[3] -} - -func (x SenderType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use SenderType.Descriptor instead. -func (SenderType) EnumDescriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{3} -} - -type MessageStatus int32 - -const ( - MessageStatus_MS_UNKNOWN MessageStatus = 0 // 未知的 - MessageStatus_MS_NORMAL MessageStatus = 1 // 正常的 - MessageStatus_MS_RECALL MessageStatus = 2 // 撤回 -) - -// Enum value maps for MessageStatus. -var ( - MessageStatus_name = map[int32]string{ - 0: "MS_UNKNOWN", - 1: "MS_NORMAL", - 2: "MS_RECALL", - } - MessageStatus_value = map[string]int32{ - "MS_UNKNOWN": 0, - "MS_NORMAL": 1, - "MS_RECALL": 2, - } -) - -func (x MessageStatus) Enum() *MessageStatus { - p := new(MessageStatus) - *p = x - return p -} - -func (x MessageStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (MessageStatus) Descriptor() protoreflect.EnumDescriptor { - return file_connect_ext_proto_enumTypes[4].Descriptor() -} - -func (MessageStatus) Type() protoreflect.EnumType { - return &file_connect_ext_proto_enumTypes[4] -} - -func (x MessageStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use MessageStatus.Descriptor instead. -func (MessageStatus) EnumDescriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{4} -} - -// 单条消息投递内容(估算大约100个字节),todo 通知栏提醒 -type Message struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Sender *Sender `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` // 发送者 - ReceiverType ReceiverType `protobuf:"varint,2,opt,name=receiver_type,json=receiverType,proto3,enum=pb.ReceiverType" json:"receiver_type,omitempty"` // 接收者类型,1:user;2:group - ReceiverId int64 `protobuf:"varint,3,opt,name=receiver_id,json=receiverId,proto3" json:"receiver_id,omitempty"` // 用户id或者群组id - ToUserIds []int64 `protobuf:"varint,4,rep,packed,name=to_user_ids,json=toUserIds,proto3" json:"to_user_ids,omitempty"` // 需要@的用户id列表 - MessageType MessageType `protobuf:"varint,5,opt,name=message_type,json=messageType,proto3,enum=pb.MessageType" json:"message_type,omitempty"` // 消息类型 - MessageContent []byte `protobuf:"bytes,6,opt,name=message_content,json=messageContent,proto3" json:"message_content,omitempty"` // 消息内容 - Seq int64 `protobuf:"varint,7,opt,name=seq,proto3" json:"seq,omitempty"` // 用户消息发送序列号 - SendTime int64 `protobuf:"varint,8,opt,name=send_time,json=sendTime,proto3" json:"send_time,omitempty"` // 消息发送时间戳,精确到毫秒 - Status MessageStatus `protobuf:"varint,9,opt,name=status,proto3,enum=pb.MessageStatus" json:"status,omitempty"` // 消息状态 -} - -func (x *Message) Reset() { - *x = Message{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Message) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Message) ProtoMessage() {} - -func (x *Message) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_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 Message.ProtoReflect.Descriptor instead. -func (*Message) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{0} -} - -func (x *Message) GetSender() *Sender { - if x != nil { - return x.Sender - } - return nil -} - -func (x *Message) GetReceiverType() ReceiverType { - if x != nil { - return x.ReceiverType - } - return ReceiverType_RT_UNKNOWN -} - -func (x *Message) GetReceiverId() int64 { - if x != nil { - return x.ReceiverId - } - return 0 -} - -func (x *Message) GetToUserIds() []int64 { - if x != nil { - return x.ToUserIds - } - return nil -} - -func (x *Message) GetMessageType() MessageType { - if x != nil { - return x.MessageType - } - return MessageType_MT_UNKNOWN -} - -func (x *Message) GetMessageContent() []byte { - if x != nil { - return x.MessageContent - } - return nil -} - -func (x *Message) GetSeq() int64 { - if x != nil { - return x.Seq - } - return 0 -} - -func (x *Message) GetSendTime() int64 { - if x != nil { - return x.SendTime - } - return 0 -} - -func (x *Message) GetStatus() MessageStatus { - if x != nil { - return x.Status - } - return MessageStatus_MS_UNKNOWN -} - -type Sender struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SenderType SenderType `protobuf:"varint,1,opt,name=sender_type,json=senderType,proto3,enum=pb.SenderType" json:"sender_type,omitempty"` // 发送者类型,1:系统,2:用户,3:第三方业务系统 - SenderId int64 `protobuf:"varint,2,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"` // 发送者id - DeviceId int64 `protobuf:"varint,3,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 发送者设备id - AvatarUrl string `protobuf:"bytes,4,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` // 昵称 - Nickname string `protobuf:"bytes,5,opt,name=nickname,proto3" json:"nickname,omitempty"` // 头像 - Extra string `protobuf:"bytes,6,opt,name=extra,proto3" json:"extra,omitempty"` // 扩展字段 -} - -func (x *Sender) Reset() { - *x = Sender{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Sender) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Sender) ProtoMessage() {} - -func (x *Sender) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_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 Sender.ProtoReflect.Descriptor instead. -func (*Sender) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{1} -} - -func (x *Sender) GetSenderType() SenderType { - if x != nil { - return x.SenderType - } - return SenderType_ST_UNKNOWN -} - -func (x *Sender) GetSenderId() int64 { - if x != nil { - return x.SenderId - } - return 0 -} - -func (x *Sender) GetDeviceId() int64 { - if x != nil { - return x.DeviceId - } - return 0 -} - -func (x *Sender) GetAvatarUrl() string { - if x != nil { - return x.AvatarUrl - } - return "" -} - -func (x *Sender) GetNickname() string { - if x != nil { - return x.Nickname - } - return "" -} - -func (x *Sender) GetExtra() string { - if x != nil { - return x.Extra - } - return "" -} - -// 文本消息 -type Text struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` // 文本消息内容 -} - -func (x *Text) Reset() { - *x = Text{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Text) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Text) ProtoMessage() {} - -func (x *Text) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_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 Text.ProtoReflect.Descriptor instead. -func (*Text) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{2} -} - -func (x *Text) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -// 表情消息 -type Face struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - FaceId int64 `protobuf:"varint,1,opt,name=face_id,json=faceId,proto3" json:"face_id,omitempty"` - FaceUrl string `protobuf:"bytes,2,opt,name=face_url,json=faceUrl,proto3" json:"face_url,omitempty"` -} - -func (x *Face) Reset() { - *x = Face{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Face) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Face) ProtoMessage() {} - -func (x *Face) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_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 Face.ProtoReflect.Descriptor instead. -func (*Face) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{3} -} - -func (x *Face) GetFaceId() int64 { - if x != nil { - return x.FaceId - } - return 0 -} - -func (x *Face) GetFaceUrl() string { - if x != nil { - return x.FaceUrl - } - return "" -} - -// 语音消息 -type Voice struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // 语音包id - Size int32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` // 语音包大小 - Duration int32 `protobuf:"varint,3,opt,name=duration,proto3" json:"duration,omitempty"` // 语音时长 - Url string `protobuf:"bytes,4,opt,name=url,proto3" json:"url,omitempty"` // 语音文件URL -} - -func (x *Voice) Reset() { - *x = Voice{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Voice) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Voice) ProtoMessage() {} - -func (x *Voice) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_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 Voice.ProtoReflect.Descriptor instead. -func (*Voice) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{4} -} - -func (x *Voice) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Voice) GetSize() int32 { - if x != nil { - return x.Size - } - return 0 -} - -func (x *Voice) GetDuration() int32 { - if x != nil { - return x.Duration - } - return 0 -} - -func (x *Voice) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -// 图片消息 -type Image struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // 图片id - Width int32 `protobuf:"varint,2,opt,name=width,proto3" json:"width,omitempty"` // 图片宽度 - Height int32 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` // 图片长度 - Url string `protobuf:"bytes,4,opt,name=url,proto3" json:"url,omitempty"` // 图片URL - ThumbnailUrl string `protobuf:"bytes,5,opt,name=thumbnail_url,json=thumbnailUrl,proto3" json:"thumbnail_url,omitempty"` // 图片缩略图url -} - -func (x *Image) Reset() { - *x = Image{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Image) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Image) ProtoMessage() {} - -func (x *Image) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_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 Image.ProtoReflect.Descriptor instead. -func (*Image) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{5} -} - -func (x *Image) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Image) GetWidth() int32 { - if x != nil { - return x.Width - } - return 0 -} - -func (x *Image) GetHeight() int32 { - if x != nil { - return x.Height - } - return 0 -} - -func (x *Image) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *Image) GetThumbnailUrl() string { - if x != nil { - return x.ThumbnailUrl - } - return "" -} - -// 文件消息 -type File struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,12,opt,name=id,proto3" json:"id,omitempty"` // 文件id - Name string `protobuf:"bytes,13,opt,name=name,proto3" json:"name,omitempty"` // 文件名 - Size int64 `protobuf:"varint,14,opt,name=size,proto3" json:"size,omitempty"` // 文件大小 - Url string `protobuf:"bytes,15,opt,name=url,proto3" json:"url,omitempty"` // 文件url -} - -func (x *File) Reset() { - *x = File{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *File) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*File) ProtoMessage() {} - -func (x *File) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_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 File.ProtoReflect.Descriptor instead. -func (*File) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{6} -} - -func (x *File) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *File) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *File) GetSize() int64 { - if x != nil { - return x.Size - } - return 0 -} - -func (x *File) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -// 地理位置消息 -type Location struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Desc string `protobuf:"bytes,1,opt,name=desc,proto3" json:"desc,omitempty"` // 描述 - Latitude float64 `protobuf:"fixed64,2,opt,name=latitude,proto3" json:"latitude,omitempty"` // 经度 - Longitude float64 `protobuf:"fixed64,3,opt,name=longitude,proto3" json:"longitude,omitempty"` // 纬度 -} - -func (x *Location) Reset() { - *x = Location{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Location) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Location) ProtoMessage() {} - -func (x *Location) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_proto_msgTypes[7] - 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 Location.ProtoReflect.Descriptor instead. -func (*Location) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{7} -} - -func (x *Location) GetDesc() string { - if x != nil { - return x.Desc - } - return "" -} - -func (x *Location) GetLatitude() float64 { - if x != nil { - return x.Latitude - } - return 0 -} - -func (x *Location) GetLongitude() float64 { - if x != nil { - return x.Longitude - } - return 0 -} - -// Command 指令推送,1000以下,IM内部用,1000以上,留给业务用 -type Command struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` // 指令码 - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // 数据内容 -} - -func (x *Command) Reset() { - *x = Command{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Command) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Command) ProtoMessage() {} - -func (x *Command) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_proto_msgTypes[8] - 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 Command.ProtoReflect.Descriptor instead. -func (*Command) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{8} -} - -func (x *Command) GetCode() int32 { - if x != nil { - return x.Code - } - return 0 -} - -func (x *Command) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -// 自定义消息 -type Custom struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // 自定义数据 -} - -func (x *Custom) Reset() { - *x = Custom{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Custom) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Custom) ProtoMessage() {} - -func (x *Custom) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_proto_msgTypes[9] - 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 Custom.ProtoReflect.Descriptor instead. -func (*Custom) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{9} -} - -func (x *Custom) GetData() string { - if x != nil { - return x.Data - } - return "" -} - -// 上行数据 -type Input struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type PackageType `protobuf:"varint,1,opt,name=type,proto3,enum=pb.PackageType" json:"type,omitempty"` // 包的类型 - RequestId int64 `protobuf:"varint,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` // 请求id - Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` // 数据 -} - -func (x *Input) Reset() { - *x = Input{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Input) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Input) ProtoMessage() {} - -func (x *Input) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_proto_msgTypes[10] - 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 Input.ProtoReflect.Descriptor instead. -func (*Input) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{10} -} - -func (x *Input) GetType() PackageType { - if x != nil { - return x.Type - } - return PackageType_PT_UNKNOWN -} - -func (x *Input) GetRequestId() int64 { - if x != nil { - return x.RequestId - } - return 0 -} - -func (x *Input) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -// 下行数据 -type Output struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type PackageType `protobuf:"varint,1,opt,name=type,proto3,enum=pb.PackageType" json:"type,omitempty"` // 包的类型 - RequestId int64 `protobuf:"varint,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` // 请求id - Code int32 `protobuf:"varint,3,opt,name=code,proto3" json:"code,omitempty"` // 错误码 - Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` // 错误信息 - Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` // 数据 -} - -func (x *Output) Reset() { - *x = Output{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Output) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Output) ProtoMessage() {} - -func (x *Output) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_proto_msgTypes[11] - 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 Output.ProtoReflect.Descriptor instead. -func (*Output) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{11} -} - -func (x *Output) GetType() PackageType { - if x != nil { - return x.Type - } - return PackageType_PT_UNKNOWN -} - -func (x *Output) GetRequestId() int64 { - if x != nil { - return x.RequestId - } - return 0 -} - -func (x *Output) GetCode() int32 { - if x != nil { - return x.Code - } - return 0 -} - -func (x *Output) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -func (x *Output) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -// 设备登录,package_type:1 -type SignInInput struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DeviceId int64 `protobuf:"varint,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id - UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户id - Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` // 秘钥 -} - -func (x *SignInInput) Reset() { - *x = SignInInput{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SignInInput) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SignInInput) ProtoMessage() {} - -func (x *SignInInput) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_proto_msgTypes[12] - 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 SignInInput.ProtoReflect.Descriptor instead. -func (*SignInInput) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{12} -} - -func (x *SignInInput) GetDeviceId() int64 { - if x != nil { - return x.DeviceId - } - return 0 -} - -func (x *SignInInput) GetUserId() int64 { - if x != nil { - return x.UserId - } - return 0 -} - -func (x *SignInInput) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -// 消息同步请求,package_type:2 -type SyncInput struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Seq int64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` // 客户端已经同步的序列号 -} - -func (x *SyncInput) Reset() { - *x = SyncInput{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SyncInput) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SyncInput) ProtoMessage() {} - -func (x *SyncInput) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_proto_msgTypes[13] - 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 SyncInput.ProtoReflect.Descriptor instead. -func (*SyncInput) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{13} -} - -func (x *SyncInput) GetSeq() int64 { - if x != nil { - return x.Seq - } - return 0 -} - -// 消息同步响应,package_type:2 -type SyncOutput struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` // 消息列表 - HasMore bool `protobuf:"varint,2,opt,name=has_more,json=hasMore,proto3" json:"has_more,omitempty"` // 是否有更多数据 -} - -func (x *SyncOutput) Reset() { - *x = SyncOutput{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SyncOutput) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SyncOutput) ProtoMessage() {} - -func (x *SyncOutput) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_proto_msgTypes[14] - 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 SyncOutput.ProtoReflect.Descriptor instead. -func (*SyncOutput) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{14} -} - -func (x *SyncOutput) GetMessages() []*Message { - if x != nil { - return x.Messages - } - return nil -} - -func (x *SyncOutput) GetHasMore() bool { - if x != nil { - return x.HasMore - } - return false -} - -// 订阅房间请求 -type SubscribeRoomInput struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RoomId int64 `protobuf:"varint,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` // 房间ID,如果为0,取消房间订阅 - Seq int64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` // 消息消息序列号, -} - -func (x *SubscribeRoomInput) Reset() { - *x = SubscribeRoomInput{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SubscribeRoomInput) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubscribeRoomInput) ProtoMessage() {} - -func (x *SubscribeRoomInput) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_proto_msgTypes[15] - 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 SubscribeRoomInput.ProtoReflect.Descriptor instead. -func (*SubscribeRoomInput) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{15} -} - -func (x *SubscribeRoomInput) GetRoomId() int64 { - if x != nil { - return x.RoomId - } - return 0 -} - -func (x *SubscribeRoomInput) GetSeq() int64 { - if x != nil { - return x.Seq - } - return 0 -} - -// 消息投递,package_type:4 -type MessageSend struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Message *Message `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // 消息 -} - -func (x *MessageSend) Reset() { - *x = MessageSend{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageSend) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageSend) ProtoMessage() {} - -func (x *MessageSend) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_proto_msgTypes[16] - 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 MessageSend.ProtoReflect.Descriptor instead. -func (*MessageSend) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{16} -} - -func (x *MessageSend) GetMessage() *Message { - if x != nil { - return x.Message - } - return nil -} - -// 投递消息回执,package_type:4 -type MessageACK struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DeviceAck int64 `protobuf:"varint,2,opt,name=device_ack,json=deviceAck,proto3" json:"device_ack,omitempty"` // 设备收到消息的确认号 - ReceiveTime int64 `protobuf:"varint,3,opt,name=receive_time,json=receiveTime,proto3" json:"receive_time,omitempty"` // 消息接收时间戳,精确到毫秒 -} - -func (x *MessageACK) Reset() { - *x = MessageACK{} - if protoimpl.UnsafeEnabled { - mi := &file_connect_ext_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageACK) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageACK) ProtoMessage() {} - -func (x *MessageACK) ProtoReflect() protoreflect.Message { - mi := &file_connect_ext_proto_msgTypes[17] - 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 MessageACK.ProtoReflect.Descriptor instead. -func (*MessageACK) Descriptor() ([]byte, []int) { - return file_connect_ext_proto_rawDescGZIP(), []int{17} -} - -func (x *MessageACK) GetDeviceAck() int64 { - if x != nil { - return x.DeviceAck - } - return 0 -} - -func (x *MessageACK) GetReceiveTime() int64 { - if x != nil { - return x.ReceiveTime - } - return 0 -} - -var File_connect_ext_proto protoreflect.FileDescriptor - -var file_connect_ext_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xdc, 0x02, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x12, 0x22, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x52, - 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x0d, 0x72, 0x65, 0x63, 0x65, 0x69, - 0x76, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, - 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x0c, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, - 0x0a, 0x0b, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, - 0x1e, 0x0a, 0x0b, 0x74, 0x6f, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x03, 0x52, 0x09, 0x74, 0x6f, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x12, - 0x32, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, - 0x73, 0x65, 0x71, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x73, 0x65, 0x71, 0x12, 0x1b, - 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x62, - 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x12, 0x2f, 0x0a, 0x0b, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, - 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, - 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x6e, - 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, - 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x1a, 0x0a, - 0x04, 0x54, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0x3a, 0x0a, 0x04, 0x46, 0x61, 0x63, - 0x65, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x06, 0x66, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x66, 0x61, - 0x63, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x66, 0x61, - 0x63, 0x65, 0x55, 0x72, 0x6c, 0x22, 0x59, 0x0a, 0x05, 0x56, 0x6f, 0x69, 0x63, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, - 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x69, - 0x7a, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, - 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, - 0x22, 0x7c, 0x0a, 0x05, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x69, 0x64, - 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x12, - 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x23, 0x0a, 0x0d, 0x74, 0x68, 0x75, - 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x55, 0x72, 0x6c, 0x22, 0x50, - 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0d, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, - 0x7a, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x10, - 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, - 0x22, 0x58, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, - 0x64, 0x65, 0x73, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x65, 0x73, 0x63, - 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, - 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, - 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x22, 0x31, 0x0a, 0x07, 0x43, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x1c, 0x0a, - 0x06, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x5f, 0x0a, 0x05, 0x49, - 0x6e, 0x70, 0x75, 0x74, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x8e, 0x01, 0x0a, - 0x06, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, - 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, - 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x59, 0x0a, - 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x1b, 0x0a, 0x09, - 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, - 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x1d, 0x0a, 0x09, 0x53, 0x79, 0x6e, 0x63, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x03, 0x73, 0x65, 0x71, 0x22, 0x50, 0x0a, 0x0a, 0x53, 0x79, 0x6e, 0x63, 0x4f, - 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x27, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x19, - 0x0a, 0x08, 0x68, 0x61, 0x73, 0x5f, 0x6d, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x07, 0x68, 0x61, 0x73, 0x4d, 0x6f, 0x72, 0x65, 0x22, 0x3f, 0x0a, 0x12, 0x53, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, - 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x73, 0x65, 0x71, 0x22, 0x34, 0x0a, 0x0b, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x25, 0x0a, 0x07, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x62, 0x2e, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x22, 0x4e, 0x0a, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x43, 0x4b, 0x12, 0x1d, - 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x61, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x41, 0x63, 0x6b, 0x12, 0x21, 0x0a, - 0x0c, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0b, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x54, 0x69, 0x6d, 0x65, - 0x2a, 0x73, 0x0a, 0x0b, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x0e, 0x0a, 0x0a, 0x50, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, - 0x0e, 0x0a, 0x0a, 0x50, 0x54, 0x5f, 0x53, 0x49, 0x47, 0x4e, 0x5f, 0x49, 0x4e, 0x10, 0x01, 0x12, - 0x0b, 0x0a, 0x07, 0x50, 0x54, 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, - 0x50, 0x54, 0x5f, 0x48, 0x45, 0x41, 0x52, 0x54, 0x42, 0x45, 0x41, 0x54, 0x10, 0x03, 0x12, 0x0e, - 0x0a, 0x0a, 0x50, 0x54, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x04, 0x12, 0x15, - 0x0a, 0x11, 0x50, 0x54, 0x5f, 0x53, 0x55, 0x42, 0x53, 0x43, 0x52, 0x49, 0x42, 0x45, 0x5f, 0x52, - 0x4f, 0x4f, 0x4d, 0x10, 0x05, 0x2a, 0x90, 0x01, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x4d, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, - 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x4d, 0x54, 0x5f, 0x54, 0x45, 0x58, 0x54, - 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4d, 0x54, 0x5f, 0x46, 0x41, 0x43, 0x45, 0x10, 0x02, 0x12, - 0x0c, 0x0a, 0x08, 0x4d, 0x54, 0x5f, 0x56, 0x4f, 0x49, 0x43, 0x45, 0x10, 0x03, 0x12, 0x0c, 0x0a, - 0x08, 0x4d, 0x54, 0x5f, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x10, 0x04, 0x12, 0x0b, 0x0a, 0x07, 0x4d, - 0x54, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x10, 0x05, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x54, 0x5f, 0x4c, - 0x4f, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x4d, 0x54, 0x5f, - 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x4d, 0x54, 0x5f, - 0x43, 0x55, 0x53, 0x54, 0x4f, 0x4d, 0x10, 0x08, 0x2a, 0x46, 0x0a, 0x0c, 0x52, 0x65, 0x63, 0x65, - 0x69, 0x76, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x54, 0x5f, 0x55, - 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x54, 0x5f, 0x55, - 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x54, 0x5f, 0x47, 0x52, 0x4f, 0x55, - 0x50, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x54, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x10, 0x03, - 0x2a, 0x49, 0x0a, 0x0a, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, - 0x0a, 0x0a, 0x53, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, - 0x0a, 0x09, 0x53, 0x54, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x01, 0x12, 0x0b, 0x0a, - 0x07, 0x53, 0x54, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x54, - 0x5f, 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x10, 0x03, 0x2a, 0x3d, 0x0a, 0x0d, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x0a, 0x0a, - 0x4d, 0x53, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, - 0x4d, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4d, - 0x53, 0x5f, 0x52, 0x45, 0x43, 0x41, 0x4c, 0x4c, 0x10, 0x02, 0x42, 0x0d, 0x5a, 0x0b, 0x67, 0x69, - 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_connect_ext_proto_rawDescOnce sync.Once - file_connect_ext_proto_rawDescData = file_connect_ext_proto_rawDesc -) - -func file_connect_ext_proto_rawDescGZIP() []byte { - file_connect_ext_proto_rawDescOnce.Do(func() { - file_connect_ext_proto_rawDescData = protoimpl.X.CompressGZIP(file_connect_ext_proto_rawDescData) - }) - return file_connect_ext_proto_rawDescData -} - -var file_connect_ext_proto_enumTypes = make([]protoimpl.EnumInfo, 5) -var file_connect_ext_proto_msgTypes = make([]protoimpl.MessageInfo, 18) -var file_connect_ext_proto_goTypes = []interface{}{ - (PackageType)(0), // 0: pb.PackageType - (MessageType)(0), // 1: pb.MessageType - (ReceiverType)(0), // 2: pb.ReceiverType - (SenderType)(0), // 3: pb.SenderType - (MessageStatus)(0), // 4: pb.MessageStatus - (*Message)(nil), // 5: pb.Message - (*Sender)(nil), // 6: pb.Sender - (*Text)(nil), // 7: pb.Text - (*Face)(nil), // 8: pb.Face - (*Voice)(nil), // 9: pb.Voice - (*Image)(nil), // 10: pb.Image - (*File)(nil), // 11: pb.File - (*Location)(nil), // 12: pb.Location - (*Command)(nil), // 13: pb.Command - (*Custom)(nil), // 14: pb.Custom - (*Input)(nil), // 15: pb.Input - (*Output)(nil), // 16: pb.Output - (*SignInInput)(nil), // 17: pb.SignInInput - (*SyncInput)(nil), // 18: pb.SyncInput - (*SyncOutput)(nil), // 19: pb.SyncOutput - (*SubscribeRoomInput)(nil), // 20: pb.SubscribeRoomInput - (*MessageSend)(nil), // 21: pb.MessageSend - (*MessageACK)(nil), // 22: pb.MessageACK -} -var file_connect_ext_proto_depIdxs = []int32{ - 6, // 0: pb.Message.sender:type_name -> pb.Sender - 2, // 1: pb.Message.receiver_type:type_name -> pb.ReceiverType - 1, // 2: pb.Message.message_type:type_name -> pb.MessageType - 4, // 3: pb.Message.status:type_name -> pb.MessageStatus - 3, // 4: pb.Sender.sender_type:type_name -> pb.SenderType - 0, // 5: pb.Input.type:type_name -> pb.PackageType - 0, // 6: pb.Output.type:type_name -> pb.PackageType - 5, // 7: pb.SyncOutput.messages:type_name -> pb.Message - 5, // 8: pb.MessageSend.message:type_name -> pb.Message - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name -} - -func init() { file_connect_ext_proto_init() } -func file_connect_ext_proto_init() { - if File_connect_ext_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_connect_ext_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Message); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Sender); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Text); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Face); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Voice); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Image); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*File); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Location); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Command); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Custom); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Input); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Output); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SignInInput); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncInput); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncOutput); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SubscribeRoomInput); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageSend); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_connect_ext_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageACK); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_connect_ext_proto_rawDesc, - NumEnums: 5, - NumMessages: 18, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_connect_ext_proto_goTypes, - DependencyIndexes: file_connect_ext_proto_depIdxs, - EnumInfos: file_connect_ext_proto_enumTypes, - MessageInfos: file_connect_ext_proto_msgTypes, - }.Build() - File_connect_ext_proto = out.File - file_connect_ext_proto_rawDesc = nil - file_connect_ext_proto_goTypes = nil - file_connect_ext_proto_depIdxs = nil -} diff --git a/pkg/pb/logic.int.pb.go b/pkg/pb/logic.int.pb.go deleted file mode 100644 index 927436ad..00000000 --- a/pkg/pb/logic.int.pb.go +++ /dev/null @@ -1,1547 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.14.0 -// source: logic.int.proto - -package pb - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type ConnSignInReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DeviceId int64 `protobuf:"varint,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id - UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户id - Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` // 秘钥 - ConnAddr string `protobuf:"bytes,4,opt,name=conn_addr,json=connAddr,proto3" json:"conn_addr,omitempty"` // 服务器地址 - ClientAddr string `protobuf:"bytes,5,opt,name=client_addr,json=clientAddr,proto3" json:"client_addr,omitempty"` // 客户端地址 -} - -func (x *ConnSignInReq) Reset() { - *x = ConnSignInReq{} - if protoimpl.UnsafeEnabled { - mi := &file_logic_int_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ConnSignInReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ConnSignInReq) ProtoMessage() {} - -func (x *ConnSignInReq) ProtoReflect() protoreflect.Message { - mi := &file_logic_int_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 ConnSignInReq.ProtoReflect.Descriptor instead. -func (*ConnSignInReq) Descriptor() ([]byte, []int) { - return file_logic_int_proto_rawDescGZIP(), []int{0} -} - -func (x *ConnSignInReq) GetDeviceId() int64 { - if x != nil { - return x.DeviceId - } - return 0 -} - -func (x *ConnSignInReq) GetUserId() int64 { - if x != nil { - return x.UserId - } - return 0 -} - -func (x *ConnSignInReq) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -func (x *ConnSignInReq) GetConnAddr() string { - if x != nil { - return x.ConnAddr - } - return "" -} - -func (x *ConnSignInReq) GetClientAddr() string { - if x != nil { - return x.ClientAddr - } - return "" -} - -type SyncReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户id - DeviceId int64 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id - Seq int64 `protobuf:"varint,3,opt,name=seq,proto3" json:"seq,omitempty"` // 客户端已经同步的序列号 -} - -func (x *SyncReq) Reset() { - *x = SyncReq{} - if protoimpl.UnsafeEnabled { - mi := &file_logic_int_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SyncReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SyncReq) ProtoMessage() {} - -func (x *SyncReq) ProtoReflect() protoreflect.Message { - mi := &file_logic_int_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 SyncReq.ProtoReflect.Descriptor instead. -func (*SyncReq) Descriptor() ([]byte, []int) { - return file_logic_int_proto_rawDescGZIP(), []int{1} -} - -func (x *SyncReq) GetUserId() int64 { - if x != nil { - return x.UserId - } - return 0 -} - -func (x *SyncReq) GetDeviceId() int64 { - if x != nil { - return x.DeviceId - } - return 0 -} - -func (x *SyncReq) GetSeq() int64 { - if x != nil { - return x.Seq - } - return 0 -} - -type SyncResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` // 消息列表 - HasMore bool `protobuf:"varint,2,opt,name=has_more,json=hasMore,proto3" json:"has_more,omitempty"` // 是否有更多数据 -} - -func (x *SyncResp) Reset() { - *x = SyncResp{} - if protoimpl.UnsafeEnabled { - mi := &file_logic_int_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SyncResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SyncResp) ProtoMessage() {} - -func (x *SyncResp) ProtoReflect() protoreflect.Message { - mi := &file_logic_int_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 SyncResp.ProtoReflect.Descriptor instead. -func (*SyncResp) Descriptor() ([]byte, []int) { - return file_logic_int_proto_rawDescGZIP(), []int{2} -} - -func (x *SyncResp) GetMessages() []*Message { - if x != nil { - return x.Messages - } - return nil -} - -func (x *SyncResp) GetHasMore() bool { - if x != nil { - return x.HasMore - } - return false -} - -type MessageACKReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户id - DeviceId int64 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id - DeviceAck int64 `protobuf:"varint,3,opt,name=device_ack,json=deviceAck,proto3" json:"device_ack,omitempty"` // 设备收到消息的确认号 - ReceiveTime int64 `protobuf:"varint,4,opt,name=receive_time,json=receiveTime,proto3" json:"receive_time,omitempty"` // 消息接收时间戳,精确到毫秒 -} - -func (x *MessageACKReq) Reset() { - *x = MessageACKReq{} - if protoimpl.UnsafeEnabled { - mi := &file_logic_int_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageACKReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageACKReq) ProtoMessage() {} - -func (x *MessageACKReq) ProtoReflect() protoreflect.Message { - mi := &file_logic_int_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 MessageACKReq.ProtoReflect.Descriptor instead. -func (*MessageACKReq) Descriptor() ([]byte, []int) { - return file_logic_int_proto_rawDescGZIP(), []int{3} -} - -func (x *MessageACKReq) GetUserId() int64 { - if x != nil { - return x.UserId - } - return 0 -} - -func (x *MessageACKReq) GetDeviceId() int64 { - if x != nil { - return x.DeviceId - } - return 0 -} - -func (x *MessageACKReq) GetDeviceAck() int64 { - if x != nil { - return x.DeviceAck - } - return 0 -} - -func (x *MessageACKReq) GetReceiveTime() int64 { - if x != nil { - return x.ReceiveTime - } - return 0 -} - -type OfflineReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户id - DeviceId int64 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id - ClientAddr string `protobuf:"bytes,3,opt,name=client_addr,json=clientAddr,proto3" json:"client_addr,omitempty"` // 客户端地址 -} - -func (x *OfflineReq) Reset() { - *x = OfflineReq{} - if protoimpl.UnsafeEnabled { - mi := &file_logic_int_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OfflineReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OfflineReq) ProtoMessage() {} - -func (x *OfflineReq) ProtoReflect() protoreflect.Message { - mi := &file_logic_int_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 OfflineReq.ProtoReflect.Descriptor instead. -func (*OfflineReq) Descriptor() ([]byte, []int) { - return file_logic_int_proto_rawDescGZIP(), []int{4} -} - -func (x *OfflineReq) GetUserId() int64 { - if x != nil { - return x.UserId - } - return 0 -} - -func (x *OfflineReq) GetDeviceId() int64 { - if x != nil { - return x.DeviceId - } - return 0 -} - -func (x *OfflineReq) GetClientAddr() string { - if x != nil { - return x.ClientAddr - } - return "" -} - -type SubscribeRoomReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户id - DeviceId int64 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id - RoomId int64 `protobuf:"varint,3,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` // 房间id - Seq int64 `protobuf:"varint,4,opt,name=seq,proto3" json:"seq,omitempty"` // 消息序列号 - ConnAddr string `protobuf:"bytes,5,opt,name=conn_addr,json=connAddr,proto3" json:"conn_addr,omitempty"` // 服务器地址 -} - -func (x *SubscribeRoomReq) Reset() { - *x = SubscribeRoomReq{} - if protoimpl.UnsafeEnabled { - mi := &file_logic_int_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SubscribeRoomReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubscribeRoomReq) ProtoMessage() {} - -func (x *SubscribeRoomReq) ProtoReflect() protoreflect.Message { - mi := &file_logic_int_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 SubscribeRoomReq.ProtoReflect.Descriptor instead. -func (*SubscribeRoomReq) Descriptor() ([]byte, []int) { - return file_logic_int_proto_rawDescGZIP(), []int{5} -} - -func (x *SubscribeRoomReq) GetUserId() int64 { - if x != nil { - return x.UserId - } - return 0 -} - -func (x *SubscribeRoomReq) GetDeviceId() int64 { - if x != nil { - return x.DeviceId - } - return 0 -} - -func (x *SubscribeRoomReq) GetRoomId() int64 { - if x != nil { - return x.RoomId - } - return 0 -} - -func (x *SubscribeRoomReq) GetSeq() int64 { - if x != nil { - return x.Seq - } - return 0 -} - -func (x *SubscribeRoomReq) GetConnAddr() string { - if x != nil { - return x.ConnAddr - } - return "" -} - -type PushAllReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MessageType MessageType `protobuf:"varint,1,opt,name=message_type,json=messageType,proto3,enum=pb.MessageType" json:"message_type,omitempty"` // 消息类型 - MessageContent []byte `protobuf:"bytes,2,opt,name=message_content,json=messageContent,proto3" json:"message_content,omitempty"` // 消息内容 - SendTime int64 `protobuf:"varint,3,opt,name=send_time,json=sendTime,proto3" json:"send_time,omitempty"` // 消息发送时间戳,精确到毫秒 -} - -func (x *PushAllReq) Reset() { - *x = PushAllReq{} - if protoimpl.UnsafeEnabled { - mi := &file_logic_int_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PushAllReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PushAllReq) ProtoMessage() {} - -func (x *PushAllReq) ProtoReflect() protoreflect.Message { - mi := &file_logic_int_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 PushAllReq.ProtoReflect.Descriptor instead. -func (*PushAllReq) Descriptor() ([]byte, []int) { - return file_logic_int_proto_rawDescGZIP(), []int{6} -} - -func (x *PushAllReq) GetMessageType() MessageType { - if x != nil { - return x.MessageType - } - return MessageType_MT_UNKNOWN -} - -func (x *PushAllReq) GetMessageContent() []byte { - if x != nil { - return x.MessageContent - } - return nil -} - -func (x *PushAllReq) GetSendTime() int64 { - if x != nil { - return x.SendTime - } - return 0 -} - -type GetDeviceReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DeviceId int64 `protobuf:"varint,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` -} - -func (x *GetDeviceReq) Reset() { - *x = GetDeviceReq{} - if protoimpl.UnsafeEnabled { - mi := &file_logic_int_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetDeviceReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetDeviceReq) ProtoMessage() {} - -func (x *GetDeviceReq) ProtoReflect() protoreflect.Message { - mi := &file_logic_int_proto_msgTypes[7] - 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 GetDeviceReq.ProtoReflect.Descriptor instead. -func (*GetDeviceReq) Descriptor() ([]byte, []int) { - return file_logic_int_proto_rawDescGZIP(), []int{7} -} - -func (x *GetDeviceReq) GetDeviceId() int64 { - if x != nil { - return x.DeviceId - } - return 0 -} - -type GetDeviceResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Device *Device `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"` -} - -func (x *GetDeviceResp) Reset() { - *x = GetDeviceResp{} - if protoimpl.UnsafeEnabled { - mi := &file_logic_int_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetDeviceResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetDeviceResp) ProtoMessage() {} - -func (x *GetDeviceResp) ProtoReflect() protoreflect.Message { - mi := &file_logic_int_proto_msgTypes[8] - 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 GetDeviceResp.ProtoReflect.Descriptor instead. -func (*GetDeviceResp) Descriptor() ([]byte, []int) { - return file_logic_int_proto_rawDescGZIP(), []int{8} -} - -func (x *GetDeviceResp) GetDevice() *Device { - if x != nil { - return x.Device - } - return nil -} - -type Device struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DeviceId int64 `protobuf:"varint,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id - UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户id - Type int32 `protobuf:"varint,3,opt,name=type,proto3" json:"type,omitempty"` // 设备类型,1:Android;2:IOS;3:Windows; 4:MacOS;5:Web - Brand string `protobuf:"bytes,4,opt,name=brand,proto3" json:"brand,omitempty"` // 手机厂商 - Model string `protobuf:"bytes,5,opt,name=model,proto3" json:"model,omitempty"` // 机型 - SystemVersion string `protobuf:"bytes,6,opt,name=system_version,json=systemVersion,proto3" json:"system_version,omitempty"` // 系统版本 - SdkVersion string `protobuf:"bytes,7,opt,name=sdk_version,json=sdkVersion,proto3" json:"sdk_version,omitempty"` // SDK版本 - Status int32 `protobuf:"varint,8,opt,name=status,proto3" json:"status,omitempty"` // 在线状态,0:不在线;1:在线 - ConnAddr string `protobuf:"bytes,9,opt,name=conn_addr,json=connAddr,proto3" json:"conn_addr,omitempty"` // 服务端连接地址 - ClientAddr string `protobuf:"bytes,10,opt,name=client_addr,json=clientAddr,proto3" json:"client_addr,omitempty"` // 客户端地址 - CreateTime int64 `protobuf:"varint,11,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` // 创建时间 - UpdateTime int64 `protobuf:"varint,12,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` // 更新时间 -} - -func (x *Device) Reset() { - *x = Device{} - if protoimpl.UnsafeEnabled { - mi := &file_logic_int_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Device) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Device) ProtoMessage() {} - -func (x *Device) ProtoReflect() protoreflect.Message { - mi := &file_logic_int_proto_msgTypes[9] - 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 Device.ProtoReflect.Descriptor instead. -func (*Device) Descriptor() ([]byte, []int) { - return file_logic_int_proto_rawDescGZIP(), []int{9} -} - -func (x *Device) GetDeviceId() int64 { - if x != nil { - return x.DeviceId - } - return 0 -} - -func (x *Device) GetUserId() int64 { - if x != nil { - return x.UserId - } - return 0 -} - -func (x *Device) GetType() int32 { - if x != nil { - return x.Type - } - return 0 -} - -func (x *Device) GetBrand() string { - if x != nil { - return x.Brand - } - return "" -} - -func (x *Device) GetModel() string { - if x != nil { - return x.Model - } - return "" -} - -func (x *Device) GetSystemVersion() string { - if x != nil { - return x.SystemVersion - } - return "" -} - -func (x *Device) GetSdkVersion() string { - if x != nil { - return x.SdkVersion - } - return "" -} - -func (x *Device) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -func (x *Device) GetConnAddr() string { - if x != nil { - return x.ConnAddr - } - return "" -} - -func (x *Device) GetClientAddr() string { - if x != nil { - return x.ClientAddr - } - return "" -} - -func (x *Device) GetCreateTime() int64 { - if x != nil { - return x.CreateTime - } - return 0 -} - -func (x *Device) GetUpdateTime() int64 { - if x != nil { - return x.UpdateTime - } - return 0 -} - -type ServerStopReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnAddr string `protobuf:"bytes,1,opt,name=conn_addr,json=connAddr,proto3" json:"conn_addr,omitempty"` -} - -func (x *ServerStopReq) Reset() { - *x = ServerStopReq{} - if protoimpl.UnsafeEnabled { - mi := &file_logic_int_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServerStopReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServerStopReq) ProtoMessage() {} - -func (x *ServerStopReq) ProtoReflect() protoreflect.Message { - mi := &file_logic_int_proto_msgTypes[10] - 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 ServerStopReq.ProtoReflect.Descriptor instead. -func (*ServerStopReq) Descriptor() ([]byte, []int) { - return file_logic_int_proto_rawDescGZIP(), []int{10} -} - -func (x *ServerStopReq) GetConnAddr() string { - if x != nil { - return x.ConnAddr - } - return "" -} - -var File_logic_int_proto protoreflect.FileDescriptor - -var file_logic_int_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x2e, 0x69, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x65, 0x78, - 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x6c, 0x6f, 0x67, 0x69, - 0x63, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x99, 0x01, 0x0a, 0x0d, - 0x43, 0x6f, 0x6e, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, - 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, - 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, - 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, - 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, - 0x6e, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x22, 0x51, 0x0a, 0x07, 0x53, 0x79, 0x6e, 0x63, 0x52, - 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x64, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, - 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x73, 0x65, 0x71, 0x22, 0x4e, 0x0a, 0x08, 0x53, 0x79, - 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x12, 0x27, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, - 0x19, 0x0a, 0x08, 0x68, 0x61, 0x73, 0x5f, 0x6d, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x07, 0x68, 0x61, 0x73, 0x4d, 0x6f, 0x72, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x0d, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x43, 0x4b, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, - 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, - 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x61, 0x63, 0x6b, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x41, 0x63, - 0x6b, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x5f, 0x74, 0x69, 0x6d, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, - 0x54, 0x69, 0x6d, 0x65, 0x22, 0x63, 0x0a, 0x0a, 0x4f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x52, - 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x64, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, - 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x22, 0x90, 0x01, 0x0a, 0x10, 0x53, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x17, - 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, - 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, - 0x63, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x10, 0x0a, - 0x03, 0x73, 0x65, 0x71, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x73, 0x65, 0x71, 0x12, - 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x22, 0x86, 0x01, 0x0a, - 0x0a, 0x50, 0x75, 0x73, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x32, 0x0a, 0x0c, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x27, 0x0a, 0x0f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x64, - 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x6e, - 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x2b, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, - 0x63, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x49, 0x64, 0x22, 0x33, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, - 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0xde, 0x02, 0x0a, 0x06, 0x44, 0x65, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, - 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x62, 0x72, 0x61, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x72, 0x61, - 0x6e, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x79, 0x73, 0x74, - 0x65, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0d, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x1f, 0x0a, 0x0b, 0x73, 0x64, 0x6b, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x64, 0x6b, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x6e, - 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, - 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x2c, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, - 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, - 0x6e, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x32, 0xc1, 0x03, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x63, - 0x49, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x49, - 0x6e, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x49, - 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, - 0x21, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x79, 0x6e, - 0x63, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x2a, 0x0a, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x43, 0x4b, - 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x43, 0x4b, - 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x24, - 0x0a, 0x07, 0x4f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4f, - 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x12, 0x30, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, - 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x62, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x36, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x53, - 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, - 0x0a, 0x08, 0x50, 0x75, 0x73, 0x68, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x0f, 0x2e, 0x70, 0x62, 0x2e, - 0x50, 0x75, 0x73, 0x68, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x24, 0x0a, 0x07, 0x50, 0x75, 0x73, 0x68, 0x41, 0x6c, - 0x6c, 0x12, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, - 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x30, 0x0a, 0x09, - 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x47, - 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x70, 0x62, - 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2a, - 0x0a, 0x0a, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x11, 0x2e, 0x70, - 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x1a, - 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x0d, 0x5a, 0x0b, 0x67, 0x69, - 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_logic_int_proto_rawDescOnce sync.Once - file_logic_int_proto_rawDescData = file_logic_int_proto_rawDesc -) - -func file_logic_int_proto_rawDescGZIP() []byte { - file_logic_int_proto_rawDescOnce.Do(func() { - file_logic_int_proto_rawDescData = protoimpl.X.CompressGZIP(file_logic_int_proto_rawDescData) - }) - return file_logic_int_proto_rawDescData -} - -var file_logic_int_proto_msgTypes = make([]protoimpl.MessageInfo, 11) -var file_logic_int_proto_goTypes = []interface{}{ - (*ConnSignInReq)(nil), // 0: pb.ConnSignInReq - (*SyncReq)(nil), // 1: pb.SyncReq - (*SyncResp)(nil), // 2: pb.SyncResp - (*MessageACKReq)(nil), // 3: pb.MessageACKReq - (*OfflineReq)(nil), // 4: pb.OfflineReq - (*SubscribeRoomReq)(nil), // 5: pb.SubscribeRoomReq - (*PushAllReq)(nil), // 6: pb.PushAllReq - (*GetDeviceReq)(nil), // 7: pb.GetDeviceReq - (*GetDeviceResp)(nil), // 8: pb.GetDeviceResp - (*Device)(nil), // 9: pb.Device - (*ServerStopReq)(nil), // 10: pb.ServerStopReq - (*Message)(nil), // 11: pb.Message - (MessageType)(0), // 12: pb.MessageType - (*SendMessageReq)(nil), // 13: pb.SendMessageReq - (*PushRoomReq)(nil), // 14: pb.PushRoomReq - (*Empty)(nil), // 15: pb.Empty - (*SendMessageResp)(nil), // 16: pb.SendMessageResp -} -var file_logic_int_proto_depIdxs = []int32{ - 11, // 0: pb.SyncResp.messages:type_name -> pb.Message - 12, // 1: pb.PushAllReq.message_type:type_name -> pb.MessageType - 9, // 2: pb.GetDeviceResp.device:type_name -> pb.Device - 0, // 3: pb.LogicInt.ConnSignIn:input_type -> pb.ConnSignInReq - 1, // 4: pb.LogicInt.Sync:input_type -> pb.SyncReq - 3, // 5: pb.LogicInt.MessageACK:input_type -> pb.MessageACKReq - 4, // 6: pb.LogicInt.Offline:input_type -> pb.OfflineReq - 5, // 7: pb.LogicInt.SubscribeRoom:input_type -> pb.SubscribeRoomReq - 13, // 8: pb.LogicInt.SendMessage:input_type -> pb.SendMessageReq - 14, // 9: pb.LogicInt.PushRoom:input_type -> pb.PushRoomReq - 6, // 10: pb.LogicInt.PushAll:input_type -> pb.PushAllReq - 7, // 11: pb.LogicInt.GetDevice:input_type -> pb.GetDeviceReq - 10, // 12: pb.LogicInt.ServerStop:input_type -> pb.ServerStopReq - 15, // 13: pb.LogicInt.ConnSignIn:output_type -> pb.Empty - 2, // 14: pb.LogicInt.Sync:output_type -> pb.SyncResp - 15, // 15: pb.LogicInt.MessageACK:output_type -> pb.Empty - 15, // 16: pb.LogicInt.Offline:output_type -> pb.Empty - 15, // 17: pb.LogicInt.SubscribeRoom:output_type -> pb.Empty - 16, // 18: pb.LogicInt.SendMessage:output_type -> pb.SendMessageResp - 15, // 19: pb.LogicInt.PushRoom:output_type -> pb.Empty - 15, // 20: pb.LogicInt.PushAll:output_type -> pb.Empty - 8, // 21: pb.LogicInt.GetDevice:output_type -> pb.GetDeviceResp - 15, // 22: pb.LogicInt.ServerStop:output_type -> pb.Empty - 13, // [13:23] is the sub-list for method output_type - 3, // [3:13] 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_logic_int_proto_init() } -func file_logic_int_proto_init() { - if File_logic_int_proto != nil { - return - } - file_common_ext_proto_init() - file_connect_ext_proto_init() - file_logic_ext_proto_init() - if !protoimpl.UnsafeEnabled { - file_logic_int_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConnSignInReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_logic_int_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_logic_int_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_logic_int_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageACKReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_logic_int_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OfflineReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_logic_int_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SubscribeRoomReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_logic_int_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PushAllReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_logic_int_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetDeviceReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_logic_int_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetDeviceResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_logic_int_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Device); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_logic_int_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServerStopReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_logic_int_proto_rawDesc, - NumEnums: 0, - NumMessages: 11, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_logic_int_proto_goTypes, - DependencyIndexes: file_logic_int_proto_depIdxs, - MessageInfos: file_logic_int_proto_msgTypes, - }.Build() - File_logic_int_proto = out.File - file_logic_int_proto_rawDesc = nil - file_logic_int_proto_goTypes = nil - file_logic_int_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// LogicIntClient is the client API for LogicInt service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type LogicIntClient interface { - // 登录 - ConnSignIn(ctx context.Context, in *ConnSignInReq, opts ...grpc.CallOption) (*Empty, error) - // 消息同步 - Sync(ctx context.Context, in *SyncReq, opts ...grpc.CallOption) (*SyncResp, error) - // 设备收到消息回执 - MessageACK(ctx context.Context, in *MessageACKReq, opts ...grpc.CallOption) (*Empty, error) - // 设备离线 - Offline(ctx context.Context, in *OfflineReq, opts ...grpc.CallOption) (*Empty, error) - // 订阅房间 - SubscribeRoom(ctx context.Context, in *SubscribeRoomReq, opts ...grpc.CallOption) (*Empty, error) - // 发送消息 - SendMessage(ctx context.Context, in *SendMessageReq, opts ...grpc.CallOption) (*SendMessageResp, error) - // 推送消息到房间 - PushRoom(ctx context.Context, in *PushRoomReq, opts ...grpc.CallOption) (*Empty, error) - // 全服推送 - PushAll(ctx context.Context, in *PushAllReq, opts ...grpc.CallOption) (*Empty, error) - // 获取设备信息 - GetDevice(ctx context.Context, in *GetDeviceReq, opts ...grpc.CallOption) (*GetDeviceResp, error) - // 服务停止 - ServerStop(ctx context.Context, in *ServerStopReq, opts ...grpc.CallOption) (*Empty, error) -} - -type logicIntClient struct { - cc grpc.ClientConnInterface -} - -func NewLogicIntClient(cc grpc.ClientConnInterface) LogicIntClient { - return &logicIntClient{cc} -} - -func (c *logicIntClient) ConnSignIn(ctx context.Context, in *ConnSignInReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.LogicInt/ConnSignIn", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicIntClient) Sync(ctx context.Context, in *SyncReq, opts ...grpc.CallOption) (*SyncResp, error) { - out := new(SyncResp) - err := c.cc.Invoke(ctx, "/pb.LogicInt/Sync", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicIntClient) MessageACK(ctx context.Context, in *MessageACKReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.LogicInt/MessageACK", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicIntClient) Offline(ctx context.Context, in *OfflineReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.LogicInt/Offline", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicIntClient) SubscribeRoom(ctx context.Context, in *SubscribeRoomReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.LogicInt/SubscribeRoom", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicIntClient) SendMessage(ctx context.Context, in *SendMessageReq, opts ...grpc.CallOption) (*SendMessageResp, error) { - out := new(SendMessageResp) - err := c.cc.Invoke(ctx, "/pb.LogicInt/SendMessage", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicIntClient) PushRoom(ctx context.Context, in *PushRoomReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.LogicInt/PushRoom", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicIntClient) PushAll(ctx context.Context, in *PushAllReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.LogicInt/PushAll", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicIntClient) GetDevice(ctx context.Context, in *GetDeviceReq, opts ...grpc.CallOption) (*GetDeviceResp, error) { - out := new(GetDeviceResp) - err := c.cc.Invoke(ctx, "/pb.LogicInt/GetDevice", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicIntClient) ServerStop(ctx context.Context, in *ServerStopReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.LogicInt/ServerStop", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// LogicIntServer is the server API for LogicInt service. -type LogicIntServer interface { - // 登录 - ConnSignIn(context.Context, *ConnSignInReq) (*Empty, error) - // 消息同步 - Sync(context.Context, *SyncReq) (*SyncResp, error) - // 设备收到消息回执 - MessageACK(context.Context, *MessageACKReq) (*Empty, error) - // 设备离线 - Offline(context.Context, *OfflineReq) (*Empty, error) - // 订阅房间 - SubscribeRoom(context.Context, *SubscribeRoomReq) (*Empty, error) - // 发送消息 - SendMessage(context.Context, *SendMessageReq) (*SendMessageResp, error) - // 推送消息到房间 - PushRoom(context.Context, *PushRoomReq) (*Empty, error) - // 全服推送 - PushAll(context.Context, *PushAllReq) (*Empty, error) - // 获取设备信息 - GetDevice(context.Context, *GetDeviceReq) (*GetDeviceResp, error) - // 服务停止 - ServerStop(context.Context, *ServerStopReq) (*Empty, error) -} - -// UnimplementedLogicIntServer can be embedded to have forward compatible implementations. -type UnimplementedLogicIntServer struct { -} - -func (*UnimplementedLogicIntServer) ConnSignIn(context.Context, *ConnSignInReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConnSignIn not implemented") -} -func (*UnimplementedLogicIntServer) Sync(context.Context, *SyncReq) (*SyncResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented") -} -func (*UnimplementedLogicIntServer) MessageACK(context.Context, *MessageACKReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method MessageACK not implemented") -} -func (*UnimplementedLogicIntServer) Offline(context.Context, *OfflineReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method Offline not implemented") -} -func (*UnimplementedLogicIntServer) SubscribeRoom(context.Context, *SubscribeRoomReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method SubscribeRoom not implemented") -} -func (*UnimplementedLogicIntServer) SendMessage(context.Context, *SendMessageReq) (*SendMessageResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method SendMessage not implemented") -} -func (*UnimplementedLogicIntServer) PushRoom(context.Context, *PushRoomReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method PushRoom not implemented") -} -func (*UnimplementedLogicIntServer) PushAll(context.Context, *PushAllReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method PushAll not implemented") -} -func (*UnimplementedLogicIntServer) GetDevice(context.Context, *GetDeviceReq) (*GetDeviceResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetDevice not implemented") -} -func (*UnimplementedLogicIntServer) ServerStop(context.Context, *ServerStopReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method ServerStop not implemented") -} - -func RegisterLogicIntServer(s *grpc.Server, srv LogicIntServer) { - s.RegisterService(&_LogicInt_serviceDesc, srv) -} - -func _LogicInt_ConnSignIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ConnSignInReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicIntServer).ConnSignIn(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicInt/ConnSignIn", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicIntServer).ConnSignIn(ctx, req.(*ConnSignInReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicInt_Sync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SyncReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicIntServer).Sync(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicInt/Sync", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicIntServer).Sync(ctx, req.(*SyncReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicInt_MessageACK_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MessageACKReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicIntServer).MessageACK(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicInt/MessageACK", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicIntServer).MessageACK(ctx, req.(*MessageACKReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicInt_Offline_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OfflineReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicIntServer).Offline(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicInt/Offline", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicIntServer).Offline(ctx, req.(*OfflineReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicInt_SubscribeRoom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SubscribeRoomReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicIntServer).SubscribeRoom(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicInt/SubscribeRoom", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicIntServer).SubscribeRoom(ctx, req.(*SubscribeRoomReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicInt_SendMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SendMessageReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicIntServer).SendMessage(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicInt/SendMessage", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicIntServer).SendMessage(ctx, req.(*SendMessageReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicInt_PushRoom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PushRoomReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicIntServer).PushRoom(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicInt/PushRoom", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicIntServer).PushRoom(ctx, req.(*PushRoomReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicInt_PushAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PushAllReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicIntServer).PushAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicInt/PushAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicIntServer).PushAll(ctx, req.(*PushAllReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicInt_GetDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetDeviceReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicIntServer).GetDevice(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicInt/GetDevice", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicIntServer).GetDevice(ctx, req.(*GetDeviceReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicInt_ServerStop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ServerStopReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicIntServer).ServerStop(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicInt/ServerStop", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicIntServer).ServerStop(ctx, req.(*ServerStopReq)) - } - return interceptor(ctx, in, info, handler) -} - -var _LogicInt_serviceDesc = grpc.ServiceDesc{ - ServiceName: "pb.LogicInt", - HandlerType: (*LogicIntServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ConnSignIn", - Handler: _LogicInt_ConnSignIn_Handler, - }, - { - MethodName: "Sync", - Handler: _LogicInt_Sync_Handler, - }, - { - MethodName: "MessageACK", - Handler: _LogicInt_MessageACK_Handler, - }, - { - MethodName: "Offline", - Handler: _LogicInt_Offline_Handler, - }, - { - MethodName: "SubscribeRoom", - Handler: _LogicInt_SubscribeRoom_Handler, - }, - { - MethodName: "SendMessage", - Handler: _LogicInt_SendMessage_Handler, - }, - { - MethodName: "PushRoom", - Handler: _LogicInt_PushRoom_Handler, - }, - { - MethodName: "PushAll", - Handler: _LogicInt_PushAll_Handler, - }, - { - MethodName: "GetDevice", - Handler: _LogicInt_GetDevice_Handler, - }, - { - MethodName: "ServerStop", - Handler: _LogicInt_ServerStop_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "logic.int.proto", -} diff --git a/pkg/proto/common.ext.proto b/pkg/proto/common.ext.proto deleted file mode 100644 index 62448cb8..00000000 --- a/pkg/proto/common.ext.proto +++ /dev/null @@ -1,5 +0,0 @@ -syntax = "proto3"; -package pb; -option go_package = "gim/pkg/pb/"; - -message Empty{} \ No newline at end of file diff --git a/pkg/proto/connect.ext.proto b/pkg/proto/connect.ext.proto deleted file mode 100644 index 92f01e68..00000000 --- a/pkg/proto/connect.ext.proto +++ /dev/null @@ -1,174 +0,0 @@ -syntax = "proto3"; -package pb; -option go_package = "gim/pkg/pb/"; - -enum PackageType { - PT_UNKNOWN = 0; // 未知 - PT_SIGN_IN = 1; // 设备登录请求 - PT_SYNC = 2; // 消息同步触发 - PT_HEARTBEAT = 3; // 心跳 - PT_MESSAGE = 4; // 消息投递 - PT_SUBSCRIBE_ROOM = 5; // 订阅房间 -} - -/************************************消息体定义开始************************************/ -// 单条消息投递内容(估算大约100个字节),todo 通知栏提醒 -message Message { - Sender sender = 1; // 发送者 - ReceiverType receiver_type = 2; // 接收者类型,1:user;2:group - int64 receiver_id = 3; // 用户id或者群组id - repeated int64 to_user_ids = 4; // 需要@的用户id列表 - MessageType message_type = 5; // 消息类型 - bytes message_content = 6; // 消息内容 - int64 seq = 7; // 用户消息发送序列号 - int64 send_time = 8; // 消息发送时间戳,精确到毫秒 - MessageStatus status = 9; // 消息状态 -} - -message Sender { - SenderType sender_type = 1; // 发送者类型,1:系统,2:用户,3:第三方业务系统 - int64 sender_id = 2; // 发送者id - int64 device_id = 3; // 发送者设备id - string avatar_url = 4; // 昵称 - string nickname = 5; // 头像 - string extra = 6; // 扩展字段 -} - -// 消息类型 -enum MessageType { - MT_UNKNOWN = 0; // 未知 - MT_TEXT = 1; // 文本 - MT_FACE = 2; // 表情 - MT_VOICE = 3; // 语音消息 - MT_IMAGE = 4; // 图片 - MT_FILE = 5; // 文件 - MT_LOCATION = 6; // 地理位置 - MT_COMMAND = 7; // 指令推送 - MT_CUSTOM = 8; // 自定义 -} - -// 文本消息 -message Text { - string text = 1; // 文本消息内容 -} - -// 表情消息 -message Face { - int64 face_id = 1; - string face_url = 2; -} - -// 语音消息 -message Voice { - string id = 1; // 语音包id - int32 size = 2; // 语音包大小 - int32 duration = 3; // 语音时长 - string url = 4; // 语音文件URL -} - -// 图片消息 -message Image { - string id = 1; // 图片id - int32 width = 2; // 图片宽度 - int32 height = 3; // 图片长度 - string url = 4; // 图片URL - string thumbnail_url = 5; // 图片缩略图url -} - -// 文件消息 -message File { - int64 id = 12; // 文件id - string name = 13; // 文件名 - int64 size = 14; // 文件大小 - string url = 15; // 文件url -} - -// 地理位置消息 -message Location { - string desc = 1; // 描述 - double latitude = 2; // 经度 - double longitude = 3; // 纬度 -} - -// Command 指令推送,1000以下,IM内部用,1000以上,留给业务用 -message Command { - int32 code = 1; // 指令码 - bytes data = 2; // 数据内容 -} - -// 自定义消息 -message Custom { - string data = 1; // 自定义数据 -} - -/************************************消息体定义结束************************************/ - -// 上行数据 -message Input { - PackageType type = 1; // 包的类型 - int64 request_id = 2; // 请求id - bytes data = 3; // 数据 -} - -// 下行数据 -message Output { - PackageType type = 1; // 包的类型 - int64 request_id = 2; // 请求id - int32 code = 3; // 错误码 - string message = 4; // 错误信息 - bytes data = 5; // 数据 -} - -// 设备登录,package_type:1 -message SignInInput { - int64 device_id = 1; // 设备id - int64 user_id = 2; // 用户id - string token = 3; // 秘钥 -} - -// 消息同步请求,package_type:2 -message SyncInput { - int64 seq = 1; // 客户端已经同步的序列号 -} -// 消息同步响应,package_type:2 -message SyncOutput { - repeated Message messages = 1; // 消息列表 - bool has_more = 2; // 是否有更多数据 -} - -// 订阅房间请求 -message SubscribeRoomInput { - int64 room_id = 1; // 房间ID,如果为0,取消房间订阅 - int64 seq = 2; // 消息消息序列号, -} - -enum ReceiverType { - RT_UNKNOWN = 0; // 未知 - RT_USER = 1; // 用户 - RT_GROUP = 2; // 群组 - RT_ROOM = 3; // 房间 -} - -// 消息投递,package_type:4 -message MessageSend { - Message message = 1; // 消息 -} - -enum SenderType { - ST_UNKNOWN = 0; // 未知的 - ST_SYSTEM = 1; // IM系统 - ST_USER = 2; // 用户 - ST_BUSINESS = 3; // 业务方 -} - -enum MessageStatus { - MS_UNKNOWN = 0; // 未知的 - MS_NORMAL = 1; // 正常的 - MS_RECALL = 2; // 撤回 -} - -// 投递消息回执,package_type:4 -message MessageACK { - int64 device_ack = 2; // 设备收到消息的确认号 - int64 receive_time = 3; // 消息接收时间戳,精确到毫秒 -} diff --git a/pkg/proto/connect.int.proto b/pkg/proto/connect.int.proto deleted file mode 100644 index 5a48b6e4..00000000 --- a/pkg/proto/connect.int.proto +++ /dev/null @@ -1,28 +0,0 @@ -syntax = "proto3"; -package pb; -option go_package = "gim/pkg/pb/"; - -import "common.ext.proto"; -import "connect.ext.proto"; - -service ConnectInt { - // 消息投递 - rpc DeliverMessage (DeliverMessageReq) returns (Empty); -} - -message DeliverMessageReq { - int64 device_id = 1; // 设备id - MessageSend message_send = 2; // 数据 -} - -// 房间推送 -message PushRoomMsg{ - int64 room_id = 1; // 设备id - MessageSend message_send = 2; // 数据 -} - -// 房间推送 -message PushAllMsg{ - MessageSend message_send = 2; // 数据 -} - diff --git a/pkg/pb/business.ext.pb.go b/pkg/protocol/pb/business.ext.pb.go similarity index 58% rename from pkg/pb/business.ext.pb.go rename to pkg/protocol/pb/business.ext.pb.go index 89efea23..9d0fa9b2 100644 --- a/pkg/pb/business.ext.pb.go +++ b/pkg/protocol/pb/business.ext.pb.go @@ -1,18 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.14.0 +// protoc-gen-go v1.28.1 +// protoc v3.21.9 // source: business.ext.proto package pb import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" reflect "reflect" sync "sync" ) @@ -508,63 +505,65 @@ var File_business_ext_proto protoreflect.FileDescriptor var file_business_ext_proto_rawDesc = []byte{ 0x0a, 0x12, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, - 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5f, 0x0a, 0x09, 0x53, 0x69, - 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, - 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, - 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, - 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1b, - 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0x52, 0x0a, 0x0a, 0x53, - 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x15, 0x0a, 0x06, 0x69, 0x73, 0x5f, - 0x6e, 0x65, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x4e, 0x65, 0x77, - 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, - 0xc4, 0x01, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, - 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, - 0x03, 0x73, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x73, 0x65, 0x78, 0x12, - 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x14, - 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, - 0x78, 0x74, 0x72, 0x61, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, - 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, - 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x25, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, - 0x72, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x2b, 0x0a, - 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x04, - 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, - 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x72, 0x0a, 0x0d, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x6e, - 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, - 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x73, 0x65, 0x78, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, - 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, - 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, - 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x21, - 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x22, 0x30, 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, - 0x65, 0x72, 0x73, 0x32, 0xc3, 0x01, 0x0a, 0x0b, 0x42, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, - 0x45, 0x78, 0x74, 0x12, 0x27, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x12, 0x0d, 0x2e, - 0x70, 0x62, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x70, - 0x62, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2a, 0x0a, 0x07, - 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, - 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, - 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2a, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x12, 0x33, 0x0a, 0x0a, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, - 0x65, 0x72, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, - 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, - 0x68, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x42, 0x0d, 0x5a, 0x0b, 0x67, 0x69, 0x6d, - 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5f, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, + 0x65, 0x71, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0x52, 0x0a, 0x0a, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x15, 0x0a, 0x06, 0x69, 0x73, 0x5f, 0x6e, 0x65, 0x77, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x4e, 0x65, 0x77, 0x12, 0x17, 0x0a, 0x07, 0x75, + 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, + 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xc4, 0x01, 0x0a, 0x04, 0x55, + 0x73, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, + 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x73, 0x65, 0x78, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, + 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, + 0x72, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x12, + 0x1f, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, + 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, + 0x65, 0x22, 0x25, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, + 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x2b, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x72, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x03, 0x73, 0x65, 0x78, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, + 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, + 0x55, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x21, 0x0a, 0x0d, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x30, 0x0a, 0x0e, + 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, + 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, + 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x32, 0xd0, + 0x01, 0x0a, 0x0b, 0x42, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x45, 0x78, 0x74, 0x12, 0x27, + 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x12, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2a, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, + 0x65, 0x72, 0x12, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x12, 0x37, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x33, 0x0a, 0x0a, + 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, + 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, + 0x70, 0x62, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x42, 0x15, 0x5a, 0x13, 0x67, 0x69, 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -589,7 +588,7 @@ var file_business_ext_proto_goTypes = []interface{}{ (*UpdateUserReq)(nil), // 5: pb.UpdateUserReq (*SearchUserReq)(nil), // 6: pb.SearchUserReq (*SearchUserResp)(nil), // 7: pb.SearchUserResp - (*Empty)(nil), // 8: pb.Empty + (*emptypb.Empty)(nil), // 8: google.protobuf.Empty } var file_business_ext_proto_depIdxs = []int32{ 2, // 0: pb.GetUserResp.user:type_name -> pb.User @@ -600,7 +599,7 @@ var file_business_ext_proto_depIdxs = []int32{ 6, // 5: pb.BusinessExt.SearchUser:input_type -> pb.SearchUserReq 1, // 6: pb.BusinessExt.SignIn:output_type -> pb.SignInResp 4, // 7: pb.BusinessExt.GetUser:output_type -> pb.GetUserResp - 8, // 8: pb.BusinessExt.UpdateUser:output_type -> pb.Empty + 8, // 8: pb.BusinessExt.UpdateUser:output_type -> google.protobuf.Empty 7, // 9: pb.BusinessExt.SearchUser:output_type -> pb.SearchUserResp 6, // [6:10] is the sub-list for method output_type 2, // [2:6] is the sub-list for method input_type @@ -614,7 +613,6 @@ func file_business_ext_proto_init() { if File_business_ext_proto != nil { return } - file_common_ext_proto_init() if !protoimpl.UnsafeEnabled { file_business_ext_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignInReq); i { @@ -732,199 +730,3 @@ func file_business_ext_proto_init() { file_business_ext_proto_goTypes = nil file_business_ext_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// BusinessExtClient is the client API for BusinessExt service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type BusinessExtClient interface { - // 登录 - SignIn(ctx context.Context, in *SignInReq, opts ...grpc.CallOption) (*SignInResp, error) - // 获取用户信息 - GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*GetUserResp, error) - // 更新用户信息 - UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*Empty, error) - // 搜索用户(这里简单数据库实现,生产环境建议使用ES) - SearchUser(ctx context.Context, in *SearchUserReq, opts ...grpc.CallOption) (*SearchUserResp, error) -} - -type businessExtClient struct { - cc grpc.ClientConnInterface -} - -func NewBusinessExtClient(cc grpc.ClientConnInterface) BusinessExtClient { - return &businessExtClient{cc} -} - -func (c *businessExtClient) SignIn(ctx context.Context, in *SignInReq, opts ...grpc.CallOption) (*SignInResp, error) { - out := new(SignInResp) - err := c.cc.Invoke(ctx, "/pb.BusinessExt/SignIn", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *businessExtClient) GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*GetUserResp, error) { - out := new(GetUserResp) - err := c.cc.Invoke(ctx, "/pb.BusinessExt/GetUser", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *businessExtClient) UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.BusinessExt/UpdateUser", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *businessExtClient) SearchUser(ctx context.Context, in *SearchUserReq, opts ...grpc.CallOption) (*SearchUserResp, error) { - out := new(SearchUserResp) - err := c.cc.Invoke(ctx, "/pb.BusinessExt/SearchUser", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// BusinessExtServer is the server API for BusinessExt service. -type BusinessExtServer interface { - // 登录 - SignIn(context.Context, *SignInReq) (*SignInResp, error) - // 获取用户信息 - GetUser(context.Context, *GetUserReq) (*GetUserResp, error) - // 更新用户信息 - UpdateUser(context.Context, *UpdateUserReq) (*Empty, error) - // 搜索用户(这里简单数据库实现,生产环境建议使用ES) - SearchUser(context.Context, *SearchUserReq) (*SearchUserResp, error) -} - -// UnimplementedBusinessExtServer can be embedded to have forward compatible implementations. -type UnimplementedBusinessExtServer struct { -} - -func (*UnimplementedBusinessExtServer) SignIn(context.Context, *SignInReq) (*SignInResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method SignIn not implemented") -} -func (*UnimplementedBusinessExtServer) GetUser(context.Context, *GetUserReq) (*GetUserResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented") -} -func (*UnimplementedBusinessExtServer) UpdateUser(context.Context, *UpdateUserReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateUser not implemented") -} -func (*UnimplementedBusinessExtServer) SearchUser(context.Context, *SearchUserReq) (*SearchUserResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method SearchUser not implemented") -} - -func RegisterBusinessExtServer(s *grpc.Server, srv BusinessExtServer) { - s.RegisterService(&_BusinessExt_serviceDesc, srv) -} - -func _BusinessExt_SignIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SignInReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BusinessExtServer).SignIn(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.BusinessExt/SignIn", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BusinessExtServer).SignIn(ctx, req.(*SignInReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _BusinessExt_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetUserReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BusinessExtServer).GetUser(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.BusinessExt/GetUser", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BusinessExtServer).GetUser(ctx, req.(*GetUserReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _BusinessExt_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateUserReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BusinessExtServer).UpdateUser(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.BusinessExt/UpdateUser", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BusinessExtServer).UpdateUser(ctx, req.(*UpdateUserReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _BusinessExt_SearchUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SearchUserReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BusinessExtServer).SearchUser(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.BusinessExt/SearchUser", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BusinessExtServer).SearchUser(ctx, req.(*SearchUserReq)) - } - return interceptor(ctx, in, info, handler) -} - -var _BusinessExt_serviceDesc = grpc.ServiceDesc{ - ServiceName: "pb.BusinessExt", - HandlerType: (*BusinessExtServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "SignIn", - Handler: _BusinessExt_SignIn_Handler, - }, - { - MethodName: "GetUser", - Handler: _BusinessExt_GetUser_Handler, - }, - { - MethodName: "UpdateUser", - Handler: _BusinessExt_UpdateUser_Handler, - }, - { - MethodName: "SearchUser", - Handler: _BusinessExt_SearchUser_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "business.ext.proto", -} diff --git a/pkg/protocol/pb/business.ext_grpc.pb.go b/pkg/protocol/pb/business.ext_grpc.pb.go new file mode 100644 index 00000000..a052771c --- /dev/null +++ b/pkg/protocol/pb/business.ext_grpc.pb.go @@ -0,0 +1,222 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.9 +// source: business.ext.proto + +package pb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + emptypb "google.golang.org/protobuf/types/known/emptypb" +) + +// 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 + +// BusinessExtClient is the client API for BusinessExt 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 BusinessExtClient interface { + // 登录 + SignIn(ctx context.Context, in *SignInReq, opts ...grpc.CallOption) (*SignInResp, error) + // 获取用户信息 + GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*GetUserResp, error) + // 更新用户信息 + UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 搜索用户(这里简单数据库实现,生产环境建议使用ES) + SearchUser(ctx context.Context, in *SearchUserReq, opts ...grpc.CallOption) (*SearchUserResp, error) +} + +type businessExtClient struct { + cc grpc.ClientConnInterface +} + +func NewBusinessExtClient(cc grpc.ClientConnInterface) BusinessExtClient { + return &businessExtClient{cc} +} + +func (c *businessExtClient) SignIn(ctx context.Context, in *SignInReq, opts ...grpc.CallOption) (*SignInResp, error) { + out := new(SignInResp) + err := c.cc.Invoke(ctx, "/pb.BusinessExt/SignIn", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *businessExtClient) GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*GetUserResp, error) { + out := new(GetUserResp) + err := c.cc.Invoke(ctx, "/pb.BusinessExt/GetUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *businessExtClient) UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.BusinessExt/UpdateUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *businessExtClient) SearchUser(ctx context.Context, in *SearchUserReq, opts ...grpc.CallOption) (*SearchUserResp, error) { + out := new(SearchUserResp) + err := c.cc.Invoke(ctx, "/pb.BusinessExt/SearchUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// BusinessExtServer is the server API for BusinessExt service. +// All implementations must embed UnimplementedBusinessExtServer +// for forward compatibility +type BusinessExtServer interface { + // 登录 + SignIn(context.Context, *SignInReq) (*SignInResp, error) + // 获取用户信息 + GetUser(context.Context, *GetUserReq) (*GetUserResp, error) + // 更新用户信息 + UpdateUser(context.Context, *UpdateUserReq) (*emptypb.Empty, error) + // 搜索用户(这里简单数据库实现,生产环境建议使用ES) + SearchUser(context.Context, *SearchUserReq) (*SearchUserResp, error) + mustEmbedUnimplementedBusinessExtServer() +} + +// UnimplementedBusinessExtServer must be embedded to have forward compatible implementations. +type UnimplementedBusinessExtServer struct { +} + +func (UnimplementedBusinessExtServer) SignIn(context.Context, *SignInReq) (*SignInResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method SignIn not implemented") +} +func (UnimplementedBusinessExtServer) GetUser(context.Context, *GetUserReq) (*GetUserResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented") +} +func (UnimplementedBusinessExtServer) UpdateUser(context.Context, *UpdateUserReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateUser not implemented") +} +func (UnimplementedBusinessExtServer) SearchUser(context.Context, *SearchUserReq) (*SearchUserResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchUser not implemented") +} +func (UnimplementedBusinessExtServer) mustEmbedUnimplementedBusinessExtServer() {} + +// UnsafeBusinessExtServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to BusinessExtServer will +// result in compilation errors. +type UnsafeBusinessExtServer interface { + mustEmbedUnimplementedBusinessExtServer() +} + +func RegisterBusinessExtServer(s grpc.ServiceRegistrar, srv BusinessExtServer) { + s.RegisterService(&BusinessExt_ServiceDesc, srv) +} + +func _BusinessExt_SignIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SignInReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BusinessExtServer).SignIn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.BusinessExt/SignIn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BusinessExtServer).SignIn(ctx, req.(*SignInReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _BusinessExt_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BusinessExtServer).GetUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.BusinessExt/GetUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BusinessExtServer).GetUser(ctx, req.(*GetUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _BusinessExt_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BusinessExtServer).UpdateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.BusinessExt/UpdateUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BusinessExtServer).UpdateUser(ctx, req.(*UpdateUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _BusinessExt_SearchUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BusinessExtServer).SearchUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.BusinessExt/SearchUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BusinessExtServer).SearchUser(ctx, req.(*SearchUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +// BusinessExt_ServiceDesc is the grpc.ServiceDesc for BusinessExt service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var BusinessExt_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "pb.BusinessExt", + HandlerType: (*BusinessExtServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SignIn", + Handler: _BusinessExt_SignIn_Handler, + }, + { + MethodName: "GetUser", + Handler: _BusinessExt_GetUser_Handler, + }, + { + MethodName: "UpdateUser", + Handler: _BusinessExt_UpdateUser_Handler, + }, + { + MethodName: "SearchUser", + Handler: _BusinessExt_SearchUser_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "business.ext.proto", +} diff --git a/pkg/protocol/pb/business.int.pb.go b/pkg/protocol/pb/business.int.pb.go new file mode 100644 index 00000000..91e0f8be --- /dev/null +++ b/pkg/protocol/pb/business.int.pb.go @@ -0,0 +1,328 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.9 +// source: business.int.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AuthReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + DeviceId int64 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` + Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` +} + +func (x *AuthReq) Reset() { + *x = AuthReq{} + if protoimpl.UnsafeEnabled { + mi := &file_business_int_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthReq) ProtoMessage() {} + +func (x *AuthReq) ProtoReflect() protoreflect.Message { + mi := &file_business_int_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 AuthReq.ProtoReflect.Descriptor instead. +func (*AuthReq) Descriptor() ([]byte, []int) { + return file_business_int_proto_rawDescGZIP(), []int{0} +} + +func (x *AuthReq) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *AuthReq) GetDeviceId() int64 { + if x != nil { + return x.DeviceId + } + return 0 +} + +func (x *AuthReq) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type GetUsersReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserIds map[int64]int32 `protobuf:"bytes,1,rep,name=user_ids,json=userIds,proto3" json:"user_ids,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 用户id +} + +func (x *GetUsersReq) Reset() { + *x = GetUsersReq{} + if protoimpl.UnsafeEnabled { + mi := &file_business_int_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUsersReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUsersReq) ProtoMessage() {} + +func (x *GetUsersReq) ProtoReflect() protoreflect.Message { + mi := &file_business_int_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 GetUsersReq.ProtoReflect.Descriptor instead. +func (*GetUsersReq) Descriptor() ([]byte, []int) { + return file_business_int_proto_rawDescGZIP(), []int{1} +} + +func (x *GetUsersReq) GetUserIds() map[int64]int32 { + if x != nil { + return x.UserIds + } + return nil +} + +type GetUsersResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Users map[int64]*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // 用户信息 +} + +func (x *GetUsersResp) Reset() { + *x = GetUsersResp{} + if protoimpl.UnsafeEnabled { + mi := &file_business_int_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUsersResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUsersResp) ProtoMessage() {} + +func (x *GetUsersResp) ProtoReflect() protoreflect.Message { + mi := &file_business_int_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 GetUsersResp.ProtoReflect.Descriptor instead. +func (*GetUsersResp) Descriptor() ([]byte, []int) { + return file_business_int_proto_rawDescGZIP(), []int{2} +} + +func (x *GetUsersResp) GetUsers() map[int64]*User { + if x != nil { + return x.Users + } + return nil +} + +var File_business_int_proto protoreflect.FileDescriptor + +var file_business_int_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x2e, + 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x55, 0x0a, 0x07, 0x41, 0x75, 0x74, + 0x68, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, + 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x22, 0x82, 0x01, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, + 0x12, 0x37, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, + 0x52, 0x65, 0x71, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x55, 0x73, 0x65, + 0x72, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x85, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, + 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x31, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, + 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x1a, 0x42, 0x0a, 0x0a, 0x55, 0x73, 0x65, + 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, + 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, 0x95, 0x01, + 0x0a, 0x0b, 0x42, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x49, 0x6e, 0x74, 0x12, 0x2b, 0x0a, + 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, + 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x2a, 0x0a, 0x07, 0x47, 0x65, + 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, + 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, + 0x72, 0x73, 0x12, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, + 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x42, 0x15, 0x5a, 0x13, 0x67, 0x69, 0x6d, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_business_int_proto_rawDescOnce sync.Once + file_business_int_proto_rawDescData = file_business_int_proto_rawDesc +) + +func file_business_int_proto_rawDescGZIP() []byte { + file_business_int_proto_rawDescOnce.Do(func() { + file_business_int_proto_rawDescData = protoimpl.X.CompressGZIP(file_business_int_proto_rawDescData) + }) + return file_business_int_proto_rawDescData +} + +var file_business_int_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_business_int_proto_goTypes = []interface{}{ + (*AuthReq)(nil), // 0: pb.AuthReq + (*GetUsersReq)(nil), // 1: pb.GetUsersReq + (*GetUsersResp)(nil), // 2: pb.GetUsersResp + nil, // 3: pb.GetUsersReq.UserIdsEntry + nil, // 4: pb.GetUsersResp.UsersEntry + (*User)(nil), // 5: pb.User + (*GetUserReq)(nil), // 6: pb.GetUserReq + (*emptypb.Empty)(nil), // 7: google.protobuf.Empty + (*GetUserResp)(nil), // 8: pb.GetUserResp +} +var file_business_int_proto_depIdxs = []int32{ + 3, // 0: pb.GetUsersReq.user_ids:type_name -> pb.GetUsersReq.UserIdsEntry + 4, // 1: pb.GetUsersResp.users:type_name -> pb.GetUsersResp.UsersEntry + 5, // 2: pb.GetUsersResp.UsersEntry.value:type_name -> pb.User + 0, // 3: pb.BusinessInt.Auth:input_type -> pb.AuthReq + 6, // 4: pb.BusinessInt.GetUser:input_type -> pb.GetUserReq + 1, // 5: pb.BusinessInt.GetUsers:input_type -> pb.GetUsersReq + 7, // 6: pb.BusinessInt.Auth:output_type -> google.protobuf.Empty + 8, // 7: pb.BusinessInt.GetUser:output_type -> pb.GetUserResp + 2, // 8: pb.BusinessInt.GetUsers:output_type -> pb.GetUsersResp + 6, // [6:9] is the sub-list for method output_type + 3, // [3:6] 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_business_int_proto_init() } +func file_business_int_proto_init() { + if File_business_int_proto != nil { + return + } + file_business_ext_proto_init() + if !protoimpl.UnsafeEnabled { + file_business_int_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_business_int_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUsersReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_business_int_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUsersResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_business_int_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_business_int_proto_goTypes, + DependencyIndexes: file_business_int_proto_depIdxs, + MessageInfos: file_business_int_proto_msgTypes, + }.Build() + File_business_int_proto = out.File + file_business_int_proto_rawDesc = nil + file_business_int_proto_goTypes = nil + file_business_int_proto_depIdxs = nil +} diff --git a/pkg/protocol/pb/business.int_grpc.pb.go b/pkg/protocol/pb/business.int_grpc.pb.go new file mode 100644 index 00000000..3037a520 --- /dev/null +++ b/pkg/protocol/pb/business.int_grpc.pb.go @@ -0,0 +1,184 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.9 +// source: business.int.proto + +package pb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + emptypb "google.golang.org/protobuf/types/known/emptypb" +) + +// 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 + +// BusinessIntClient is the client API for BusinessInt 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 BusinessIntClient interface { + // 权限校验 + Auth(ctx context.Context, in *AuthReq, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 批量获取用户信息 + GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*GetUserResp, error) + // 批量获取用户信息 + GetUsers(ctx context.Context, in *GetUsersReq, opts ...grpc.CallOption) (*GetUsersResp, error) +} + +type businessIntClient struct { + cc grpc.ClientConnInterface +} + +func NewBusinessIntClient(cc grpc.ClientConnInterface) BusinessIntClient { + return &businessIntClient{cc} +} + +func (c *businessIntClient) Auth(ctx context.Context, in *AuthReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.BusinessInt/Auth", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *businessIntClient) GetUser(ctx context.Context, in *GetUserReq, opts ...grpc.CallOption) (*GetUserResp, error) { + out := new(GetUserResp) + err := c.cc.Invoke(ctx, "/pb.BusinessInt/GetUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *businessIntClient) GetUsers(ctx context.Context, in *GetUsersReq, opts ...grpc.CallOption) (*GetUsersResp, error) { + out := new(GetUsersResp) + err := c.cc.Invoke(ctx, "/pb.BusinessInt/GetUsers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// BusinessIntServer is the server API for BusinessInt service. +// All implementations must embed UnimplementedBusinessIntServer +// for forward compatibility +type BusinessIntServer interface { + // 权限校验 + Auth(context.Context, *AuthReq) (*emptypb.Empty, error) + // 批量获取用户信息 + GetUser(context.Context, *GetUserReq) (*GetUserResp, error) + // 批量获取用户信息 + GetUsers(context.Context, *GetUsersReq) (*GetUsersResp, error) + mustEmbedUnimplementedBusinessIntServer() +} + +// UnimplementedBusinessIntServer must be embedded to have forward compatible implementations. +type UnimplementedBusinessIntServer struct { +} + +func (UnimplementedBusinessIntServer) Auth(context.Context, *AuthReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method Auth not implemented") +} +func (UnimplementedBusinessIntServer) GetUser(context.Context, *GetUserReq) (*GetUserResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented") +} +func (UnimplementedBusinessIntServer) GetUsers(context.Context, *GetUsersReq) (*GetUsersResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUsers not implemented") +} +func (UnimplementedBusinessIntServer) mustEmbedUnimplementedBusinessIntServer() {} + +// UnsafeBusinessIntServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to BusinessIntServer will +// result in compilation errors. +type UnsafeBusinessIntServer interface { + mustEmbedUnimplementedBusinessIntServer() +} + +func RegisterBusinessIntServer(s grpc.ServiceRegistrar, srv BusinessIntServer) { + s.RegisterService(&BusinessInt_ServiceDesc, srv) +} + +func _BusinessInt_Auth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BusinessIntServer).Auth(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.BusinessInt/Auth", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BusinessIntServer).Auth(ctx, req.(*AuthReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _BusinessInt_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BusinessIntServer).GetUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.BusinessInt/GetUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BusinessIntServer).GetUser(ctx, req.(*GetUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _BusinessInt_GetUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUsersReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BusinessIntServer).GetUsers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.BusinessInt/GetUsers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BusinessIntServer).GetUsers(ctx, req.(*GetUsersReq)) + } + return interceptor(ctx, in, info, handler) +} + +// BusinessInt_ServiceDesc is the grpc.ServiceDesc for BusinessInt service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var BusinessInt_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "pb.BusinessInt", + HandlerType: (*BusinessIntServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Auth", + Handler: _BusinessInt_Auth_Handler, + }, + { + MethodName: "GetUser", + Handler: _BusinessInt_GetUser_Handler, + }, + { + MethodName: "GetUsers", + Handler: _BusinessInt_GetUsers_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "business.int.proto", +} diff --git a/pkg/protocol/pb/connect.ext.pb.go b/pkg/protocol/pb/connect.ext.pb.go new file mode 100644 index 00000000..f657fea4 --- /dev/null +++ b/pkg/protocol/pb/connect.ext.pb.go @@ -0,0 +1,706 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.9 +// source: connect.ext.proto + +package pb + +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) +) + +type PackageType int32 + +const ( + PackageType_PT_UNKNOWN PackageType = 0 // 未知 + PackageType_PT_SIGN_IN PackageType = 1 // 设备登录请求 + PackageType_PT_SYNC PackageType = 2 // 消息同步触发 + PackageType_PT_HEARTBEAT PackageType = 3 // 心跳 + PackageType_PT_MESSAGE PackageType = 4 // 消息投递 + PackageType_PT_SUBSCRIBE_ROOM PackageType = 5 // 订阅房间 +) + +// Enum value maps for PackageType. +var ( + PackageType_name = map[int32]string{ + 0: "PT_UNKNOWN", + 1: "PT_SIGN_IN", + 2: "PT_SYNC", + 3: "PT_HEARTBEAT", + 4: "PT_MESSAGE", + 5: "PT_SUBSCRIBE_ROOM", + } + PackageType_value = map[string]int32{ + "PT_UNKNOWN": 0, + "PT_SIGN_IN": 1, + "PT_SYNC": 2, + "PT_HEARTBEAT": 3, + "PT_MESSAGE": 4, + "PT_SUBSCRIBE_ROOM": 5, + } +) + +func (x PackageType) Enum() *PackageType { + p := new(PackageType) + *p = x + return p +} + +func (x PackageType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PackageType) Descriptor() protoreflect.EnumDescriptor { + return file_connect_ext_proto_enumTypes[0].Descriptor() +} + +func (PackageType) Type() protoreflect.EnumType { + return &file_connect_ext_proto_enumTypes[0] +} + +func (x PackageType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use PackageType.Descriptor instead. +func (PackageType) EnumDescriptor() ([]byte, []int) { + return file_connect_ext_proto_rawDescGZIP(), []int{0} +} + +// 上行数据 +type Input struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type PackageType `protobuf:"varint,1,opt,name=type,proto3,enum=pb.PackageType" json:"type,omitempty"` // 包的类型 + RequestId int64 `protobuf:"varint,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` // 请求id + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` // 数据 +} + +func (x *Input) Reset() { + *x = Input{} + if protoimpl.UnsafeEnabled { + mi := &file_connect_ext_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Input) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Input) ProtoMessage() {} + +func (x *Input) ProtoReflect() protoreflect.Message { + mi := &file_connect_ext_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 Input.ProtoReflect.Descriptor instead. +func (*Input) Descriptor() ([]byte, []int) { + return file_connect_ext_proto_rawDescGZIP(), []int{0} +} + +func (x *Input) GetType() PackageType { + if x != nil { + return x.Type + } + return PackageType_PT_UNKNOWN +} + +func (x *Input) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +func (x *Input) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +// 下行数据 +type Output struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type PackageType `protobuf:"varint,1,opt,name=type,proto3,enum=pb.PackageType" json:"type,omitempty"` // 包的类型 + RequestId int64 `protobuf:"varint,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` // 请求id + Code int32 `protobuf:"varint,3,opt,name=code,proto3" json:"code,omitempty"` // 错误码 + Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` // 错误信息 + Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` // 数据 +} + +func (x *Output) Reset() { + *x = Output{} + if protoimpl.UnsafeEnabled { + mi := &file_connect_ext_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Output) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Output) ProtoMessage() {} + +func (x *Output) ProtoReflect() protoreflect.Message { + mi := &file_connect_ext_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 Output.ProtoReflect.Descriptor instead. +func (*Output) Descriptor() ([]byte, []int) { + return file_connect_ext_proto_rawDescGZIP(), []int{1} +} + +func (x *Output) GetType() PackageType { + if x != nil { + return x.Type + } + return PackageType_PT_UNKNOWN +} + +func (x *Output) GetRequestId() int64 { + if x != nil { + return x.RequestId + } + return 0 +} + +func (x *Output) GetCode() int32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *Output) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *Output) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +// 设备登录,package_type:1 +type SignInInput struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DeviceId int64 `protobuf:"varint,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id + UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户id + Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` // 秘钥 +} + +func (x *SignInInput) Reset() { + *x = SignInInput{} + if protoimpl.UnsafeEnabled { + mi := &file_connect_ext_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SignInInput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignInInput) ProtoMessage() {} + +func (x *SignInInput) ProtoReflect() protoreflect.Message { + mi := &file_connect_ext_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 SignInInput.ProtoReflect.Descriptor instead. +func (*SignInInput) Descriptor() ([]byte, []int) { + return file_connect_ext_proto_rawDescGZIP(), []int{2} +} + +func (x *SignInInput) GetDeviceId() int64 { + if x != nil { + return x.DeviceId + } + return 0 +} + +func (x *SignInInput) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *SignInInput) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +// 消息同步请求,package_type:2 +type SyncInput struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Seq int64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` // 客户端已经同步的序列号 +} + +func (x *SyncInput) Reset() { + *x = SyncInput{} + if protoimpl.UnsafeEnabled { + mi := &file_connect_ext_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncInput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncInput) ProtoMessage() {} + +func (x *SyncInput) ProtoReflect() protoreflect.Message { + mi := &file_connect_ext_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 SyncInput.ProtoReflect.Descriptor instead. +func (*SyncInput) Descriptor() ([]byte, []int) { + return file_connect_ext_proto_rawDescGZIP(), []int{3} +} + +func (x *SyncInput) GetSeq() int64 { + if x != nil { + return x.Seq + } + return 0 +} + +// 消息同步响应,package_type:2 +type SyncOutput struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` // 消息列表 + HasMore bool `protobuf:"varint,2,opt,name=has_more,json=hasMore,proto3" json:"has_more,omitempty"` // 是否有更多数据 +} + +func (x *SyncOutput) Reset() { + *x = SyncOutput{} + if protoimpl.UnsafeEnabled { + mi := &file_connect_ext_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncOutput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncOutput) ProtoMessage() {} + +func (x *SyncOutput) ProtoReflect() protoreflect.Message { + mi := &file_connect_ext_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 SyncOutput.ProtoReflect.Descriptor instead. +func (*SyncOutput) Descriptor() ([]byte, []int) { + return file_connect_ext_proto_rawDescGZIP(), []int{4} +} + +func (x *SyncOutput) GetMessages() []*Message { + if x != nil { + return x.Messages + } + return nil +} + +func (x *SyncOutput) GetHasMore() bool { + if x != nil { + return x.HasMore + } + return false +} + +// 订阅房间请求 +type SubscribeRoomInput struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RoomId int64 `protobuf:"varint,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` // 房间ID,如果为0,取消房间订阅 + Seq int64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` // 消息消息序列号, +} + +func (x *SubscribeRoomInput) Reset() { + *x = SubscribeRoomInput{} + if protoimpl.UnsafeEnabled { + mi := &file_connect_ext_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeRoomInput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeRoomInput) ProtoMessage() {} + +func (x *SubscribeRoomInput) ProtoReflect() protoreflect.Message { + mi := &file_connect_ext_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 SubscribeRoomInput.ProtoReflect.Descriptor instead. +func (*SubscribeRoomInput) Descriptor() ([]byte, []int) { + return file_connect_ext_proto_rawDescGZIP(), []int{5} +} + +func (x *SubscribeRoomInput) GetRoomId() int64 { + if x != nil { + return x.RoomId + } + return 0 +} + +func (x *SubscribeRoomInput) GetSeq() int64 { + if x != nil { + return x.Seq + } + return 0 +} + +// 投递消息回执,package_type:4 +type MessageACK struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DeviceAck int64 `protobuf:"varint,2,opt,name=device_ack,json=deviceAck,proto3" json:"device_ack,omitempty"` // 设备收到消息的确认号 + ReceiveTime int64 `protobuf:"varint,3,opt,name=receive_time,json=receiveTime,proto3" json:"receive_time,omitempty"` // 消息接收时间戳,精确到毫秒 +} + +func (x *MessageACK) Reset() { + *x = MessageACK{} + if protoimpl.UnsafeEnabled { + mi := &file_connect_ext_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageACK) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageACK) ProtoMessage() {} + +func (x *MessageACK) ProtoReflect() protoreflect.Message { + mi := &file_connect_ext_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 MessageACK.ProtoReflect.Descriptor instead. +func (*MessageACK) Descriptor() ([]byte, []int) { + return file_connect_ext_proto_rawDescGZIP(), []int{6} +} + +func (x *MessageACK) GetDeviceAck() int64 { + if x != nil { + return x.DeviceAck + } + return 0 +} + +func (x *MessageACK) GetReceiveTime() int64 { + if x != nil { + return x.ReceiveTime + } + return 0 +} + +var File_connect_ext_proto protoreflect.FileDescriptor + +var file_connect_ext_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x11, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5f, 0x0a, 0x05, 0x49, 0x6e, + 0x70, 0x75, 0x74, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x8e, 0x01, 0x0a, 0x06, + 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x59, 0x0a, 0x0b, + 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x64, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, + 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, + 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x1d, 0x0a, 0x09, 0x53, 0x79, 0x6e, 0x63, 0x49, + 0x6e, 0x70, 0x75, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x03, 0x73, 0x65, 0x71, 0x22, 0x50, 0x0a, 0x0a, 0x53, 0x79, 0x6e, 0x63, 0x4f, 0x75, + 0x74, 0x70, 0x75, 0x74, 0x12, 0x27, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x19, 0x0a, + 0x08, 0x68, 0x61, 0x73, 0x5f, 0x6d, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x07, 0x68, 0x61, 0x73, 0x4d, 0x6f, 0x72, 0x65, 0x22, 0x3f, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x17, + 0x0a, 0x07, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x73, 0x65, 0x71, 0x22, 0x4e, 0x0a, 0x0a, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x41, 0x43, 0x4b, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x5f, 0x61, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x64, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x41, 0x63, 0x6b, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, + 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x72, 0x65, + 0x63, 0x65, 0x69, 0x76, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x2a, 0x73, 0x0a, 0x0b, 0x50, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x54, 0x5f, 0x55, + 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x54, 0x5f, 0x53, + 0x49, 0x47, 0x4e, 0x5f, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x54, 0x5f, 0x53, + 0x59, 0x4e, 0x43, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x54, 0x5f, 0x48, 0x45, 0x41, 0x52, + 0x54, 0x42, 0x45, 0x41, 0x54, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x54, 0x5f, 0x4d, 0x45, + 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x54, 0x5f, 0x53, 0x55, + 0x42, 0x53, 0x43, 0x52, 0x49, 0x42, 0x45, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x10, 0x05, 0x42, 0x15, + 0x5a, 0x13, 0x67, 0x69, 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_connect_ext_proto_rawDescOnce sync.Once + file_connect_ext_proto_rawDescData = file_connect_ext_proto_rawDesc +) + +func file_connect_ext_proto_rawDescGZIP() []byte { + file_connect_ext_proto_rawDescOnce.Do(func() { + file_connect_ext_proto_rawDescData = protoimpl.X.CompressGZIP(file_connect_ext_proto_rawDescData) + }) + return file_connect_ext_proto_rawDescData +} + +var file_connect_ext_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_connect_ext_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_connect_ext_proto_goTypes = []interface{}{ + (PackageType)(0), // 0: pb.PackageType + (*Input)(nil), // 1: pb.Input + (*Output)(nil), // 2: pb.Output + (*SignInInput)(nil), // 3: pb.SignInInput + (*SyncInput)(nil), // 4: pb.SyncInput + (*SyncOutput)(nil), // 5: pb.SyncOutput + (*SubscribeRoomInput)(nil), // 6: pb.SubscribeRoomInput + (*MessageACK)(nil), // 7: pb.MessageACK + (*Message)(nil), // 8: pb.Message +} +var file_connect_ext_proto_depIdxs = []int32{ + 0, // 0: pb.Input.type:type_name -> pb.PackageType + 0, // 1: pb.Output.type:type_name -> pb.PackageType + 8, // 2: pb.SyncOutput.messages:type_name -> pb.Message + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] 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_connect_ext_proto_init() } +func file_connect_ext_proto_init() { + if File_connect_ext_proto != nil { + return + } + file_message_ext_proto_init() + if !protoimpl.UnsafeEnabled { + file_connect_ext_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Input); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_connect_ext_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Output); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_connect_ext_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SignInInput); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_connect_ext_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncInput); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_connect_ext_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncOutput); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_connect_ext_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeRoomInput); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_connect_ext_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageACK); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_connect_ext_proto_rawDesc, + NumEnums: 1, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_connect_ext_proto_goTypes, + DependencyIndexes: file_connect_ext_proto_depIdxs, + EnumInfos: file_connect_ext_proto_enumTypes, + MessageInfos: file_connect_ext_proto_msgTypes, + }.Build() + File_connect_ext_proto = out.File + file_connect_ext_proto_rawDesc = nil + file_connect_ext_proto_goTypes = nil + file_connect_ext_proto_depIdxs = nil +} diff --git a/pkg/pb/connect.int.pb.go b/pkg/protocol/pb/connect.int.pb.go similarity index 50% rename from pkg/pb/connect.int.pb.go rename to pkg/protocol/pb/connect.int.pb.go index e90f5b78..130b1c0e 100644 --- a/pkg/pb/connect.int.pb.go +++ b/pkg/protocol/pb/connect.int.pb.go @@ -1,18 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.14.0 +// protoc-gen-go v1.28.1 +// protoc v3.21.9 // source: connect.int.proto package pb import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" reflect "reflect" sync "sync" ) @@ -29,8 +26,8 @@ type DeliverMessageReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - DeviceId int64 `protobuf:"varint,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id - MessageSend *MessageSend `protobuf:"bytes,2,opt,name=message_send,json=messageSend,proto3" json:"message_send,omitempty"` // 数据 + DeviceId int64 `protobuf:"varint,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id + Message *Message `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // 数据 } func (x *DeliverMessageReq) Reset() { @@ -72,9 +69,9 @@ func (x *DeliverMessageReq) GetDeviceId() int64 { return 0 } -func (x *DeliverMessageReq) GetMessageSend() *MessageSend { +func (x *DeliverMessageReq) GetMessage() *Message { if x != nil { - return x.MessageSend + return x.Message } return nil } @@ -85,8 +82,8 @@ type PushRoomMsg struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - RoomId int64 `protobuf:"varint,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` // 设备id - MessageSend *MessageSend `protobuf:"bytes,2,opt,name=message_send,json=messageSend,proto3" json:"message_send,omitempty"` // 数据 + RoomId int64 `protobuf:"varint,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` // 设备id + Message *Message `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // 数据 } func (x *PushRoomMsg) Reset() { @@ -128,9 +125,9 @@ func (x *PushRoomMsg) GetRoomId() int64 { return 0 } -func (x *PushRoomMsg) GetMessageSend() *MessageSend { +func (x *PushRoomMsg) GetMessage() *Message { if x != nil { - return x.MessageSend + return x.Message } return nil } @@ -141,7 +138,7 @@ type PushAllMsg struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MessageSend *MessageSend `protobuf:"bytes,2,opt,name=message_send,json=messageSend,proto3" json:"message_send,omitempty"` // 数据 + Message *Message `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // 数据 } func (x *PushAllMsg) Reset() { @@ -176,9 +173,9 @@ func (*PushAllMsg) Descriptor() ([]byte, []int) { return file_connect_int_proto_rawDescGZIP(), []int{2} } -func (x *PushAllMsg) GetMessageSend() *MessageSend { +func (x *PushAllMsg) GetMessage() *Message { if x != nil { - return x.MessageSend + return x.Message } return nil } @@ -187,31 +184,31 @@ var File_connect_int_proto protoreflect.FileDescriptor var file_connect_int_proto_rawDesc = []byte{ 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x69, 0x6e, 0x74, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, - 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x64, 0x0a, 0x11, - 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, - 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x32, - 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, - 0x6e, 0x64, 0x22, 0x5a, 0x0a, 0x0b, 0x50, 0x75, 0x73, 0x68, 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x73, - 0x67, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x0c, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x6e, - 0x64, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x6e, 0x64, 0x22, 0x40, - 0x0a, 0x0a, 0x50, 0x75, 0x73, 0x68, 0x41, 0x6c, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x32, 0x0a, 0x0c, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, - 0x65, 0x6e, 0x64, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x6e, 0x64, - 0x32, 0x40, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x74, 0x12, 0x32, - 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x42, 0x0d, 0x5a, 0x0b, 0x67, 0x69, 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62, - 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x65, 0x78, + 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x69, 0x76, + 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, + 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x62, 0x2e, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x22, 0x4d, 0x0a, 0x0b, 0x50, 0x75, 0x73, 0x68, 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x73, 0x67, 0x12, + 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, + 0x33, 0x0a, 0x0a, 0x50, 0x75, 0x73, 0x68, 0x41, 0x6c, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x25, 0x0a, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, + 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x32, 0x4d, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x49, + 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, + 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x42, 0x15, 0x5a, 0x13, 0x67, 0x69, 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -231,15 +228,15 @@ var file_connect_int_proto_goTypes = []interface{}{ (*DeliverMessageReq)(nil), // 0: pb.DeliverMessageReq (*PushRoomMsg)(nil), // 1: pb.PushRoomMsg (*PushAllMsg)(nil), // 2: pb.PushAllMsg - (*MessageSend)(nil), // 3: pb.MessageSend - (*Empty)(nil), // 4: pb.Empty + (*Message)(nil), // 3: pb.Message + (*emptypb.Empty)(nil), // 4: google.protobuf.Empty } var file_connect_int_proto_depIdxs = []int32{ - 3, // 0: pb.DeliverMessageReq.message_send:type_name -> pb.MessageSend - 3, // 1: pb.PushRoomMsg.message_send:type_name -> pb.MessageSend - 3, // 2: pb.PushAllMsg.message_send:type_name -> pb.MessageSend + 3, // 0: pb.DeliverMessageReq.message:type_name -> pb.Message + 3, // 1: pb.PushRoomMsg.message:type_name -> pb.Message + 3, // 2: pb.PushAllMsg.message:type_name -> pb.Message 0, // 3: pb.ConnectInt.DeliverMessage:input_type -> pb.DeliverMessageReq - 4, // 4: pb.ConnectInt.DeliverMessage:output_type -> pb.Empty + 4, // 4: pb.ConnectInt.DeliverMessage:output_type -> google.protobuf.Empty 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 @@ -252,8 +249,7 @@ func file_connect_int_proto_init() { if File_connect_int_proto != nil { return } - file_common_ext_proto_init() - file_connect_ext_proto_init() + file_message_ext_proto_init() if !protoimpl.UnsafeEnabled { file_connect_int_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeliverMessageReq); i { @@ -311,85 +307,3 @@ func file_connect_int_proto_init() { file_connect_int_proto_goTypes = nil file_connect_int_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// ConnectIntClient is the client API for ConnectInt service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ConnectIntClient interface { - // 消息投递 - DeliverMessage(ctx context.Context, in *DeliverMessageReq, opts ...grpc.CallOption) (*Empty, error) -} - -type connectIntClient struct { - cc grpc.ClientConnInterface -} - -func NewConnectIntClient(cc grpc.ClientConnInterface) ConnectIntClient { - return &connectIntClient{cc} -} - -func (c *connectIntClient) DeliverMessage(ctx context.Context, in *DeliverMessageReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.ConnectInt/DeliverMessage", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ConnectIntServer is the server API for ConnectInt service. -type ConnectIntServer interface { - // 消息投递 - DeliverMessage(context.Context, *DeliverMessageReq) (*Empty, error) -} - -// UnimplementedConnectIntServer can be embedded to have forward compatible implementations. -type UnimplementedConnectIntServer struct { -} - -func (*UnimplementedConnectIntServer) DeliverMessage(context.Context, *DeliverMessageReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeliverMessage not implemented") -} - -func RegisterConnectIntServer(s *grpc.Server, srv ConnectIntServer) { - s.RegisterService(&_ConnectInt_serviceDesc, srv) -} - -func _ConnectInt_DeliverMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeliverMessageReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ConnectIntServer).DeliverMessage(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.ConnectInt/DeliverMessage", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ConnectIntServer).DeliverMessage(ctx, req.(*DeliverMessageReq)) - } - return interceptor(ctx, in, info, handler) -} - -var _ConnectInt_serviceDesc = grpc.ServiceDesc{ - ServiceName: "pb.ConnectInt", - HandlerType: (*ConnectIntServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "DeliverMessage", - Handler: _ConnectInt_DeliverMessage_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "connect.int.proto", -} diff --git a/pkg/protocol/pb/connect.int_grpc.pb.go b/pkg/protocol/pb/connect.int_grpc.pb.go new file mode 100644 index 00000000..683c0502 --- /dev/null +++ b/pkg/protocol/pb/connect.int_grpc.pb.go @@ -0,0 +1,108 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.9 +// source: connect.int.proto + +package pb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + emptypb "google.golang.org/protobuf/types/known/emptypb" +) + +// 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 + +// ConnectIntClient is the client API for ConnectInt 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 ConnectIntClient interface { + // 消息投递 + DeliverMessage(ctx context.Context, in *DeliverMessageReq, opts ...grpc.CallOption) (*emptypb.Empty, error) +} + +type connectIntClient struct { + cc grpc.ClientConnInterface +} + +func NewConnectIntClient(cc grpc.ClientConnInterface) ConnectIntClient { + return &connectIntClient{cc} +} + +func (c *connectIntClient) DeliverMessage(ctx context.Context, in *DeliverMessageReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.ConnectInt/DeliverMessage", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ConnectIntServer is the server API for ConnectInt service. +// All implementations must embed UnimplementedConnectIntServer +// for forward compatibility +type ConnectIntServer interface { + // 消息投递 + DeliverMessage(context.Context, *DeliverMessageReq) (*emptypb.Empty, error) + mustEmbedUnimplementedConnectIntServer() +} + +// UnimplementedConnectIntServer must be embedded to have forward compatible implementations. +type UnimplementedConnectIntServer struct { +} + +func (UnimplementedConnectIntServer) DeliverMessage(context.Context, *DeliverMessageReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeliverMessage not implemented") +} +func (UnimplementedConnectIntServer) mustEmbedUnimplementedConnectIntServer() {} + +// UnsafeConnectIntServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ConnectIntServer will +// result in compilation errors. +type UnsafeConnectIntServer interface { + mustEmbedUnimplementedConnectIntServer() +} + +func RegisterConnectIntServer(s grpc.ServiceRegistrar, srv ConnectIntServer) { + s.RegisterService(&ConnectInt_ServiceDesc, srv) +} + +func _ConnectInt_DeliverMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeliverMessageReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ConnectIntServer).DeliverMessage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ConnectInt/DeliverMessage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ConnectIntServer).DeliverMessage(ctx, req.(*DeliverMessageReq)) + } + return interceptor(ctx, in, info, handler) +} + +// ConnectInt_ServiceDesc is the grpc.ServiceDesc for ConnectInt service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ConnectInt_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "pb.ConnectInt", + HandlerType: (*ConnectIntServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "DeliverMessage", + Handler: _ConnectInt_DeliverMessage_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "connect.int.proto", +} diff --git a/pkg/pb/logic.ext.pb.go b/pkg/protocol/pb/logic.ext.pb.go similarity index 52% rename from pkg/pb/logic.ext.pb.go rename to pkg/protocol/pb/logic.ext.pb.go index c15939d9..5a61dd20 100644 --- a/pkg/pb/logic.ext.pb.go +++ b/pkg/protocol/pb/logic.ext.pb.go @@ -1,18 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.14.0 +// protoc-gen-go v1.28.1 +// protoc v3.21.9 // source: logic.ext.proto package pb import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" reflect "reflect" sync "sync" ) @@ -204,13 +201,9 @@ type SendMessageReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ReceiverType ReceiverType `protobuf:"varint,1,opt,name=receiver_type,json=receiverType,proto3,enum=pb.ReceiverType" json:"receiver_type,omitempty"` // 接收者类型,1:user;2:group - ReceiverId int64 `protobuf:"varint,2,opt,name=receiver_id,json=receiverId,proto3" json:"receiver_id,omitempty"` // 用户id或者群组id - ToUserIds []int64 `protobuf:"varint,3,rep,packed,name=to_user_ids,json=toUserIds,proto3" json:"to_user_ids,omitempty"` // 需要@的用户id列表 - MessageType MessageType `protobuf:"varint,4,opt,name=message_type,json=messageType,proto3,enum=pb.MessageType" json:"message_type,omitempty"` // 消息类型 - MessageContent []byte `protobuf:"bytes,5,opt,name=message_content,json=messageContent,proto3" json:"message_content,omitempty"` // 消息内容 - SendTime int64 `protobuf:"varint,6,opt,name=send_time,json=sendTime,proto3" json:"send_time,omitempty"` // 消息发送时间戳,精确到毫秒 - IsPersist bool `protobuf:"varint,7,opt,name=is_persist,json=isPersist,proto3" json:"is_persist,omitempty"` // 是否将消息持久化到数据库 + ReceiverId int64 `protobuf:"varint,1,opt,name=receiver_id,json=receiverId,proto3" json:"receiver_id,omitempty"` // 接收者ID,用户ID/群组ID + Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` // 推动内容 + SendTime int64 `protobuf:"varint,3,opt,name=send_time,json=sendTime,proto3" json:"send_time,omitempty"` // 消息发送时间戳,精确到毫秒 } func (x *SendMessageReq) Reset() { @@ -245,13 +238,6 @@ func (*SendMessageReq) Descriptor() ([]byte, []int) { return file_logic_ext_proto_rawDescGZIP(), []int{2} } -func (x *SendMessageReq) GetReceiverType() ReceiverType { - if x != nil { - return x.ReceiverType - } - return ReceiverType_RT_UNKNOWN -} - func (x *SendMessageReq) GetReceiverId() int64 { if x != nil { return x.ReceiverId @@ -259,23 +245,9 @@ func (x *SendMessageReq) GetReceiverId() int64 { return 0 } -func (x *SendMessageReq) GetToUserIds() []int64 { - if x != nil { - return x.ToUserIds - } - return nil -} - -func (x *SendMessageReq) GetMessageType() MessageType { +func (x *SendMessageReq) GetContent() []byte { if x != nil { - return x.MessageType - } - return MessageType_MT_UNKNOWN -} - -func (x *SendMessageReq) GetMessageContent() []byte { - if x != nil { - return x.MessageContent + return x.Content } return nil } @@ -287,13 +259,6 @@ func (x *SendMessageReq) GetSendTime() int64 { return 0 } -func (x *SendMessageReq) GetIsPersist() bool { - if x != nil { - return x.IsPersist - } - return false -} - type SendMessageResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -346,12 +311,12 @@ type PushRoomReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - RoomId int64 `protobuf:"varint,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` // 房间id - MessageType MessageType `protobuf:"varint,2,opt,name=message_type,json=messageType,proto3,enum=pb.MessageType" json:"message_type,omitempty"` // 消息类型 - MessageContent []byte `protobuf:"bytes,3,opt,name=message_content,json=messageContent,proto3" json:"message_content,omitempty"` // 消息内容 - SendTime int64 `protobuf:"varint,4,opt,name=send_time,json=sendTime,proto3" json:"send_time,omitempty"` // 消息发送时间戳,精确到毫秒 - IsPersist bool `protobuf:"varint,5,opt,name=is_persist,json=isPersist,proto3" json:"is_persist,omitempty"` // 是否将消息持久化 - IsPriority bool `protobuf:"varint,6,opt,name=is_priority,json=isPriority,proto3" json:"is_priority,omitempty"` // 是否优先推送 + RoomId int64 `protobuf:"varint,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` // 房间id + Code int32 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"` // 消息类型 + Content []byte `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` // 消息内容 + SendTime int64 `protobuf:"varint,4,opt,name=send_time,json=sendTime,proto3" json:"send_time,omitempty"` // 消息发送时间戳,精确到毫秒 + IsPersist bool `protobuf:"varint,5,opt,name=is_persist,json=isPersist,proto3" json:"is_persist,omitempty"` // 是否将消息持久化 + IsPriority bool `protobuf:"varint,6,opt,name=is_priority,json=isPriority,proto3" json:"is_priority,omitempty"` // 是否优先推送 } func (x *PushRoomReq) Reset() { @@ -393,16 +358,16 @@ func (x *PushRoomReq) GetRoomId() int64 { return 0 } -func (x *PushRoomReq) GetMessageType() MessageType { +func (x *PushRoomReq) GetCode() int32 { if x != nil { - return x.MessageType + return x.Code } - return MessageType_MT_UNKNOWN + return 0 } -func (x *PushRoomReq) GetMessageContent() []byte { +func (x *PushRoomReq) GetContent() []byte { if x != nil { - return x.MessageContent + return x.Content } return nil } @@ -1708,246 +1673,242 @@ var File_logic_ext_proto protoreflect.FileDescriptor var file_logic_ext_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x65, 0x78, - 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9b, 0x01, 0x0a, 0x11, 0x52, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, - 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, - 0x64, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, - 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x64, 0x6b, 0x5f, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x64, - 0x6b, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x31, 0x0a, 0x12, 0x52, 0x65, 0x67, 0x69, - 0x73, 0x74, 0x65, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, - 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0xa1, 0x02, 0x0a, 0x0e, - 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x35, - 0x0a, 0x0d, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x63, 0x65, 0x69, - 0x76, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, - 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x65, - 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0b, 0x74, 0x6f, 0x5f, 0x75, 0x73, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x09, 0x74, 0x6f, 0x55, - 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x12, 0x32, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, - 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0b, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, - 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x50, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x22, - 0x23, 0x0a, 0x0f, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x03, 0x73, 0x65, 0x71, 0x22, 0xe0, 0x01, 0x0a, 0x0b, 0x50, 0x75, 0x73, 0x68, 0x52, 0x6f, 0x6f, - 0x6d, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x32, 0x0a, - 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, - 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, - 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x70, 0x65, - 0x72, 0x73, 0x69, 0x73, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x50, - 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x73, 0x5f, 0x70, 0x72, 0x69, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x50, - 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x67, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x46, 0x72, + 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x9b, 0x01, 0x0a, 0x11, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x44, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, + 0x62, 0x72, 0x61, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x72, 0x61, + 0x6e, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x1f, 0x0a, 0x0b, 0x73, 0x64, 0x6b, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x64, 0x6b, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x22, 0x31, 0x0a, 0x12, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x44, 0x65, 0x76, 0x69, + 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x49, 0x64, 0x22, 0x68, 0x0a, 0x0e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, + 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x65, + 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x23, 0x0a, + 0x0f, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x73, + 0x65, 0x71, 0x22, 0xb1, 0x01, 0x0a, 0x0b, 0x50, 0x75, 0x73, 0x68, 0x52, 0x6f, 0x6f, 0x6d, 0x52, + 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, + 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x6e, + 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, + 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x70, 0x65, 0x72, + 0x73, 0x69, 0x73, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x50, 0x65, + 0x72, 0x73, 0x69, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x73, 0x5f, 0x70, 0x72, 0x69, 0x6f, + 0x72, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x50, 0x72, + 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x67, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, + 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, + 0x64, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, 0x20, 0x0a, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, + 0x46, 0x0a, 0x11, 0x41, 0x67, 0x72, 0x65, 0x65, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, + 0x64, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, + 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x22, 0x5b, 0x0a, 0x0c, 0x53, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, 0x20, - 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x22, 0x46, 0x0a, 0x11, 0x41, 0x67, 0x72, 0x65, 0x65, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, - 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x22, 0x5b, 0x0a, 0x0c, 0x53, 0x65, 0x74, 0x46, - 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x66, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, - 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x5c, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, - 0x64, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, 0x14, 0x0a, - 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, - 0x74, 0x72, 0x61, 0x22, 0xe0, 0x01, 0x0a, 0x06, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x17, - 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, - 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, - 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, - 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, - 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x03, 0x73, 0x65, 0x78, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, - 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, - 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x5f, - 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x73, 0x65, - 0x72, 0x45, 0x78, 0x74, 0x72, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, - 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, - 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x36, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x46, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x07, 0x66, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x46, - 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x07, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x73, 0x22, 0x9c, - 0x01, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, - 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, - 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, - 0x72, 0x55, 0x72, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x74, 0x72, - 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, - 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x12, 0x1d, - 0x0a, 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, - 0x28, 0x03, 0x52, 0x09, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x64, 0x73, 0x22, 0x2c, 0x0a, - 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x98, 0x01, 0x0a, 0x0e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x12, 0x19, - 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, - 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, - 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, - 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x28, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x52, 0x65, 0x71, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, - 0x22, 0x2f, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x1f, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x22, 0xec, 0x01, 0x0a, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x67, - 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, - 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, - 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x74, - 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0c, 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, - 0x08, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x07, 0x75, 0x73, 0x65, 0x72, 0x4d, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, - 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x12, 0x1f, - 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, - 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, - 0x22, 0x32, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x21, 0x0a, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x73, 0x22, 0x4a, 0x0a, 0x12, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, - 0x22, 0x30, 0x0a, 0x13, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, - 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x5f, - 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x49, - 0x64, 0x73, 0x22, 0xab, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x19, 0x0a, 0x08, 0x67, - 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, - 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, - 0x2f, 0x0a, 0x0b, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, - 0x74, 0x72, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, - 0x22, 0x4a, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x2f, 0x0a, 0x12, - 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, - 0x65, 0x71, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x40, 0x0a, - 0x13, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x12, 0x29, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, - 0xf3, 0x01, 0x0a, 0x0b, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, - 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x03, 0x73, 0x65, 0x78, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, - 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, - 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x65, 0x78, - 0x74, 0x72, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x73, 0x65, 0x72, 0x45, - 0x78, 0x74, 0x72, 0x61, 0x12, 0x2f, 0x0a, 0x0b, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, - 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, 0x14, + 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, + 0x78, 0x74, 0x72, 0x61, 0x22, 0x5c, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, + 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, 0x14, 0x0a, 0x05, + 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, + 0x72, 0x61, 0x22, 0xe0, 0x01, 0x0a, 0x06, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x17, 0x0a, + 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, + 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x5f, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x68, + 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, + 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, + 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x03, 0x73, 0x65, 0x78, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, + 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, + 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x65, + 0x78, 0x74, 0x72, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x73, 0x65, 0x72, + 0x45, 0x78, 0x74, 0x72, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x65, 0x78, 0x74, 0x72, 0x61, 0x2a, 0x3c, 0x0a, 0x0a, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x47, 0x4d, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, - 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x47, 0x4d, 0x54, 0x5f, 0x41, 0x44, 0x4d, 0x49, - 0x4e, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x47, 0x4d, 0x54, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, - 0x52, 0x10, 0x02, 0x32, 0xa4, 0x06, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x45, 0x78, 0x74, - 0x12, 0x3f, 0x0a, 0x0e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x44, 0x65, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, - 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x52, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x36, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x08, 0x50, 0x75, 0x73, - 0x68, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x52, - 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x12, 0x28, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x10, - 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, - 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x32, 0x0a, 0x0e, 0x41, - 0x67, 0x72, 0x65, 0x65, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x15, 0x2e, - 0x70, 0x62, 0x2e, 0x41, 0x67, 0x72, 0x65, 0x65, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, - 0x64, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, - 0x30, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x10, 0x2e, 0x70, - 0x62, 0x2e, 0x53, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x11, - 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x2b, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x73, 0x12, - 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x70, 0x62, 0x2e, - 0x47, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x36, - 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x12, 0x2e, - 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, - 0x71, 0x1a, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x12, 0x2d, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x12, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, - 0x71, 0x1a, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x29, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, - 0x12, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x11, 0x2e, 0x70, 0x62, - 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x42, - 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, - 0x73, 0x12, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x41, - 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x38, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x38, 0x0a, 0x11, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, - 0x72, 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x42, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x47, + 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x36, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, + 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x07, 0x66, 0x72, 0x69, 0x65, 0x6e, + 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x72, + 0x69, 0x65, 0x6e, 0x64, 0x52, 0x07, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x73, 0x22, 0x9c, 0x01, + 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, + 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, + 0x55, 0x72, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x74, 0x72, 0x6f, + 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x12, 0x1d, 0x0a, + 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, + 0x03, 0x52, 0x09, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x64, 0x73, 0x22, 0x2c, 0x0a, 0x0f, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x98, 0x01, 0x0a, 0x0e, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x12, 0x19, 0x0a, + 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, + 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, + 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x69, + 0x6e, 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x28, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x52, 0x65, 0x71, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, + 0x2f, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x1f, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, + 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x22, 0xec, 0x01, 0x0a, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, + 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, + 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, + 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, + 0x75, 0x73, 0x65, 0x72, 0x4d, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x12, 0x1f, 0x0a, + 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1f, + 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, + 0x32, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x21, 0x0a, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x73, 0x22, 0x4a, 0x0a, 0x12, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x22, + 0x30, 0x0a, 0x13, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, + 0x73, 0x22, 0xab, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2f, + 0x0a, 0x0b, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, + 0x72, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, + 0x4a, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x2f, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, - 0x71, 0x1a, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x42, 0x0d, 0x5a, 0x0b, 0x67, 0x69, - 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x71, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x40, 0x0a, 0x13, + 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x12, 0x29, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0xf3, + 0x01, 0x0a, 0x0b, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x17, + 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x03, 0x73, 0x65, 0x78, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, + 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, + 0x72, 0x55, 0x72, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x65, 0x78, 0x74, + 0x72, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x73, 0x65, 0x72, 0x45, 0x78, + 0x74, 0x72, 0x61, 0x12, 0x2f, 0x0a, 0x0b, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, 0x14, + 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, + 0x78, 0x74, 0x72, 0x61, 0x2a, 0x3c, 0x0a, 0x0a, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x47, 0x4d, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, + 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x47, 0x4d, 0x54, 0x5f, 0x41, 0x44, 0x4d, 0x49, 0x4e, + 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x47, 0x4d, 0x54, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, + 0x10, 0x02, 0x32, 0xd3, 0x07, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x45, 0x78, 0x74, 0x12, + 0x3f, 0x0a, 0x0e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x44, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x33, 0x0a, 0x08, 0x50, 0x75, 0x73, 0x68, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x0f, 0x2e, 0x70, + 0x62, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3e, 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x12, 0x2e, 0x70, + 0x62, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, + 0x1a, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x35, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, + 0x6e, 0x64, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, + 0x64, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3f, 0x0a, 0x0e, + 0x41, 0x67, 0x72, 0x65, 0x65, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x15, + 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x67, 0x72, 0x65, 0x65, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, + 0x6e, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x30, 0x0a, + 0x09, 0x53, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, + 0x53, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x70, + 0x62, 0x2e, 0x53, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x38, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x73, 0x12, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x72, + 0x69, 0x65, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3d, 0x0a, 0x12, 0x53, 0x65, 0x6e, + 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, + 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x36, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x70, 0x62, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x39, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, + 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x2d, 0x0a, 0x08, 0x47, + 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, + 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x36, 0x0a, 0x09, 0x47, 0x65, + 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, + 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x42, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x64, 0x64, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, + 0x70, 0x62, 0x2e, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x45, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x70, 0x62, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x45, 0x0a, + 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x12, 0x42, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x1a, + 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x42, 0x15, 0x5a, 0x13, 0x67, 0x69, 0x6d, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x70, 0x62, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1991,55 +1952,52 @@ var file_logic_ext_proto_goTypes = []interface{}{ (*GetGroupMembersReq)(nil), // 23: pb.GetGroupMembersReq (*GetGroupMembersResp)(nil), // 24: pb.GetGroupMembersResp (*GroupMember)(nil), // 25: pb.GroupMember - (ReceiverType)(0), // 26: pb.ReceiverType - (MessageType)(0), // 27: pb.MessageType - (*Empty)(nil), // 28: pb.Empty + (*emptypb.Empty)(nil), // 26: google.protobuf.Empty } var file_logic_ext_proto_depIdxs = []int32{ - 26, // 0: pb.SendMessageReq.receiver_type:type_name -> pb.ReceiverType - 27, // 1: pb.SendMessageReq.message_type:type_name -> pb.MessageType - 27, // 2: pb.PushRoomReq.message_type:type_name -> pb.MessageType - 10, // 3: pb.GetFriendsResp.friends:type_name -> pb.Friend - 17, // 4: pb.GetGroupResp.group:type_name -> pb.Group - 17, // 5: pb.GetGroupsResp.groups:type_name -> pb.Group - 0, // 6: pb.UpdateGroupMemberReq.member_type:type_name -> pb.MemberType - 25, // 7: pb.GetGroupMembersResp.members:type_name -> pb.GroupMember - 0, // 8: pb.GroupMember.member_type:type_name -> pb.MemberType - 1, // 9: pb.LogicExt.RegisterDevice:input_type -> pb.RegisterDeviceReq - 3, // 10: pb.LogicExt.SendMessage:input_type -> pb.SendMessageReq - 5, // 11: pb.LogicExt.PushRoom:input_type -> pb.PushRoomReq - 6, // 12: pb.LogicExt.AddFriend:input_type -> pb.AddFriendReq - 7, // 13: pb.LogicExt.AgreeAddFriend:input_type -> pb.AgreeAddFriendReq - 8, // 14: pb.LogicExt.SetFriend:input_type -> pb.SetFriendReq - 28, // 15: pb.LogicExt.GetFriends:input_type -> pb.Empty - 12, // 16: pb.LogicExt.CreateGroup:input_type -> pb.CreateGroupReq - 14, // 17: pb.LogicExt.UpdateGroup:input_type -> pb.UpdateGroupReq - 15, // 18: pb.LogicExt.GetGroup:input_type -> pb.GetGroupReq - 28, // 19: pb.LogicExt.GetGroups:input_type -> pb.Empty - 19, // 20: pb.LogicExt.AddGroupMembers:input_type -> pb.AddGroupMembersReq - 21, // 21: pb.LogicExt.UpdateGroupMember:input_type -> pb.UpdateGroupMemberReq - 22, // 22: pb.LogicExt.DeleteGroupMember:input_type -> pb.DeleteGroupMemberReq - 23, // 23: pb.LogicExt.GetGroupMembers:input_type -> pb.GetGroupMembersReq - 2, // 24: pb.LogicExt.RegisterDevice:output_type -> pb.RegisterDeviceResp - 4, // 25: pb.LogicExt.SendMessage:output_type -> pb.SendMessageResp - 28, // 26: pb.LogicExt.PushRoom:output_type -> pb.Empty - 28, // 27: pb.LogicExt.AddFriend:output_type -> pb.Empty - 28, // 28: pb.LogicExt.AgreeAddFriend:output_type -> pb.Empty - 9, // 29: pb.LogicExt.SetFriend:output_type -> pb.SetFriendResp - 11, // 30: pb.LogicExt.GetFriends:output_type -> pb.GetFriendsResp - 13, // 31: pb.LogicExt.CreateGroup:output_type -> pb.CreateGroupResp - 28, // 32: pb.LogicExt.UpdateGroup:output_type -> pb.Empty - 16, // 33: pb.LogicExt.GetGroup:output_type -> pb.GetGroupResp - 18, // 34: pb.LogicExt.GetGroups:output_type -> pb.GetGroupsResp - 20, // 35: pb.LogicExt.AddGroupMembers:output_type -> pb.AddGroupMembersResp - 28, // 36: pb.LogicExt.UpdateGroupMember:output_type -> pb.Empty - 28, // 37: pb.LogicExt.DeleteGroupMember:output_type -> pb.Empty - 24, // 38: pb.LogicExt.GetGroupMembers:output_type -> pb.GetGroupMembersResp - 24, // [24:39] is the sub-list for method output_type - 9, // [9:24] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 10, // 0: pb.GetFriendsResp.friends:type_name -> pb.Friend + 17, // 1: pb.GetGroupResp.group:type_name -> pb.Group + 17, // 2: pb.GetGroupsResp.groups:type_name -> pb.Group + 0, // 3: pb.UpdateGroupMemberReq.member_type:type_name -> pb.MemberType + 25, // 4: pb.GetGroupMembersResp.members:type_name -> pb.GroupMember + 0, // 5: pb.GroupMember.member_type:type_name -> pb.MemberType + 1, // 6: pb.LogicExt.RegisterDevice:input_type -> pb.RegisterDeviceReq + 5, // 7: pb.LogicExt.PushRoom:input_type -> pb.PushRoomReq + 3, // 8: pb.LogicExt.SendMessageToFriend:input_type -> pb.SendMessageReq + 6, // 9: pb.LogicExt.AddFriend:input_type -> pb.AddFriendReq + 7, // 10: pb.LogicExt.AgreeAddFriend:input_type -> pb.AgreeAddFriendReq + 8, // 11: pb.LogicExt.SetFriend:input_type -> pb.SetFriendReq + 26, // 12: pb.LogicExt.GetFriends:input_type -> google.protobuf.Empty + 3, // 13: pb.LogicExt.SendMessageToGroup:input_type -> pb.SendMessageReq + 12, // 14: pb.LogicExt.CreateGroup:input_type -> pb.CreateGroupReq + 14, // 15: pb.LogicExt.UpdateGroup:input_type -> pb.UpdateGroupReq + 15, // 16: pb.LogicExt.GetGroup:input_type -> pb.GetGroupReq + 26, // 17: pb.LogicExt.GetGroups:input_type -> google.protobuf.Empty + 19, // 18: pb.LogicExt.AddGroupMembers:input_type -> pb.AddGroupMembersReq + 21, // 19: pb.LogicExt.UpdateGroupMember:input_type -> pb.UpdateGroupMemberReq + 22, // 20: pb.LogicExt.DeleteGroupMember:input_type -> pb.DeleteGroupMemberReq + 23, // 21: pb.LogicExt.GetGroupMembers:input_type -> pb.GetGroupMembersReq + 2, // 22: pb.LogicExt.RegisterDevice:output_type -> pb.RegisterDeviceResp + 26, // 23: pb.LogicExt.PushRoom:output_type -> google.protobuf.Empty + 4, // 24: pb.LogicExt.SendMessageToFriend:output_type -> pb.SendMessageResp + 26, // 25: pb.LogicExt.AddFriend:output_type -> google.protobuf.Empty + 26, // 26: pb.LogicExt.AgreeAddFriend:output_type -> google.protobuf.Empty + 9, // 27: pb.LogicExt.SetFriend:output_type -> pb.SetFriendResp + 11, // 28: pb.LogicExt.GetFriends:output_type -> pb.GetFriendsResp + 4, // 29: pb.LogicExt.SendMessageToGroup:output_type -> pb.SendMessageResp + 13, // 30: pb.LogicExt.CreateGroup:output_type -> pb.CreateGroupResp + 26, // 31: pb.LogicExt.UpdateGroup:output_type -> google.protobuf.Empty + 16, // 32: pb.LogicExt.GetGroup:output_type -> pb.GetGroupResp + 18, // 33: pb.LogicExt.GetGroups:output_type -> pb.GetGroupsResp + 20, // 34: pb.LogicExt.AddGroupMembers:output_type -> pb.AddGroupMembersResp + 26, // 35: pb.LogicExt.UpdateGroupMember:output_type -> google.protobuf.Empty + 26, // 36: pb.LogicExt.DeleteGroupMember:output_type -> google.protobuf.Empty + 24, // 37: pb.LogicExt.GetGroupMembers:output_type -> pb.GetGroupMembersResp + 22, // [22:38] is the sub-list for method output_type + 6, // [6:22] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_logic_ext_proto_init() } @@ -2047,8 +2005,6 @@ func file_logic_ext_proto_init() { if File_logic_ext_proto != nil { return } - file_common_ext_proto_init() - file_connect_ext_proto_init() if !protoimpl.UnsafeEnabled { file_logic_ext_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RegisterDeviceReq); i { @@ -2371,617 +2327,3 @@ func file_logic_ext_proto_init() { file_logic_ext_proto_goTypes = nil file_logic_ext_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// LogicExtClient is the client API for LogicExt service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type LogicExtClient interface { - // 注册设备 - RegisterDevice(ctx context.Context, in *RegisterDeviceReq, opts ...grpc.CallOption) (*RegisterDeviceResp, error) - // 发送消息 - SendMessage(ctx context.Context, in *SendMessageReq, opts ...grpc.CallOption) (*SendMessageResp, error) - // 推送消息到房间 - PushRoom(ctx context.Context, in *PushRoomReq, opts ...grpc.CallOption) (*Empty, error) - // 添加好友 - AddFriend(ctx context.Context, in *AddFriendReq, opts ...grpc.CallOption) (*Empty, error) - // 同意添加好友 - AgreeAddFriend(ctx context.Context, in *AgreeAddFriendReq, opts ...grpc.CallOption) (*Empty, error) - // 设置好友信息 - SetFriend(ctx context.Context, in *SetFriendReq, opts ...grpc.CallOption) (*SetFriendResp, error) - // 获取好友列表 - GetFriends(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetFriendsResp, error) - // 创建群组 - CreateGroup(ctx context.Context, in *CreateGroupReq, opts ...grpc.CallOption) (*CreateGroupResp, error) - // 更新群组 - UpdateGroup(ctx context.Context, in *UpdateGroupReq, opts ...grpc.CallOption) (*Empty, error) - // 获取群组信息 - GetGroup(ctx context.Context, in *GetGroupReq, opts ...grpc.CallOption) (*GetGroupResp, error) - // 获取用户加入的所有群组 - GetGroups(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetGroupsResp, error) - // 添加群组成员 - AddGroupMembers(ctx context.Context, in *AddGroupMembersReq, opts ...grpc.CallOption) (*AddGroupMembersResp, error) - // 更新群组成员信息 - UpdateGroupMember(ctx context.Context, in *UpdateGroupMemberReq, opts ...grpc.CallOption) (*Empty, error) - // 添加群组成员 - DeleteGroupMember(ctx context.Context, in *DeleteGroupMemberReq, opts ...grpc.CallOption) (*Empty, error) - // 获取群组成员 - GetGroupMembers(ctx context.Context, in *GetGroupMembersReq, opts ...grpc.CallOption) (*GetGroupMembersResp, error) -} - -type logicExtClient struct { - cc grpc.ClientConnInterface -} - -func NewLogicExtClient(cc grpc.ClientConnInterface) LogicExtClient { - return &logicExtClient{cc} -} - -func (c *logicExtClient) RegisterDevice(ctx context.Context, in *RegisterDeviceReq, opts ...grpc.CallOption) (*RegisterDeviceResp, error) { - out := new(RegisterDeviceResp) - err := c.cc.Invoke(ctx, "/pb.LogicExt/RegisterDevice", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicExtClient) SendMessage(ctx context.Context, in *SendMessageReq, opts ...grpc.CallOption) (*SendMessageResp, error) { - out := new(SendMessageResp) - err := c.cc.Invoke(ctx, "/pb.LogicExt/SendMessage", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicExtClient) PushRoom(ctx context.Context, in *PushRoomReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.LogicExt/PushRoom", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicExtClient) AddFriend(ctx context.Context, in *AddFriendReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.LogicExt/AddFriend", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicExtClient) AgreeAddFriend(ctx context.Context, in *AgreeAddFriendReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.LogicExt/AgreeAddFriend", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicExtClient) SetFriend(ctx context.Context, in *SetFriendReq, opts ...grpc.CallOption) (*SetFriendResp, error) { - out := new(SetFriendResp) - err := c.cc.Invoke(ctx, "/pb.LogicExt/SetFriend", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicExtClient) GetFriends(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetFriendsResp, error) { - out := new(GetFriendsResp) - err := c.cc.Invoke(ctx, "/pb.LogicExt/GetFriends", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicExtClient) CreateGroup(ctx context.Context, in *CreateGroupReq, opts ...grpc.CallOption) (*CreateGroupResp, error) { - out := new(CreateGroupResp) - err := c.cc.Invoke(ctx, "/pb.LogicExt/CreateGroup", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicExtClient) UpdateGroup(ctx context.Context, in *UpdateGroupReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.LogicExt/UpdateGroup", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicExtClient) GetGroup(ctx context.Context, in *GetGroupReq, opts ...grpc.CallOption) (*GetGroupResp, error) { - out := new(GetGroupResp) - err := c.cc.Invoke(ctx, "/pb.LogicExt/GetGroup", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicExtClient) GetGroups(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetGroupsResp, error) { - out := new(GetGroupsResp) - err := c.cc.Invoke(ctx, "/pb.LogicExt/GetGroups", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicExtClient) AddGroupMembers(ctx context.Context, in *AddGroupMembersReq, opts ...grpc.CallOption) (*AddGroupMembersResp, error) { - out := new(AddGroupMembersResp) - err := c.cc.Invoke(ctx, "/pb.LogicExt/AddGroupMembers", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicExtClient) UpdateGroupMember(ctx context.Context, in *UpdateGroupMemberReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.LogicExt/UpdateGroupMember", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicExtClient) DeleteGroupMember(ctx context.Context, in *DeleteGroupMemberReq, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/pb.LogicExt/DeleteGroupMember", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logicExtClient) GetGroupMembers(ctx context.Context, in *GetGroupMembersReq, opts ...grpc.CallOption) (*GetGroupMembersResp, error) { - out := new(GetGroupMembersResp) - err := c.cc.Invoke(ctx, "/pb.LogicExt/GetGroupMembers", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// LogicExtServer is the server API for LogicExt service. -type LogicExtServer interface { - // 注册设备 - RegisterDevice(context.Context, *RegisterDeviceReq) (*RegisterDeviceResp, error) - // 发送消息 - SendMessage(context.Context, *SendMessageReq) (*SendMessageResp, error) - // 推送消息到房间 - PushRoom(context.Context, *PushRoomReq) (*Empty, error) - // 添加好友 - AddFriend(context.Context, *AddFriendReq) (*Empty, error) - // 同意添加好友 - AgreeAddFriend(context.Context, *AgreeAddFriendReq) (*Empty, error) - // 设置好友信息 - SetFriend(context.Context, *SetFriendReq) (*SetFriendResp, error) - // 获取好友列表 - GetFriends(context.Context, *Empty) (*GetFriendsResp, error) - // 创建群组 - CreateGroup(context.Context, *CreateGroupReq) (*CreateGroupResp, error) - // 更新群组 - UpdateGroup(context.Context, *UpdateGroupReq) (*Empty, error) - // 获取群组信息 - GetGroup(context.Context, *GetGroupReq) (*GetGroupResp, error) - // 获取用户加入的所有群组 - GetGroups(context.Context, *Empty) (*GetGroupsResp, error) - // 添加群组成员 - AddGroupMembers(context.Context, *AddGroupMembersReq) (*AddGroupMembersResp, error) - // 更新群组成员信息 - UpdateGroupMember(context.Context, *UpdateGroupMemberReq) (*Empty, error) - // 添加群组成员 - DeleteGroupMember(context.Context, *DeleteGroupMemberReq) (*Empty, error) - // 获取群组成员 - GetGroupMembers(context.Context, *GetGroupMembersReq) (*GetGroupMembersResp, error) -} - -// UnimplementedLogicExtServer can be embedded to have forward compatible implementations. -type UnimplementedLogicExtServer struct { -} - -func (*UnimplementedLogicExtServer) RegisterDevice(context.Context, *RegisterDeviceReq) (*RegisterDeviceResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method RegisterDevice not implemented") -} -func (*UnimplementedLogicExtServer) SendMessage(context.Context, *SendMessageReq) (*SendMessageResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method SendMessage not implemented") -} -func (*UnimplementedLogicExtServer) PushRoom(context.Context, *PushRoomReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method PushRoom not implemented") -} -func (*UnimplementedLogicExtServer) AddFriend(context.Context, *AddFriendReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddFriend not implemented") -} -func (*UnimplementedLogicExtServer) AgreeAddFriend(context.Context, *AgreeAddFriendReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method AgreeAddFriend not implemented") -} -func (*UnimplementedLogicExtServer) SetFriend(context.Context, *SetFriendReq) (*SetFriendResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetFriend not implemented") -} -func (*UnimplementedLogicExtServer) GetFriends(context.Context, *Empty) (*GetFriendsResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetFriends not implemented") -} -func (*UnimplementedLogicExtServer) CreateGroup(context.Context, *CreateGroupReq) (*CreateGroupResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateGroup not implemented") -} -func (*UnimplementedLogicExtServer) UpdateGroup(context.Context, *UpdateGroupReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateGroup not implemented") -} -func (*UnimplementedLogicExtServer) GetGroup(context.Context, *GetGroupReq) (*GetGroupResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetGroup not implemented") -} -func (*UnimplementedLogicExtServer) GetGroups(context.Context, *Empty) (*GetGroupsResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetGroups not implemented") -} -func (*UnimplementedLogicExtServer) AddGroupMembers(context.Context, *AddGroupMembersReq) (*AddGroupMembersResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddGroupMembers not implemented") -} -func (*UnimplementedLogicExtServer) UpdateGroupMember(context.Context, *UpdateGroupMemberReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateGroupMember not implemented") -} -func (*UnimplementedLogicExtServer) DeleteGroupMember(context.Context, *DeleteGroupMemberReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteGroupMember not implemented") -} -func (*UnimplementedLogicExtServer) GetGroupMembers(context.Context, *GetGroupMembersReq) (*GetGroupMembersResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetGroupMembers not implemented") -} - -func RegisterLogicExtServer(s *grpc.Server, srv LogicExtServer) { - s.RegisterService(&_LogicExt_serviceDesc, srv) -} - -func _LogicExt_RegisterDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RegisterDeviceReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).RegisterDevice(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/RegisterDevice", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).RegisterDevice(ctx, req.(*RegisterDeviceReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicExt_SendMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SendMessageReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).SendMessage(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/SendMessage", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).SendMessage(ctx, req.(*SendMessageReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicExt_PushRoom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PushRoomReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).PushRoom(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/PushRoom", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).PushRoom(ctx, req.(*PushRoomReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicExt_AddFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AddFriendReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).AddFriend(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/AddFriend", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).AddFriend(ctx, req.(*AddFriendReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicExt_AgreeAddFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AgreeAddFriendReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).AgreeAddFriend(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/AgreeAddFriend", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).AgreeAddFriend(ctx, req.(*AgreeAddFriendReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicExt_SetFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SetFriendReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).SetFriend(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/SetFriend", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).SetFriend(ctx, req.(*SetFriendReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicExt_GetFriends_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).GetFriends(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/GetFriends", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).GetFriends(ctx, req.(*Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicExt_CreateGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateGroupReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).CreateGroup(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/CreateGroup", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).CreateGroup(ctx, req.(*CreateGroupReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicExt_UpdateGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateGroupReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).UpdateGroup(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/UpdateGroup", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).UpdateGroup(ctx, req.(*UpdateGroupReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicExt_GetGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetGroupReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).GetGroup(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/GetGroup", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).GetGroup(ctx, req.(*GetGroupReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicExt_GetGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).GetGroups(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/GetGroups", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).GetGroups(ctx, req.(*Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicExt_AddGroupMembers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AddGroupMembersReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).AddGroupMembers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/AddGroupMembers", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).AddGroupMembers(ctx, req.(*AddGroupMembersReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicExt_UpdateGroupMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateGroupMemberReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).UpdateGroupMember(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/UpdateGroupMember", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).UpdateGroupMember(ctx, req.(*UpdateGroupMemberReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicExt_DeleteGroupMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteGroupMemberReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).DeleteGroupMember(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/DeleteGroupMember", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).DeleteGroupMember(ctx, req.(*DeleteGroupMemberReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogicExt_GetGroupMembers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetGroupMembersReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogicExtServer).GetGroupMembers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pb.LogicExt/GetGroupMembers", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogicExtServer).GetGroupMembers(ctx, req.(*GetGroupMembersReq)) - } - return interceptor(ctx, in, info, handler) -} - -var _LogicExt_serviceDesc = grpc.ServiceDesc{ - ServiceName: "pb.LogicExt", - HandlerType: (*LogicExtServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "RegisterDevice", - Handler: _LogicExt_RegisterDevice_Handler, - }, - { - MethodName: "SendMessage", - Handler: _LogicExt_SendMessage_Handler, - }, - { - MethodName: "PushRoom", - Handler: _LogicExt_PushRoom_Handler, - }, - { - MethodName: "AddFriend", - Handler: _LogicExt_AddFriend_Handler, - }, - { - MethodName: "AgreeAddFriend", - Handler: _LogicExt_AgreeAddFriend_Handler, - }, - { - MethodName: "SetFriend", - Handler: _LogicExt_SetFriend_Handler, - }, - { - MethodName: "GetFriends", - Handler: _LogicExt_GetFriends_Handler, - }, - { - MethodName: "CreateGroup", - Handler: _LogicExt_CreateGroup_Handler, - }, - { - MethodName: "UpdateGroup", - Handler: _LogicExt_UpdateGroup_Handler, - }, - { - MethodName: "GetGroup", - Handler: _LogicExt_GetGroup_Handler, - }, - { - MethodName: "GetGroups", - Handler: _LogicExt_GetGroups_Handler, - }, - { - MethodName: "AddGroupMembers", - Handler: _LogicExt_AddGroupMembers_Handler, - }, - { - MethodName: "UpdateGroupMember", - Handler: _LogicExt_UpdateGroupMember_Handler, - }, - { - MethodName: "DeleteGroupMember", - Handler: _LogicExt_DeleteGroupMember_Handler, - }, - { - MethodName: "GetGroupMembers", - Handler: _LogicExt_GetGroupMembers_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "logic.ext.proto", -} diff --git a/pkg/protocol/pb/logic.ext_grpc.pb.go b/pkg/protocol/pb/logic.ext_grpc.pb.go new file mode 100644 index 00000000..fdc946c1 --- /dev/null +++ b/pkg/protocol/pb/logic.ext_grpc.pb.go @@ -0,0 +1,678 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.9 +// source: logic.ext.proto + +package pb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + emptypb "google.golang.org/protobuf/types/known/emptypb" +) + +// 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 + +// LogicExtClient is the client API for LogicExt 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 LogicExtClient interface { + // 注册设备 + RegisterDevice(ctx context.Context, in *RegisterDeviceReq, opts ...grpc.CallOption) (*RegisterDeviceResp, error) + // 推送消息到房间 + PushRoom(ctx context.Context, in *PushRoomReq, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 发送好友消息 + SendMessageToFriend(ctx context.Context, in *SendMessageReq, opts ...grpc.CallOption) (*SendMessageResp, error) + // 添加好友 + AddFriend(ctx context.Context, in *AddFriendReq, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 同意添加好友 + AgreeAddFriend(ctx context.Context, in *AgreeAddFriendReq, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 设置好友信息 + SetFriend(ctx context.Context, in *SetFriendReq, opts ...grpc.CallOption) (*SetFriendResp, error) + // 获取好友列表 + GetFriends(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetFriendsResp, error) + // 发送群组消息 + SendMessageToGroup(ctx context.Context, in *SendMessageReq, opts ...grpc.CallOption) (*SendMessageResp, error) + // 创建群组 + CreateGroup(ctx context.Context, in *CreateGroupReq, opts ...grpc.CallOption) (*CreateGroupResp, error) + // 更新群组 + UpdateGroup(ctx context.Context, in *UpdateGroupReq, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 获取群组信息 + GetGroup(ctx context.Context, in *GetGroupReq, opts ...grpc.CallOption) (*GetGroupResp, error) + // 获取用户加入的所有群组 + GetGroups(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetGroupsResp, error) + // 添加群组成员 + AddGroupMembers(ctx context.Context, in *AddGroupMembersReq, opts ...grpc.CallOption) (*AddGroupMembersResp, error) + // 更新群组成员信息 + UpdateGroupMember(ctx context.Context, in *UpdateGroupMemberReq, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 添加群组成员 + DeleteGroupMember(ctx context.Context, in *DeleteGroupMemberReq, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 获取群组成员 + GetGroupMembers(ctx context.Context, in *GetGroupMembersReq, opts ...grpc.CallOption) (*GetGroupMembersResp, error) +} + +type logicExtClient struct { + cc grpc.ClientConnInterface +} + +func NewLogicExtClient(cc grpc.ClientConnInterface) LogicExtClient { + return &logicExtClient{cc} +} + +func (c *logicExtClient) RegisterDevice(ctx context.Context, in *RegisterDeviceReq, opts ...grpc.CallOption) (*RegisterDeviceResp, error) { + out := new(RegisterDeviceResp) + err := c.cc.Invoke(ctx, "/pb.LogicExt/RegisterDevice", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) PushRoom(ctx context.Context, in *PushRoomReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.LogicExt/PushRoom", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) SendMessageToFriend(ctx context.Context, in *SendMessageReq, opts ...grpc.CallOption) (*SendMessageResp, error) { + out := new(SendMessageResp) + err := c.cc.Invoke(ctx, "/pb.LogicExt/SendMessageToFriend", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) AddFriend(ctx context.Context, in *AddFriendReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.LogicExt/AddFriend", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) AgreeAddFriend(ctx context.Context, in *AgreeAddFriendReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.LogicExt/AgreeAddFriend", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) SetFriend(ctx context.Context, in *SetFriendReq, opts ...grpc.CallOption) (*SetFriendResp, error) { + out := new(SetFriendResp) + err := c.cc.Invoke(ctx, "/pb.LogicExt/SetFriend", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) GetFriends(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetFriendsResp, error) { + out := new(GetFriendsResp) + err := c.cc.Invoke(ctx, "/pb.LogicExt/GetFriends", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) SendMessageToGroup(ctx context.Context, in *SendMessageReq, opts ...grpc.CallOption) (*SendMessageResp, error) { + out := new(SendMessageResp) + err := c.cc.Invoke(ctx, "/pb.LogicExt/SendMessageToGroup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) CreateGroup(ctx context.Context, in *CreateGroupReq, opts ...grpc.CallOption) (*CreateGroupResp, error) { + out := new(CreateGroupResp) + err := c.cc.Invoke(ctx, "/pb.LogicExt/CreateGroup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) UpdateGroup(ctx context.Context, in *UpdateGroupReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.LogicExt/UpdateGroup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) GetGroup(ctx context.Context, in *GetGroupReq, opts ...grpc.CallOption) (*GetGroupResp, error) { + out := new(GetGroupResp) + err := c.cc.Invoke(ctx, "/pb.LogicExt/GetGroup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) GetGroups(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetGroupsResp, error) { + out := new(GetGroupsResp) + err := c.cc.Invoke(ctx, "/pb.LogicExt/GetGroups", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) AddGroupMembers(ctx context.Context, in *AddGroupMembersReq, opts ...grpc.CallOption) (*AddGroupMembersResp, error) { + out := new(AddGroupMembersResp) + err := c.cc.Invoke(ctx, "/pb.LogicExt/AddGroupMembers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) UpdateGroupMember(ctx context.Context, in *UpdateGroupMemberReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.LogicExt/UpdateGroupMember", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) DeleteGroupMember(ctx context.Context, in *DeleteGroupMemberReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.LogicExt/DeleteGroupMember", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicExtClient) GetGroupMembers(ctx context.Context, in *GetGroupMembersReq, opts ...grpc.CallOption) (*GetGroupMembersResp, error) { + out := new(GetGroupMembersResp) + err := c.cc.Invoke(ctx, "/pb.LogicExt/GetGroupMembers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// LogicExtServer is the server API for LogicExt service. +// All implementations must embed UnimplementedLogicExtServer +// for forward compatibility +type LogicExtServer interface { + // 注册设备 + RegisterDevice(context.Context, *RegisterDeviceReq) (*RegisterDeviceResp, error) + // 推送消息到房间 + PushRoom(context.Context, *PushRoomReq) (*emptypb.Empty, error) + // 发送好友消息 + SendMessageToFriend(context.Context, *SendMessageReq) (*SendMessageResp, error) + // 添加好友 + AddFriend(context.Context, *AddFriendReq) (*emptypb.Empty, error) + // 同意添加好友 + AgreeAddFriend(context.Context, *AgreeAddFriendReq) (*emptypb.Empty, error) + // 设置好友信息 + SetFriend(context.Context, *SetFriendReq) (*SetFriendResp, error) + // 获取好友列表 + GetFriends(context.Context, *emptypb.Empty) (*GetFriendsResp, error) + // 发送群组消息 + SendMessageToGroup(context.Context, *SendMessageReq) (*SendMessageResp, error) + // 创建群组 + CreateGroup(context.Context, *CreateGroupReq) (*CreateGroupResp, error) + // 更新群组 + UpdateGroup(context.Context, *UpdateGroupReq) (*emptypb.Empty, error) + // 获取群组信息 + GetGroup(context.Context, *GetGroupReq) (*GetGroupResp, error) + // 获取用户加入的所有群组 + GetGroups(context.Context, *emptypb.Empty) (*GetGroupsResp, error) + // 添加群组成员 + AddGroupMembers(context.Context, *AddGroupMembersReq) (*AddGroupMembersResp, error) + // 更新群组成员信息 + UpdateGroupMember(context.Context, *UpdateGroupMemberReq) (*emptypb.Empty, error) + // 添加群组成员 + DeleteGroupMember(context.Context, *DeleteGroupMemberReq) (*emptypb.Empty, error) + // 获取群组成员 + GetGroupMembers(context.Context, *GetGroupMembersReq) (*GetGroupMembersResp, error) + mustEmbedUnimplementedLogicExtServer() +} + +// UnimplementedLogicExtServer must be embedded to have forward compatible implementations. +type UnimplementedLogicExtServer struct { +} + +func (UnimplementedLogicExtServer) RegisterDevice(context.Context, *RegisterDeviceReq) (*RegisterDeviceResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterDevice not implemented") +} +func (UnimplementedLogicExtServer) PushRoom(context.Context, *PushRoomReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method PushRoom not implemented") +} +func (UnimplementedLogicExtServer) SendMessageToFriend(context.Context, *SendMessageReq) (*SendMessageResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendMessageToFriend not implemented") +} +func (UnimplementedLogicExtServer) AddFriend(context.Context, *AddFriendReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddFriend not implemented") +} +func (UnimplementedLogicExtServer) AgreeAddFriend(context.Context, *AgreeAddFriendReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method AgreeAddFriend not implemented") +} +func (UnimplementedLogicExtServer) SetFriend(context.Context, *SetFriendReq) (*SetFriendResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetFriend not implemented") +} +func (UnimplementedLogicExtServer) GetFriends(context.Context, *emptypb.Empty) (*GetFriendsResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFriends not implemented") +} +func (UnimplementedLogicExtServer) SendMessageToGroup(context.Context, *SendMessageReq) (*SendMessageResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendMessageToGroup not implemented") +} +func (UnimplementedLogicExtServer) CreateGroup(context.Context, *CreateGroupReq) (*CreateGroupResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateGroup not implemented") +} +func (UnimplementedLogicExtServer) UpdateGroup(context.Context, *UpdateGroupReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateGroup not implemented") +} +func (UnimplementedLogicExtServer) GetGroup(context.Context, *GetGroupReq) (*GetGroupResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetGroup not implemented") +} +func (UnimplementedLogicExtServer) GetGroups(context.Context, *emptypb.Empty) (*GetGroupsResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetGroups not implemented") +} +func (UnimplementedLogicExtServer) AddGroupMembers(context.Context, *AddGroupMembersReq) (*AddGroupMembersResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddGroupMembers not implemented") +} +func (UnimplementedLogicExtServer) UpdateGroupMember(context.Context, *UpdateGroupMemberReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateGroupMember not implemented") +} +func (UnimplementedLogicExtServer) DeleteGroupMember(context.Context, *DeleteGroupMemberReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteGroupMember not implemented") +} +func (UnimplementedLogicExtServer) GetGroupMembers(context.Context, *GetGroupMembersReq) (*GetGroupMembersResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetGroupMembers not implemented") +} +func (UnimplementedLogicExtServer) mustEmbedUnimplementedLogicExtServer() {} + +// UnsafeLogicExtServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to LogicExtServer will +// result in compilation errors. +type UnsafeLogicExtServer interface { + mustEmbedUnimplementedLogicExtServer() +} + +func RegisterLogicExtServer(s grpc.ServiceRegistrar, srv LogicExtServer) { + s.RegisterService(&LogicExt_ServiceDesc, srv) +} + +func _LogicExt_RegisterDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RegisterDeviceReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).RegisterDevice(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/RegisterDevice", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).RegisterDevice(ctx, req.(*RegisterDeviceReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_PushRoom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PushRoomReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).PushRoom(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/PushRoom", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).PushRoom(ctx, req.(*PushRoomReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_SendMessageToFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SendMessageReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).SendMessageToFriend(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/SendMessageToFriend", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).SendMessageToFriend(ctx, req.(*SendMessageReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_AddFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddFriendReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).AddFriend(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/AddFriend", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).AddFriend(ctx, req.(*AddFriendReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_AgreeAddFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AgreeAddFriendReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).AgreeAddFriend(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/AgreeAddFriend", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).AgreeAddFriend(ctx, req.(*AgreeAddFriendReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_SetFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetFriendReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).SetFriend(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/SetFriend", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).SetFriend(ctx, req.(*SetFriendReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_GetFriends_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).GetFriends(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/GetFriends", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).GetFriends(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_SendMessageToGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SendMessageReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).SendMessageToGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/SendMessageToGroup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).SendMessageToGroup(ctx, req.(*SendMessageReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_CreateGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateGroupReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).CreateGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/CreateGroup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).CreateGroup(ctx, req.(*CreateGroupReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_UpdateGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateGroupReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).UpdateGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/UpdateGroup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).UpdateGroup(ctx, req.(*UpdateGroupReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_GetGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetGroupReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).GetGroup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/GetGroup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).GetGroup(ctx, req.(*GetGroupReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_GetGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).GetGroups(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/GetGroups", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).GetGroups(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_AddGroupMembers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddGroupMembersReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).AddGroupMembers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/AddGroupMembers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).AddGroupMembers(ctx, req.(*AddGroupMembersReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_UpdateGroupMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateGroupMemberReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).UpdateGroupMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/UpdateGroupMember", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).UpdateGroupMember(ctx, req.(*UpdateGroupMemberReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_DeleteGroupMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteGroupMemberReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).DeleteGroupMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/DeleteGroupMember", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).DeleteGroupMember(ctx, req.(*DeleteGroupMemberReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicExt_GetGroupMembers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetGroupMembersReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicExtServer).GetGroupMembers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicExt/GetGroupMembers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicExtServer).GetGroupMembers(ctx, req.(*GetGroupMembersReq)) + } + return interceptor(ctx, in, info, handler) +} + +// LogicExt_ServiceDesc is the grpc.ServiceDesc for LogicExt service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var LogicExt_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "pb.LogicExt", + HandlerType: (*LogicExtServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterDevice", + Handler: _LogicExt_RegisterDevice_Handler, + }, + { + MethodName: "PushRoom", + Handler: _LogicExt_PushRoom_Handler, + }, + { + MethodName: "SendMessageToFriend", + Handler: _LogicExt_SendMessageToFriend_Handler, + }, + { + MethodName: "AddFriend", + Handler: _LogicExt_AddFriend_Handler, + }, + { + MethodName: "AgreeAddFriend", + Handler: _LogicExt_AgreeAddFriend_Handler, + }, + { + MethodName: "SetFriend", + Handler: _LogicExt_SetFriend_Handler, + }, + { + MethodName: "GetFriends", + Handler: _LogicExt_GetFriends_Handler, + }, + { + MethodName: "SendMessageToGroup", + Handler: _LogicExt_SendMessageToGroup_Handler, + }, + { + MethodName: "CreateGroup", + Handler: _LogicExt_CreateGroup_Handler, + }, + { + MethodName: "UpdateGroup", + Handler: _LogicExt_UpdateGroup_Handler, + }, + { + MethodName: "GetGroup", + Handler: _LogicExt_GetGroup_Handler, + }, + { + MethodName: "GetGroups", + Handler: _LogicExt_GetGroups_Handler, + }, + { + MethodName: "AddGroupMembers", + Handler: _LogicExt_AddGroupMembers_Handler, + }, + { + MethodName: "UpdateGroupMember", + Handler: _LogicExt_UpdateGroupMember_Handler, + }, + { + MethodName: "DeleteGroupMember", + Handler: _LogicExt_DeleteGroupMember_Handler, + }, + { + MethodName: "GetGroupMembers", + Handler: _LogicExt_GetGroupMembers_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "logic.ext.proto", +} diff --git a/pkg/protocol/pb/logic.int.pb.go b/pkg/protocol/pb/logic.int.pb.go new file mode 100644 index 00000000..444ab7d3 --- /dev/null +++ b/pkg/protocol/pb/logic.int.pb.go @@ -0,0 +1,1260 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.9 +// source: logic.int.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ConnSignInReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DeviceId int64 `protobuf:"varint,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id + UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户id + Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` // 秘钥 + ConnAddr string `protobuf:"bytes,4,opt,name=conn_addr,json=connAddr,proto3" json:"conn_addr,omitempty"` // 服务器地址 + ClientAddr string `protobuf:"bytes,5,opt,name=client_addr,json=clientAddr,proto3" json:"client_addr,omitempty"` // 客户端地址 +} + +func (x *ConnSignInReq) Reset() { + *x = ConnSignInReq{} + if protoimpl.UnsafeEnabled { + mi := &file_logic_int_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConnSignInReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConnSignInReq) ProtoMessage() {} + +func (x *ConnSignInReq) ProtoReflect() protoreflect.Message { + mi := &file_logic_int_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 ConnSignInReq.ProtoReflect.Descriptor instead. +func (*ConnSignInReq) Descriptor() ([]byte, []int) { + return file_logic_int_proto_rawDescGZIP(), []int{0} +} + +func (x *ConnSignInReq) GetDeviceId() int64 { + if x != nil { + return x.DeviceId + } + return 0 +} + +func (x *ConnSignInReq) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *ConnSignInReq) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *ConnSignInReq) GetConnAddr() string { + if x != nil { + return x.ConnAddr + } + return "" +} + +func (x *ConnSignInReq) GetClientAddr() string { + if x != nil { + return x.ClientAddr + } + return "" +} + +type SyncReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户id + DeviceId int64 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id + Seq int64 `protobuf:"varint,3,opt,name=seq,proto3" json:"seq,omitempty"` // 客户端已经同步的序列号 +} + +func (x *SyncReq) Reset() { + *x = SyncReq{} + if protoimpl.UnsafeEnabled { + mi := &file_logic_int_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncReq) ProtoMessage() {} + +func (x *SyncReq) ProtoReflect() protoreflect.Message { + mi := &file_logic_int_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 SyncReq.ProtoReflect.Descriptor instead. +func (*SyncReq) Descriptor() ([]byte, []int) { + return file_logic_int_proto_rawDescGZIP(), []int{1} +} + +func (x *SyncReq) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *SyncReq) GetDeviceId() int64 { + if x != nil { + return x.DeviceId + } + return 0 +} + +func (x *SyncReq) GetSeq() int64 { + if x != nil { + return x.Seq + } + return 0 +} + +type SyncResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` // 消息列表 + HasMore bool `protobuf:"varint,2,opt,name=has_more,json=hasMore,proto3" json:"has_more,omitempty"` // 是否有更多数据 +} + +func (x *SyncResp) Reset() { + *x = SyncResp{} + if protoimpl.UnsafeEnabled { + mi := &file_logic_int_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncResp) ProtoMessage() {} + +func (x *SyncResp) ProtoReflect() protoreflect.Message { + mi := &file_logic_int_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 SyncResp.ProtoReflect.Descriptor instead. +func (*SyncResp) Descriptor() ([]byte, []int) { + return file_logic_int_proto_rawDescGZIP(), []int{2} +} + +func (x *SyncResp) GetMessages() []*Message { + if x != nil { + return x.Messages + } + return nil +} + +func (x *SyncResp) GetHasMore() bool { + if x != nil { + return x.HasMore + } + return false +} + +type MessageACKReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户id + DeviceId int64 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id + DeviceAck int64 `protobuf:"varint,3,opt,name=device_ack,json=deviceAck,proto3" json:"device_ack,omitempty"` // 设备收到消息的确认号 + ReceiveTime int64 `protobuf:"varint,4,opt,name=receive_time,json=receiveTime,proto3" json:"receive_time,omitempty"` // 消息接收时间戳,精确到毫秒 +} + +func (x *MessageACKReq) Reset() { + *x = MessageACKReq{} + if protoimpl.UnsafeEnabled { + mi := &file_logic_int_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageACKReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageACKReq) ProtoMessage() {} + +func (x *MessageACKReq) ProtoReflect() protoreflect.Message { + mi := &file_logic_int_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 MessageACKReq.ProtoReflect.Descriptor instead. +func (*MessageACKReq) Descriptor() ([]byte, []int) { + return file_logic_int_proto_rawDescGZIP(), []int{3} +} + +func (x *MessageACKReq) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *MessageACKReq) GetDeviceId() int64 { + if x != nil { + return x.DeviceId + } + return 0 +} + +func (x *MessageACKReq) GetDeviceAck() int64 { + if x != nil { + return x.DeviceAck + } + return 0 +} + +func (x *MessageACKReq) GetReceiveTime() int64 { + if x != nil { + return x.ReceiveTime + } + return 0 +} + +type OfflineReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户id + DeviceId int64 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id + ClientAddr string `protobuf:"bytes,3,opt,name=client_addr,json=clientAddr,proto3" json:"client_addr,omitempty"` // 客户端地址 +} + +func (x *OfflineReq) Reset() { + *x = OfflineReq{} + if protoimpl.UnsafeEnabled { + mi := &file_logic_int_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OfflineReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OfflineReq) ProtoMessage() {} + +func (x *OfflineReq) ProtoReflect() protoreflect.Message { + mi := &file_logic_int_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 OfflineReq.ProtoReflect.Descriptor instead. +func (*OfflineReq) Descriptor() ([]byte, []int) { + return file_logic_int_proto_rawDescGZIP(), []int{4} +} + +func (x *OfflineReq) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *OfflineReq) GetDeviceId() int64 { + if x != nil { + return x.DeviceId + } + return 0 +} + +func (x *OfflineReq) GetClientAddr() string { + if x != nil { + return x.ClientAddr + } + return "" +} + +type SubscribeRoomReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户id + DeviceId int64 `protobuf:"varint,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id + RoomId int64 `protobuf:"varint,3,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` // 房间id + Seq int64 `protobuf:"varint,4,opt,name=seq,proto3" json:"seq,omitempty"` // 消息序列号 + ConnAddr string `protobuf:"bytes,5,opt,name=conn_addr,json=connAddr,proto3" json:"conn_addr,omitempty"` // 服务器地址 +} + +func (x *SubscribeRoomReq) Reset() { + *x = SubscribeRoomReq{} + if protoimpl.UnsafeEnabled { + mi := &file_logic_int_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeRoomReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeRoomReq) ProtoMessage() {} + +func (x *SubscribeRoomReq) ProtoReflect() protoreflect.Message { + mi := &file_logic_int_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 SubscribeRoomReq.ProtoReflect.Descriptor instead. +func (*SubscribeRoomReq) Descriptor() ([]byte, []int) { + return file_logic_int_proto_rawDescGZIP(), []int{5} +} + +func (x *SubscribeRoomReq) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *SubscribeRoomReq) GetDeviceId() int64 { + if x != nil { + return x.DeviceId + } + return 0 +} + +func (x *SubscribeRoomReq) GetRoomId() int64 { + if x != nil { + return x.RoomId + } + return 0 +} + +func (x *SubscribeRoomReq) GetSeq() int64 { + if x != nil { + return x.Seq + } + return 0 +} + +func (x *SubscribeRoomReq) GetConnAddr() string { + if x != nil { + return x.ConnAddr + } + return "" +} + +type PushReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户ID + Code int32 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"` // 推送码 + Content []byte `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` // 推送内容 + IsPersist bool `protobuf:"varint,4,opt,name=is_persist,json=isPersist,proto3" json:"is_persist,omitempty"` // 是否持久化 +} + +func (x *PushReq) Reset() { + *x = PushReq{} + if protoimpl.UnsafeEnabled { + mi := &file_logic_int_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushReq) ProtoMessage() {} + +func (x *PushReq) ProtoReflect() protoreflect.Message { + mi := &file_logic_int_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 PushReq.ProtoReflect.Descriptor instead. +func (*PushReq) Descriptor() ([]byte, []int) { + return file_logic_int_proto_rawDescGZIP(), []int{6} +} + +func (x *PushReq) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *PushReq) GetCode() int32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *PushReq) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +func (x *PushReq) GetIsPersist() bool { + if x != nil { + return x.IsPersist + } + return false +} + +type PushResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Seq int64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` +} + +func (x *PushResp) Reset() { + *x = PushResp{} + if protoimpl.UnsafeEnabled { + mi := &file_logic_int_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushResp) ProtoMessage() {} + +func (x *PushResp) ProtoReflect() protoreflect.Message { + mi := &file_logic_int_proto_msgTypes[7] + 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 PushResp.ProtoReflect.Descriptor instead. +func (*PushResp) Descriptor() ([]byte, []int) { + return file_logic_int_proto_rawDescGZIP(), []int{7} +} + +func (x *PushResp) GetSeq() int64 { + if x != nil { + return x.Seq + } + return 0 +} + +type PushAllReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` // 推送码 + Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` // 推送内容 +} + +func (x *PushAllReq) Reset() { + *x = PushAllReq{} + if protoimpl.UnsafeEnabled { + mi := &file_logic_int_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushAllReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushAllReq) ProtoMessage() {} + +func (x *PushAllReq) ProtoReflect() protoreflect.Message { + mi := &file_logic_int_proto_msgTypes[8] + 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 PushAllReq.ProtoReflect.Descriptor instead. +func (*PushAllReq) Descriptor() ([]byte, []int) { + return file_logic_int_proto_rawDescGZIP(), []int{8} +} + +func (x *PushAllReq) GetCode() int32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *PushAllReq) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +type GetDeviceReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DeviceId int64 `protobuf:"varint,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` +} + +func (x *GetDeviceReq) Reset() { + *x = GetDeviceReq{} + if protoimpl.UnsafeEnabled { + mi := &file_logic_int_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDeviceReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDeviceReq) ProtoMessage() {} + +func (x *GetDeviceReq) ProtoReflect() protoreflect.Message { + mi := &file_logic_int_proto_msgTypes[9] + 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 GetDeviceReq.ProtoReflect.Descriptor instead. +func (*GetDeviceReq) Descriptor() ([]byte, []int) { + return file_logic_int_proto_rawDescGZIP(), []int{9} +} + +func (x *GetDeviceReq) GetDeviceId() int64 { + if x != nil { + return x.DeviceId + } + return 0 +} + +type GetDeviceResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Device *Device `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"` +} + +func (x *GetDeviceResp) Reset() { + *x = GetDeviceResp{} + if protoimpl.UnsafeEnabled { + mi := &file_logic_int_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDeviceResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDeviceResp) ProtoMessage() {} + +func (x *GetDeviceResp) ProtoReflect() protoreflect.Message { + mi := &file_logic_int_proto_msgTypes[10] + 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 GetDeviceResp.ProtoReflect.Descriptor instead. +func (*GetDeviceResp) Descriptor() ([]byte, []int) { + return file_logic_int_proto_rawDescGZIP(), []int{10} +} + +func (x *GetDeviceResp) GetDevice() *Device { + if x != nil { + return x.Device + } + return nil +} + +type Device struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DeviceId int64 `protobuf:"varint,1,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 设备id + UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户id + Type int32 `protobuf:"varint,3,opt,name=type,proto3" json:"type,omitempty"` // 设备类型,1:Android;2:IOS;3:Windows; 4:MacOS;5:Web + Brand string `protobuf:"bytes,4,opt,name=brand,proto3" json:"brand,omitempty"` // 手机厂商 + Model string `protobuf:"bytes,5,opt,name=model,proto3" json:"model,omitempty"` // 机型 + SystemVersion string `protobuf:"bytes,6,opt,name=system_version,json=systemVersion,proto3" json:"system_version,omitempty"` // 系统版本 + SdkVersion string `protobuf:"bytes,7,opt,name=sdk_version,json=sdkVersion,proto3" json:"sdk_version,omitempty"` // SDK版本 + Status int32 `protobuf:"varint,8,opt,name=status,proto3" json:"status,omitempty"` // 在线状态,0:不在线;1:在线 + ConnAddr string `protobuf:"bytes,9,opt,name=conn_addr,json=connAddr,proto3" json:"conn_addr,omitempty"` // 服务端连接地址 + ClientAddr string `protobuf:"bytes,10,opt,name=client_addr,json=clientAddr,proto3" json:"client_addr,omitempty"` // 客户端地址 + CreateTime int64 `protobuf:"varint,11,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` // 创建时间 + UpdateTime int64 `protobuf:"varint,12,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` // 更新时间 +} + +func (x *Device) Reset() { + *x = Device{} + if protoimpl.UnsafeEnabled { + mi := &file_logic_int_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Device) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Device) ProtoMessage() {} + +func (x *Device) ProtoReflect() protoreflect.Message { + mi := &file_logic_int_proto_msgTypes[11] + 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 Device.ProtoReflect.Descriptor instead. +func (*Device) Descriptor() ([]byte, []int) { + return file_logic_int_proto_rawDescGZIP(), []int{11} +} + +func (x *Device) GetDeviceId() int64 { + if x != nil { + return x.DeviceId + } + return 0 +} + +func (x *Device) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *Device) GetType() int32 { + if x != nil { + return x.Type + } + return 0 +} + +func (x *Device) GetBrand() string { + if x != nil { + return x.Brand + } + return "" +} + +func (x *Device) GetModel() string { + if x != nil { + return x.Model + } + return "" +} + +func (x *Device) GetSystemVersion() string { + if x != nil { + return x.SystemVersion + } + return "" +} + +func (x *Device) GetSdkVersion() string { + if x != nil { + return x.SdkVersion + } + return "" +} + +func (x *Device) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *Device) GetConnAddr() string { + if x != nil { + return x.ConnAddr + } + return "" +} + +func (x *Device) GetClientAddr() string { + if x != nil { + return x.ClientAddr + } + return "" +} + +func (x *Device) GetCreateTime() int64 { + if x != nil { + return x.CreateTime + } + return 0 +} + +func (x *Device) GetUpdateTime() int64 { + if x != nil { + return x.UpdateTime + } + return 0 +} + +type ServerStopReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConnAddr string `protobuf:"bytes,1,opt,name=conn_addr,json=connAddr,proto3" json:"conn_addr,omitempty"` +} + +func (x *ServerStopReq) Reset() { + *x = ServerStopReq{} + if protoimpl.UnsafeEnabled { + mi := &file_logic_int_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServerStopReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerStopReq) ProtoMessage() {} + +func (x *ServerStopReq) ProtoReflect() protoreflect.Message { + mi := &file_logic_int_proto_msgTypes[12] + 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 ServerStopReq.ProtoReflect.Descriptor instead. +func (*ServerStopReq) Descriptor() ([]byte, []int) { + return file_logic_int_proto_rawDescGZIP(), []int{12} +} + +func (x *ServerStopReq) GetConnAddr() string { + if x != nil { + return x.ConnAddr + } + return "" +} + +var File_logic_int_proto protoreflect.FileDescriptor + +var file_logic_int_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x2e, 0x69, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x0f, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x65, 0x78, 0x74, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x99, 0x01, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x6e, 0x53, + 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, + 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x6e, 0x41, 0x64, 0x64, + 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x41, 0x64, + 0x64, 0x72, 0x22, 0x51, 0x0a, 0x07, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, + 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, + 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x03, 0x73, 0x65, 0x71, 0x22, 0x4e, 0x0a, 0x08, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x27, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x68, 0x61, + 0x73, 0x5f, 0x6d, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x68, 0x61, + 0x73, 0x4d, 0x6f, 0x72, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x0d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x41, 0x43, 0x4b, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, + 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, + 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x61, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x41, 0x63, 0x6b, 0x12, 0x21, 0x0a, 0x0c, + 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0b, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, + 0x63, 0x0a, 0x0a, 0x4f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, + 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, + 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x41, 0x64, 0x64, 0x72, 0x22, 0x90, 0x01, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x62, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, + 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, + 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x73, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, + 0x6e, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, + 0x6f, 0x6e, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x22, 0x6f, 0x0a, 0x07, 0x50, 0x75, 0x73, 0x68, 0x52, + 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, + 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, + 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, + 0x73, 0x50, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x08, 0x50, 0x75, 0x73, 0x68, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x03, 0x73, 0x65, 0x71, 0x22, 0x3a, 0x0a, 0x0a, 0x50, 0x75, 0x73, 0x68, 0x41, 0x6c, + 0x6c, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x22, 0x2b, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, + 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, + 0x33, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x22, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x06, 0x64, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x22, 0xde, 0x02, 0x0a, 0x06, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, + 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, + 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x72, 0x61, + 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x12, + 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, + 0x73, 0x64, 0x6b, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x73, 0x64, 0x6b, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x6e, 0x41, 0x64, + 0x64, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x41, + 0x64, 0x64, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, + 0x6d, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, + 0x69, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x2c, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, + 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x6e, 0x41, + 0x64, 0x64, 0x72, 0x32, 0x87, 0x04, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x49, 0x6e, 0x74, + 0x12, 0x37, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x12, 0x11, + 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, + 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x21, 0x0a, 0x04, 0x53, 0x79, 0x6e, + 0x63, 0x12, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x1a, 0x0c, + 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x12, 0x37, 0x0a, 0x0a, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x43, 0x4b, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x43, 0x4b, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x4f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, + 0x12, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, + 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3d, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x1a, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x21, 0x0a, 0x04, 0x50, 0x75, 0x73, 0x68, 0x12, + 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x70, + 0x62, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x33, 0x0a, 0x08, 0x50, 0x75, + 0x73, 0x68, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x73, 0x68, + 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, + 0x31, 0x0a, 0x07, 0x50, 0x75, 0x73, 0x68, 0x41, 0x6c, 0x6c, 0x12, 0x0e, 0x2e, 0x70, 0x62, 0x2e, + 0x50, 0x75, 0x73, 0x68, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x12, 0x30, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, + 0x71, 0x1a, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x37, 0x0a, 0x0a, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, + 0x6f, 0x70, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, + 0x6f, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x15, 0x5a, + 0x13, 0x67, 0x69, 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_logic_int_proto_rawDescOnce sync.Once + file_logic_int_proto_rawDescData = file_logic_int_proto_rawDesc +) + +func file_logic_int_proto_rawDescGZIP() []byte { + file_logic_int_proto_rawDescOnce.Do(func() { + file_logic_int_proto_rawDescData = protoimpl.X.CompressGZIP(file_logic_int_proto_rawDescData) + }) + return file_logic_int_proto_rawDescData +} + +var file_logic_int_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_logic_int_proto_goTypes = []interface{}{ + (*ConnSignInReq)(nil), // 0: pb.ConnSignInReq + (*SyncReq)(nil), // 1: pb.SyncReq + (*SyncResp)(nil), // 2: pb.SyncResp + (*MessageACKReq)(nil), // 3: pb.MessageACKReq + (*OfflineReq)(nil), // 4: pb.OfflineReq + (*SubscribeRoomReq)(nil), // 5: pb.SubscribeRoomReq + (*PushReq)(nil), // 6: pb.PushReq + (*PushResp)(nil), // 7: pb.PushResp + (*PushAllReq)(nil), // 8: pb.PushAllReq + (*GetDeviceReq)(nil), // 9: pb.GetDeviceReq + (*GetDeviceResp)(nil), // 10: pb.GetDeviceResp + (*Device)(nil), // 11: pb.Device + (*ServerStopReq)(nil), // 12: pb.ServerStopReq + (*Message)(nil), // 13: pb.Message + (*PushRoomReq)(nil), // 14: pb.PushRoomReq + (*emptypb.Empty)(nil), // 15: google.protobuf.Empty +} +var file_logic_int_proto_depIdxs = []int32{ + 13, // 0: pb.SyncResp.messages:type_name -> pb.Message + 11, // 1: pb.GetDeviceResp.device:type_name -> pb.Device + 0, // 2: pb.LogicInt.ConnSignIn:input_type -> pb.ConnSignInReq + 1, // 3: pb.LogicInt.Sync:input_type -> pb.SyncReq + 3, // 4: pb.LogicInt.MessageACK:input_type -> pb.MessageACKReq + 4, // 5: pb.LogicInt.Offline:input_type -> pb.OfflineReq + 5, // 6: pb.LogicInt.SubscribeRoom:input_type -> pb.SubscribeRoomReq + 6, // 7: pb.LogicInt.Push:input_type -> pb.PushReq + 14, // 8: pb.LogicInt.PushRoom:input_type -> pb.PushRoomReq + 8, // 9: pb.LogicInt.PushAll:input_type -> pb.PushAllReq + 9, // 10: pb.LogicInt.GetDevice:input_type -> pb.GetDeviceReq + 12, // 11: pb.LogicInt.ServerStop:input_type -> pb.ServerStopReq + 15, // 12: pb.LogicInt.ConnSignIn:output_type -> google.protobuf.Empty + 2, // 13: pb.LogicInt.Sync:output_type -> pb.SyncResp + 15, // 14: pb.LogicInt.MessageACK:output_type -> google.protobuf.Empty + 15, // 15: pb.LogicInt.Offline:output_type -> google.protobuf.Empty + 15, // 16: pb.LogicInt.SubscribeRoom:output_type -> google.protobuf.Empty + 7, // 17: pb.LogicInt.Push:output_type -> pb.PushResp + 15, // 18: pb.LogicInt.PushRoom:output_type -> google.protobuf.Empty + 15, // 19: pb.LogicInt.PushAll:output_type -> google.protobuf.Empty + 10, // 20: pb.LogicInt.GetDevice:output_type -> pb.GetDeviceResp + 15, // 21: pb.LogicInt.ServerStop:output_type -> google.protobuf.Empty + 12, // [12:22] is the sub-list for method output_type + 2, // [2:12] 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_logic_int_proto_init() } +func file_logic_int_proto_init() { + if File_logic_int_proto != nil { + return + } + file_logic_ext_proto_init() + file_message_ext_proto_init() + if !protoimpl.UnsafeEnabled { + file_logic_int_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConnSignInReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_logic_int_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_logic_int_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_logic_int_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageACKReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_logic_int_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OfflineReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_logic_int_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeRoomReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_logic_int_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_logic_int_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_logic_int_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushAllReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_logic_int_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDeviceReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_logic_int_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDeviceResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_logic_int_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Device); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_logic_int_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServerStopReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_logic_int_proto_rawDesc, + NumEnums: 0, + NumMessages: 13, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_logic_int_proto_goTypes, + DependencyIndexes: file_logic_int_proto_depIdxs, + MessageInfos: file_logic_int_proto_msgTypes, + }.Build() + File_logic_int_proto = out.File + file_logic_int_proto_rawDesc = nil + file_logic_int_proto_goTypes = nil + file_logic_int_proto_depIdxs = nil +} diff --git a/pkg/protocol/pb/logic.int_grpc.pb.go b/pkg/protocol/pb/logic.int_grpc.pb.go new file mode 100644 index 00000000..8350e15d --- /dev/null +++ b/pkg/protocol/pb/logic.int_grpc.pb.go @@ -0,0 +1,450 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.9 +// source: logic.int.proto + +package pb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + emptypb "google.golang.org/protobuf/types/known/emptypb" +) + +// 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 + +// LogicIntClient is the client API for LogicInt 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 LogicIntClient interface { + // 登录 + ConnSignIn(ctx context.Context, in *ConnSignInReq, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 消息同步 + Sync(ctx context.Context, in *SyncReq, opts ...grpc.CallOption) (*SyncResp, error) + // 设备收到消息回执 + MessageACK(ctx context.Context, in *MessageACKReq, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 设备离线 + Offline(ctx context.Context, in *OfflineReq, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 订阅房间 + SubscribeRoom(ctx context.Context, in *SubscribeRoomReq, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 推送 + Push(ctx context.Context, in *PushReq, opts ...grpc.CallOption) (*PushResp, error) + // 推送消息到房间 + PushRoom(ctx context.Context, in *PushRoomReq, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 全服推送 + PushAll(ctx context.Context, in *PushAllReq, opts ...grpc.CallOption) (*emptypb.Empty, error) + // 获取设备信息 + GetDevice(ctx context.Context, in *GetDeviceReq, opts ...grpc.CallOption) (*GetDeviceResp, error) + // 服务停止 + ServerStop(ctx context.Context, in *ServerStopReq, opts ...grpc.CallOption) (*emptypb.Empty, error) +} + +type logicIntClient struct { + cc grpc.ClientConnInterface +} + +func NewLogicIntClient(cc grpc.ClientConnInterface) LogicIntClient { + return &logicIntClient{cc} +} + +func (c *logicIntClient) ConnSignIn(ctx context.Context, in *ConnSignInReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.LogicInt/ConnSignIn", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicIntClient) Sync(ctx context.Context, in *SyncReq, opts ...grpc.CallOption) (*SyncResp, error) { + out := new(SyncResp) + err := c.cc.Invoke(ctx, "/pb.LogicInt/Sync", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicIntClient) MessageACK(ctx context.Context, in *MessageACKReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.LogicInt/MessageACK", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicIntClient) Offline(ctx context.Context, in *OfflineReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.LogicInt/Offline", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicIntClient) SubscribeRoom(ctx context.Context, in *SubscribeRoomReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.LogicInt/SubscribeRoom", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicIntClient) Push(ctx context.Context, in *PushReq, opts ...grpc.CallOption) (*PushResp, error) { + out := new(PushResp) + err := c.cc.Invoke(ctx, "/pb.LogicInt/Push", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicIntClient) PushRoom(ctx context.Context, in *PushRoomReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.LogicInt/PushRoom", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicIntClient) PushAll(ctx context.Context, in *PushAllReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.LogicInt/PushAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicIntClient) GetDevice(ctx context.Context, in *GetDeviceReq, opts ...grpc.CallOption) (*GetDeviceResp, error) { + out := new(GetDeviceResp) + err := c.cc.Invoke(ctx, "/pb.LogicInt/GetDevice", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *logicIntClient) ServerStop(ctx context.Context, in *ServerStopReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/pb.LogicInt/ServerStop", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// LogicIntServer is the server API for LogicInt service. +// All implementations must embed UnimplementedLogicIntServer +// for forward compatibility +type LogicIntServer interface { + // 登录 + ConnSignIn(context.Context, *ConnSignInReq) (*emptypb.Empty, error) + // 消息同步 + Sync(context.Context, *SyncReq) (*SyncResp, error) + // 设备收到消息回执 + MessageACK(context.Context, *MessageACKReq) (*emptypb.Empty, error) + // 设备离线 + Offline(context.Context, *OfflineReq) (*emptypb.Empty, error) + // 订阅房间 + SubscribeRoom(context.Context, *SubscribeRoomReq) (*emptypb.Empty, error) + // 推送 + Push(context.Context, *PushReq) (*PushResp, error) + // 推送消息到房间 + PushRoom(context.Context, *PushRoomReq) (*emptypb.Empty, error) + // 全服推送 + PushAll(context.Context, *PushAllReq) (*emptypb.Empty, error) + // 获取设备信息 + GetDevice(context.Context, *GetDeviceReq) (*GetDeviceResp, error) + // 服务停止 + ServerStop(context.Context, *ServerStopReq) (*emptypb.Empty, error) + mustEmbedUnimplementedLogicIntServer() +} + +// UnimplementedLogicIntServer must be embedded to have forward compatible implementations. +type UnimplementedLogicIntServer struct { +} + +func (UnimplementedLogicIntServer) ConnSignIn(context.Context, *ConnSignInReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConnSignIn not implemented") +} +func (UnimplementedLogicIntServer) Sync(context.Context, *SyncReq) (*SyncResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented") +} +func (UnimplementedLogicIntServer) MessageACK(context.Context, *MessageACKReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method MessageACK not implemented") +} +func (UnimplementedLogicIntServer) Offline(context.Context, *OfflineReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method Offline not implemented") +} +func (UnimplementedLogicIntServer) SubscribeRoom(context.Context, *SubscribeRoomReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubscribeRoom not implemented") +} +func (UnimplementedLogicIntServer) Push(context.Context, *PushReq) (*PushResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method Push not implemented") +} +func (UnimplementedLogicIntServer) PushRoom(context.Context, *PushRoomReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method PushRoom not implemented") +} +func (UnimplementedLogicIntServer) PushAll(context.Context, *PushAllReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method PushAll not implemented") +} +func (UnimplementedLogicIntServer) GetDevice(context.Context, *GetDeviceReq) (*GetDeviceResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDevice not implemented") +} +func (UnimplementedLogicIntServer) ServerStop(context.Context, *ServerStopReq) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method ServerStop not implemented") +} +func (UnimplementedLogicIntServer) mustEmbedUnimplementedLogicIntServer() {} + +// UnsafeLogicIntServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to LogicIntServer will +// result in compilation errors. +type UnsafeLogicIntServer interface { + mustEmbedUnimplementedLogicIntServer() +} + +func RegisterLogicIntServer(s grpc.ServiceRegistrar, srv LogicIntServer) { + s.RegisterService(&LogicInt_ServiceDesc, srv) +} + +func _LogicInt_ConnSignIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConnSignInReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicIntServer).ConnSignIn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicInt/ConnSignIn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicIntServer).ConnSignIn(ctx, req.(*ConnSignInReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicInt_Sync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SyncReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicIntServer).Sync(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicInt/Sync", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicIntServer).Sync(ctx, req.(*SyncReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicInt_MessageACK_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MessageACKReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicIntServer).MessageACK(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicInt/MessageACK", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicIntServer).MessageACK(ctx, req.(*MessageACKReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicInt_Offline_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OfflineReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicIntServer).Offline(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicInt/Offline", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicIntServer).Offline(ctx, req.(*OfflineReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicInt_SubscribeRoom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SubscribeRoomReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicIntServer).SubscribeRoom(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicInt/SubscribeRoom", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicIntServer).SubscribeRoom(ctx, req.(*SubscribeRoomReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicInt_Push_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PushReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicIntServer).Push(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicInt/Push", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicIntServer).Push(ctx, req.(*PushReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicInt_PushRoom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PushRoomReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicIntServer).PushRoom(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicInt/PushRoom", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicIntServer).PushRoom(ctx, req.(*PushRoomReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicInt_PushAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PushAllReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicIntServer).PushAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicInt/PushAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicIntServer).PushAll(ctx, req.(*PushAllReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicInt_GetDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDeviceReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicIntServer).GetDevice(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicInt/GetDevice", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicIntServer).GetDevice(ctx, req.(*GetDeviceReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _LogicInt_ServerStop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ServerStopReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LogicIntServer).ServerStop(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.LogicInt/ServerStop", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LogicIntServer).ServerStop(ctx, req.(*ServerStopReq)) + } + return interceptor(ctx, in, info, handler) +} + +// LogicInt_ServiceDesc is the grpc.ServiceDesc for LogicInt service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var LogicInt_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "pb.LogicInt", + HandlerType: (*LogicIntServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ConnSignIn", + Handler: _LogicInt_ConnSignIn_Handler, + }, + { + MethodName: "Sync", + Handler: _LogicInt_Sync_Handler, + }, + { + MethodName: "MessageACK", + Handler: _LogicInt_MessageACK_Handler, + }, + { + MethodName: "Offline", + Handler: _LogicInt_Offline_Handler, + }, + { + MethodName: "SubscribeRoom", + Handler: _LogicInt_SubscribeRoom_Handler, + }, + { + MethodName: "Push", + Handler: _LogicInt_Push_Handler, + }, + { + MethodName: "PushRoom", + Handler: _LogicInt_PushRoom_Handler, + }, + { + MethodName: "PushAll", + Handler: _LogicInt_PushAll_Handler, + }, + { + MethodName: "GetDevice", + Handler: _LogicInt_GetDevice_Handler, + }, + { + MethodName: "ServerStop", + Handler: _LogicInt_ServerStop_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "logic.int.proto", +} diff --git a/pkg/protocol/pb/message.ext.pb.go b/pkg/protocol/pb/message.ext.pb.go new file mode 100644 index 00000000..09bfdc59 --- /dev/null +++ b/pkg/protocol/pb/message.ext.pb.go @@ -0,0 +1,235 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.9 +// source: message.ext.proto + +package pb + +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) +) + +type MessageStatus int32 + +const ( + MessageStatus_MS_NORMAL MessageStatus = 0 // 正常的 + MessageStatus_MS_RECALL MessageStatus = 1 // 撤回 +) + +// Enum value maps for MessageStatus. +var ( + MessageStatus_name = map[int32]string{ + 0: "MS_NORMAL", + 1: "MS_RECALL", + } + MessageStatus_value = map[string]int32{ + "MS_NORMAL": 0, + "MS_RECALL": 1, + } +) + +func (x MessageStatus) Enum() *MessageStatus { + p := new(MessageStatus) + *p = x + return p +} + +func (x MessageStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MessageStatus) Descriptor() protoreflect.EnumDescriptor { + return file_message_ext_proto_enumTypes[0].Descriptor() +} + +func (MessageStatus) Type() protoreflect.EnumType { + return &file_message_ext_proto_enumTypes[0] +} + +func (x MessageStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use MessageStatus.Descriptor instead. +func (MessageStatus) EnumDescriptor() ([]byte, []int) { + return file_message_ext_proto_rawDescGZIP(), []int{0} +} + +// 单条消息投递内容(估算大约100个字节),todo 通知栏提醒 +type Message struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` // 推送码 + Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` // 推送内容 + Seq int64 `protobuf:"varint,3,opt,name=seq,proto3" json:"seq,omitempty"` // 用户消息发送序列号 + SendTime int64 `protobuf:"varint,4,opt,name=send_time,json=sendTime,proto3" json:"send_time,omitempty"` // 消息发送时间戳,精确到毫秒 + Status MessageStatus `protobuf:"varint,5,opt,name=status,proto3,enum=pb.MessageStatus" json:"status,omitempty"` // 消息状态 +} + +func (x *Message) Reset() { + *x = Message{} + if protoimpl.UnsafeEnabled { + mi := &file_message_ext_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Message) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Message) ProtoMessage() {} + +func (x *Message) ProtoReflect() protoreflect.Message { + mi := &file_message_ext_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 Message.ProtoReflect.Descriptor instead. +func (*Message) Descriptor() ([]byte, []int) { + return file_message_ext_proto_rawDescGZIP(), []int{0} +} + +func (x *Message) GetCode() int32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *Message) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +func (x *Message) GetSeq() int64 { + if x != nil { + return x.Seq + } + return 0 +} + +func (x *Message) GetSendTime() int64 { + if x != nil { + return x.SendTime + } + return 0 +} + +func (x *Message) GetStatus() MessageStatus { + if x != nil { + return x.Status + } + return MessageStatus_MS_NORMAL +} + +var File_message_ext_proto protoreflect.FileDescriptor + +var file_message_ext_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x91, 0x01, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, + 0x73, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, + 0x12, 0x29, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2a, 0x2d, 0x0a, 0x0d, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0d, 0x0a, 0x09, + 0x4d, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4d, + 0x53, 0x5f, 0x52, 0x45, 0x43, 0x41, 0x4c, 0x4c, 0x10, 0x01, 0x42, 0x15, 0x5a, 0x13, 0x67, 0x69, + 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_message_ext_proto_rawDescOnce sync.Once + file_message_ext_proto_rawDescData = file_message_ext_proto_rawDesc +) + +func file_message_ext_proto_rawDescGZIP() []byte { + file_message_ext_proto_rawDescOnce.Do(func() { + file_message_ext_proto_rawDescData = protoimpl.X.CompressGZIP(file_message_ext_proto_rawDescData) + }) + return file_message_ext_proto_rawDescData +} + +var file_message_ext_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_message_ext_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_message_ext_proto_goTypes = []interface{}{ + (MessageStatus)(0), // 0: pb.MessageStatus + (*Message)(nil), // 1: pb.Message +} +var file_message_ext_proto_depIdxs = []int32{ + 0, // 0: pb.Message.status:type_name -> pb.MessageStatus + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_message_ext_proto_init() } +func file_message_ext_proto_init() { + if File_message_ext_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_message_ext_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_message_ext_proto_rawDesc, + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_message_ext_proto_goTypes, + DependencyIndexes: file_message_ext_proto_depIdxs, + EnumInfos: file_message_ext_proto_enumTypes, + MessageInfos: file_message_ext_proto_msgTypes, + }.Build() + File_message_ext_proto = out.File + file_message_ext_proto_rawDesc = nil + file_message_ext_proto_goTypes = nil + file_message_ext_proto_depIdxs = nil +} diff --git a/pkg/pb/push.ext.pb.go b/pkg/protocol/pb/push.ext.pb.go similarity index 52% rename from pkg/pb/push.ext.pb.go rename to pkg/protocol/pb/push.ext.pb.go index 616a85aa..ce2a25d3 100644 --- a/pkg/pb/push.ext.pb.go +++ b/pkg/protocol/pb/push.ext.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.14.0 +// protoc-gen-go v1.28.1 +// protoc v3.21.9 // source: push.ext.proto package pb @@ -24,30 +24,36 @@ type PushCode int32 const ( PushCode_PC_ADD_DEFAULT PushCode = 0 - PushCode_PC_ADD_FRIEND PushCode = 100 // 添加好友请求 - PushCode_PC_AGREE_ADD_FRIEND PushCode = 101 // 同意添加好友 - PushCode_PC_UPDATE_GROUP PushCode = 110 // 更新群组 - PushCode_PC_ADD_GROUP_MEMBERS PushCode = 120 // 添加群组成员 - PushCode_PC_REMOVE_GROUP_MEMBER PushCode = 121 // 移除群组成员 + PushCode_PC_USER_MESSAGE PushCode = 100 // 用户消息 + PushCode_PC_GROUP_MESSAGE PushCode = 101 // 群组消息 + PushCode_PC_ADD_FRIEND PushCode = 110 // 添加好友请求 + PushCode_PC_AGREE_ADD_FRIEND PushCode = 111 // 同意添加好友 + PushCode_PC_UPDATE_GROUP PushCode = 120 // 更新群组 + PushCode_PC_ADD_GROUP_MEMBERS PushCode = 121 // 添加群组成员 + PushCode_PC_REMOVE_GROUP_MEMBER PushCode = 122 // 移除群组成员 ) // Enum value maps for PushCode. var ( PushCode_name = map[int32]string{ 0: "PC_ADD_DEFAULT", - 100: "PC_ADD_FRIEND", - 101: "PC_AGREE_ADD_FRIEND", - 110: "PC_UPDATE_GROUP", - 120: "PC_ADD_GROUP_MEMBERS", - 121: "PC_REMOVE_GROUP_MEMBER", + 100: "PC_USER_MESSAGE", + 101: "PC_GROUP_MESSAGE", + 110: "PC_ADD_FRIEND", + 111: "PC_AGREE_ADD_FRIEND", + 120: "PC_UPDATE_GROUP", + 121: "PC_ADD_GROUP_MEMBERS", + 122: "PC_REMOVE_GROUP_MEMBER", } PushCode_value = map[string]int32{ "PC_ADD_DEFAULT": 0, - "PC_ADD_FRIEND": 100, - "PC_AGREE_ADD_FRIEND": 101, - "PC_UPDATE_GROUP": 110, - "PC_ADD_GROUP_MEMBERS": 120, - "PC_REMOVE_GROUP_MEMBER": 121, + "PC_USER_MESSAGE": 100, + "PC_GROUP_MESSAGE": 101, + "PC_ADD_FRIEND": 110, + "PC_AGREE_ADD_FRIEND": 111, + "PC_UPDATE_GROUP": 120, + "PC_ADD_GROUP_MEMBERS": 121, + "PC_REMOVE_GROUP_MEMBER": 122, } ) @@ -78,7 +84,150 @@ func (PushCode) EnumDescriptor() ([]byte, []int) { return file_push_ext_proto_rawDescGZIP(), []int{0} } -// 推送码 PC_ADD_FRIEND = 100 +type Sender struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 发送者id + DeviceId int64 `protobuf:"varint,3,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"` // 发送者设备id + AvatarUrl string `protobuf:"bytes,4,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` // 昵称 + Nickname string `protobuf:"bytes,5,opt,name=nickname,proto3" json:"nickname,omitempty"` // 头像 + Extra string `protobuf:"bytes,6,opt,name=extra,proto3" json:"extra,omitempty"` // 扩展字段 +} + +func (x *Sender) Reset() { + *x = Sender{} + if protoimpl.UnsafeEnabled { + mi := &file_push_ext_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Sender) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Sender) ProtoMessage() {} + +func (x *Sender) ProtoReflect() protoreflect.Message { + mi := &file_push_ext_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 Sender.ProtoReflect.Descriptor instead. +func (*Sender) Descriptor() ([]byte, []int) { + return file_push_ext_proto_rawDescGZIP(), []int{0} +} + +func (x *Sender) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *Sender) GetDeviceId() int64 { + if x != nil { + return x.DeviceId + } + return 0 +} + +func (x *Sender) GetAvatarUrl() string { + if x != nil { + return x.AvatarUrl + } + return "" +} + +func (x *Sender) GetNickname() string { + if x != nil { + return x.Nickname + } + return "" +} + +func (x *Sender) GetExtra() string { + if x != nil { + return x.Extra + } + return "" +} + +// 用户消息 MC_USER_MESSAGE = 100 +type UserMessagePush struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Sender *Sender `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + ReceiverId int64 `protobuf:"varint,2,opt,name=receiver_id,json=receiverId,proto3" json:"receiver_id,omitempty"` // 用户id或者群组id + Content []byte `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` // 用户发送的消息内容 +} + +func (x *UserMessagePush) Reset() { + *x = UserMessagePush{} + if protoimpl.UnsafeEnabled { + mi := &file_push_ext_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserMessagePush) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserMessagePush) ProtoMessage() {} + +func (x *UserMessagePush) ProtoReflect() protoreflect.Message { + mi := &file_push_ext_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 UserMessagePush.ProtoReflect.Descriptor instead. +func (*UserMessagePush) Descriptor() ([]byte, []int) { + return file_push_ext_proto_rawDescGZIP(), []int{1} +} + +func (x *UserMessagePush) GetSender() *Sender { + if x != nil { + return x.Sender + } + return nil +} + +func (x *UserMessagePush) GetReceiverId() int64 { + if x != nil { + return x.ReceiverId + } + return 0 +} + +func (x *UserMessagePush) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +// 添加好友 PC_ADD_FRIEND = 110 type AddFriendPush struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -93,7 +242,7 @@ type AddFriendPush struct { func (x *AddFriendPush) Reset() { *x = AddFriendPush{} if protoimpl.UnsafeEnabled { - mi := &file_push_ext_proto_msgTypes[0] + mi := &file_push_ext_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106,7 +255,7 @@ func (x *AddFriendPush) String() string { func (*AddFriendPush) ProtoMessage() {} func (x *AddFriendPush) ProtoReflect() protoreflect.Message { - mi := &file_push_ext_proto_msgTypes[0] + mi := &file_push_ext_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119,7 +268,7 @@ func (x *AddFriendPush) ProtoReflect() protoreflect.Message { // Deprecated: Use AddFriendPush.ProtoReflect.Descriptor instead. func (*AddFriendPush) Descriptor() ([]byte, []int) { - return file_push_ext_proto_rawDescGZIP(), []int{0} + return file_push_ext_proto_rawDescGZIP(), []int{2} } func (x *AddFriendPush) GetFriendId() int64 { @@ -150,7 +299,7 @@ func (x *AddFriendPush) GetDescription() string { return "" } -// 推送码 PC_AGREE_ADD_FRIEND = 101 +// 同意 添加好友 PC_AGREE_ADD_FRIEND = 111 type AgreeAddFriendPush struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -164,7 +313,7 @@ type AgreeAddFriendPush struct { func (x *AgreeAddFriendPush) Reset() { *x = AgreeAddFriendPush{} if protoimpl.UnsafeEnabled { - mi := &file_push_ext_proto_msgTypes[1] + mi := &file_push_ext_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -177,7 +326,7 @@ func (x *AgreeAddFriendPush) String() string { func (*AgreeAddFriendPush) ProtoMessage() {} func (x *AgreeAddFriendPush) ProtoReflect() protoreflect.Message { - mi := &file_push_ext_proto_msgTypes[1] + mi := &file_push_ext_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -190,7 +339,7 @@ func (x *AgreeAddFriendPush) ProtoReflect() protoreflect.Message { // Deprecated: Use AgreeAddFriendPush.ProtoReflect.Descriptor instead. func (*AgreeAddFriendPush) Descriptor() ([]byte, []int) { - return file_push_ext_proto_rawDescGZIP(), []int{1} + return file_push_ext_proto_rawDescGZIP(), []int{3} } func (x *AgreeAddFriendPush) GetFriendId() int64 { @@ -214,7 +363,7 @@ func (x *AgreeAddFriendPush) GetAvatarUrl() string { return "" } -// 更新群组 PC_UPDATE_GROUP = 110 +// 更新群组 PC_UPDATE_GROUP = 120 type UpdateGroupPush struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -231,7 +380,7 @@ type UpdateGroupPush struct { func (x *UpdateGroupPush) Reset() { *x = UpdateGroupPush{} if protoimpl.UnsafeEnabled { - mi := &file_push_ext_proto_msgTypes[2] + mi := &file_push_ext_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -244,7 +393,7 @@ func (x *UpdateGroupPush) String() string { func (*UpdateGroupPush) ProtoMessage() {} func (x *UpdateGroupPush) ProtoReflect() protoreflect.Message { - mi := &file_push_ext_proto_msgTypes[2] + mi := &file_push_ext_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -257,7 +406,7 @@ func (x *UpdateGroupPush) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateGroupPush.ProtoReflect.Descriptor instead. func (*UpdateGroupPush) Descriptor() ([]byte, []int) { - return file_push_ext_proto_rawDescGZIP(), []int{2} + return file_push_ext_proto_rawDescGZIP(), []int{4} } func (x *UpdateGroupPush) GetOptId() int64 { @@ -302,7 +451,7 @@ func (x *UpdateGroupPush) GetExtra() string { return "" } -// 添加群组成员 PC_AGREE_ADD_GROUPS = 120 +// 添加群组成员 PC_AGREE_ADD_GROUPS = 121 type AddGroupMembersPush struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -316,7 +465,7 @@ type AddGroupMembersPush struct { func (x *AddGroupMembersPush) Reset() { *x = AddGroupMembersPush{} if protoimpl.UnsafeEnabled { - mi := &file_push_ext_proto_msgTypes[3] + mi := &file_push_ext_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -329,7 +478,7 @@ func (x *AddGroupMembersPush) String() string { func (*AddGroupMembersPush) ProtoMessage() {} func (x *AddGroupMembersPush) ProtoReflect() protoreflect.Message { - mi := &file_push_ext_proto_msgTypes[3] + mi := &file_push_ext_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -342,7 +491,7 @@ func (x *AddGroupMembersPush) ProtoReflect() protoreflect.Message { // Deprecated: Use AddGroupMembersPush.ProtoReflect.Descriptor instead. func (*AddGroupMembersPush) Descriptor() ([]byte, []int) { - return file_push_ext_proto_rawDescGZIP(), []int{3} + return file_push_ext_proto_rawDescGZIP(), []int{5} } func (x *AddGroupMembersPush) GetOptId() int64 { @@ -366,7 +515,7 @@ func (x *AddGroupMembersPush) GetMembers() []*GroupMember { return nil } -// 删除群组成员 PC_REMOVE_GROUP_MEMBER = 121 +// 删除群组成员 PC_REMOVE_GROUP_MEMBER = 122 type RemoveGroupMemberPush struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -380,7 +529,7 @@ type RemoveGroupMemberPush struct { func (x *RemoveGroupMemberPush) Reset() { *x = RemoveGroupMemberPush{} if protoimpl.UnsafeEnabled { - mi := &file_push_ext_proto_msgTypes[4] + mi := &file_push_ext_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -393,7 +542,7 @@ func (x *RemoveGroupMemberPush) String() string { func (*RemoveGroupMemberPush) ProtoMessage() {} func (x *RemoveGroupMemberPush) ProtoReflect() protoreflect.Message { - mi := &file_push_ext_proto_msgTypes[4] + mi := &file_push_ext_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -406,7 +555,7 @@ func (x *RemoveGroupMemberPush) ProtoReflect() protoreflect.Message { // Deprecated: Use RemoveGroupMemberPush.ProtoReflect.Descriptor instead. func (*RemoveGroupMemberPush) Descriptor() ([]byte, []int) { - return file_push_ext_proto_rawDescGZIP(), []int{4} + return file_push_ext_proto_rawDescGZIP(), []int{6} } func (x *RemoveGroupMemberPush) GetOptId() int64 { @@ -435,59 +584,78 @@ var File_push_ext_proto protoreflect.FileDescriptor var file_push_ext_proto_rawDesc = []byte{ 0x0a, 0x0e, 0x70, 0x75, 0x73, 0x68, 0x2e, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x0f, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x89, 0x01, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, - 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 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, 0x6c, 0x0a, 0x12, 0x41, 0x67, 0x72, 0x65, 0x65, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, - 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x22, - 0xb0, 0x01, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8f, 0x01, 0x0a, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, + 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, + 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x70, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x22, 0x0a, 0x06, 0x73, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, + 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1f, + 0x0a, 0x0b, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, + 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x89, 0x01, 0x0a, 0x0d, 0x41, 0x64, + 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x66, + 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, + 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, + 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, + 0x55, 0x72, 0x6c, 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, 0x6c, 0x0a, 0x12, 0x41, 0x67, 0x72, 0x65, 0x65, 0x41, 0x64, + 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x66, + 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, + 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, + 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, + 0x55, 0x72, 0x6c, 0x22, 0xb0, 0x01, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x50, 0x75, 0x73, 0x68, 0x12, 0x15, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6f, 0x70, 0x74, 0x49, 0x64, 0x12, 0x19, + 0x0a, 0x08, 0x6f, 0x70, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x6f, 0x70, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, + 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x22, 0x0a, 0x0c, + 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x72, 0x0a, 0x13, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x50, 0x75, 0x73, 0x68, 0x12, 0x15, 0x0a, + 0x06, 0x6f, 0x70, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6f, + 0x70, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x70, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x29, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0x71, 0x0a, 0x15, 0x52, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x50, 0x75, 0x73, 0x68, 0x12, 0x15, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6f, 0x70, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x70, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, - 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, - 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, - 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x72, - 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, - 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, - 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, - 0x72, 0x61, 0x22, 0x72, 0x0a, 0x13, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, - 0x6d, 0x62, 0x65, 0x72, 0x73, 0x50, 0x75, 0x73, 0x68, 0x12, 0x15, 0x0a, 0x06, 0x6f, 0x70, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6f, 0x70, 0x74, 0x49, 0x64, - 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x70, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x07, 0x6d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, - 0x62, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x07, 0x6d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0x71, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x50, 0x75, 0x73, 0x68, 0x12, - 0x15, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x05, 0x6f, 0x70, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x70, 0x74, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x75, 0x73, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x64, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x2a, 0x95, 0x01, 0x0a, 0x08, 0x50, 0x75, - 0x73, 0x68, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x50, 0x43, 0x5f, 0x41, 0x44, 0x44, - 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x43, - 0x5f, 0x41, 0x44, 0x44, 0x5f, 0x46, 0x52, 0x49, 0x45, 0x4e, 0x44, 0x10, 0x64, 0x12, 0x17, 0x0a, - 0x13, 0x50, 0x43, 0x5f, 0x41, 0x47, 0x52, 0x45, 0x45, 0x5f, 0x41, 0x44, 0x44, 0x5f, 0x46, 0x52, - 0x49, 0x45, 0x4e, 0x44, 0x10, 0x65, 0x12, 0x13, 0x0a, 0x0f, 0x50, 0x43, 0x5f, 0x55, 0x50, 0x44, - 0x41, 0x54, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x6e, 0x12, 0x18, 0x0a, 0x14, 0x50, - 0x43, 0x5f, 0x41, 0x44, 0x44, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x4d, 0x45, 0x4d, 0x42, - 0x45, 0x52, 0x53, 0x10, 0x78, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x43, 0x5f, 0x52, 0x45, 0x4d, 0x4f, - 0x56, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x10, - 0x79, 0x42, 0x0d, 0x5a, 0x0b, 0x67, 0x69, 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62, 0x2f, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, + 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, + 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x2a, 0xc0, 0x01, + 0x0a, 0x08, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x50, 0x43, + 0x5f, 0x41, 0x44, 0x44, 0x5f, 0x44, 0x45, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x00, 0x12, 0x13, + 0x0a, 0x0f, 0x50, 0x43, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, + 0x45, 0x10, 0x64, 0x12, 0x14, 0x0a, 0x10, 0x50, 0x43, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, + 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x43, 0x5f, + 0x41, 0x44, 0x44, 0x5f, 0x46, 0x52, 0x49, 0x45, 0x4e, 0x44, 0x10, 0x6e, 0x12, 0x17, 0x0a, 0x13, + 0x50, 0x43, 0x5f, 0x41, 0x47, 0x52, 0x45, 0x45, 0x5f, 0x41, 0x44, 0x44, 0x5f, 0x46, 0x52, 0x49, + 0x45, 0x4e, 0x44, 0x10, 0x6f, 0x12, 0x13, 0x0a, 0x0f, 0x50, 0x43, 0x5f, 0x55, 0x50, 0x44, 0x41, + 0x54, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x78, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x43, + 0x5f, 0x41, 0x44, 0x44, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, + 0x52, 0x53, 0x10, 0x79, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x43, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, + 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x7a, + 0x42, 0x15, 0x5a, 0x13, 0x67, 0x69, 0x6d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -503,23 +671,26 @@ func file_push_ext_proto_rawDescGZIP() []byte { } var file_push_ext_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_push_ext_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_push_ext_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_push_ext_proto_goTypes = []interface{}{ (PushCode)(0), // 0: pb.PushCode - (*AddFriendPush)(nil), // 1: pb.AddFriendPush - (*AgreeAddFriendPush)(nil), // 2: pb.AgreeAddFriendPush - (*UpdateGroupPush)(nil), // 3: pb.UpdateGroupPush - (*AddGroupMembersPush)(nil), // 4: pb.AddGroupMembersPush - (*RemoveGroupMemberPush)(nil), // 5: pb.RemoveGroupMemberPush - (*GroupMember)(nil), // 6: pb.GroupMember + (*Sender)(nil), // 1: pb.Sender + (*UserMessagePush)(nil), // 2: pb.UserMessagePush + (*AddFriendPush)(nil), // 3: pb.AddFriendPush + (*AgreeAddFriendPush)(nil), // 4: pb.AgreeAddFriendPush + (*UpdateGroupPush)(nil), // 5: pb.UpdateGroupPush + (*AddGroupMembersPush)(nil), // 6: pb.AddGroupMembersPush + (*RemoveGroupMemberPush)(nil), // 7: pb.RemoveGroupMemberPush + (*GroupMember)(nil), // 8: pb.GroupMember } var file_push_ext_proto_depIdxs = []int32{ - 6, // 0: pb.AddGroupMembersPush.members:type_name -> pb.GroupMember - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 1, // 0: pb.UserMessagePush.sender:type_name -> pb.Sender + 8, // 1: pb.AddGroupMembersPush.members:type_name -> pb.GroupMember + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] 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_push_ext_proto_init() } @@ -530,7 +701,7 @@ func file_push_ext_proto_init() { file_logic_ext_proto_init() if !protoimpl.UnsafeEnabled { file_push_ext_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddFriendPush); i { + switch v := v.(*Sender); i { case 0: return &v.state case 1: @@ -542,7 +713,7 @@ func file_push_ext_proto_init() { } } file_push_ext_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AgreeAddFriendPush); i { + switch v := v.(*UserMessagePush); i { case 0: return &v.state case 1: @@ -554,7 +725,7 @@ func file_push_ext_proto_init() { } } file_push_ext_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateGroupPush); i { + switch v := v.(*AddFriendPush); i { case 0: return &v.state case 1: @@ -566,7 +737,7 @@ func file_push_ext_proto_init() { } } file_push_ext_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddGroupMembersPush); i { + switch v := v.(*AgreeAddFriendPush); i { case 0: return &v.state case 1: @@ -578,6 +749,30 @@ func file_push_ext_proto_init() { } } file_push_ext_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateGroupPush); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_push_ext_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddGroupMembersPush); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_push_ext_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RemoveGroupMemberPush); i { case 0: return &v.state @@ -596,7 +791,7 @@ func file_push_ext_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_push_ext_proto_rawDesc, NumEnums: 1, - NumMessages: 5, + NumMessages: 7, NumExtensions: 0, NumServices: 0, }, diff --git a/pkg/proto/business.ext.proto b/pkg/protocol/proto/business.ext.proto similarity index 89% rename from pkg/proto/business.ext.proto rename to pkg/protocol/proto/business.ext.proto index 8c343fc6..842de6bc 100644 --- a/pkg/proto/business.ext.proto +++ b/pkg/protocol/proto/business.ext.proto @@ -1,8 +1,8 @@ syntax = "proto3"; package pb; -option go_package = "gim/pkg/pb/"; +option go_package = "gim/pkg/protocol/pb"; -import "common.ext.proto"; +import "google/protobuf/empty.proto"; service BusinessExt { // 登录 @@ -10,7 +10,7 @@ service BusinessExt { // 获取用户信息 rpc GetUser (GetUserReq) returns (GetUserResp); // 更新用户信息 - rpc UpdateUser (UpdateUserReq) returns (Empty); + rpc UpdateUser (UpdateUserReq) returns (google.protobuf.Empty); // 搜索用户(这里简单数据库实现,生产环境建议使用ES) rpc SearchUser (SearchUserReq) returns (SearchUserResp); } diff --git a/pkg/proto/business.int.proto b/pkg/protocol/proto/business.int.proto similarity index 78% rename from pkg/proto/business.int.proto rename to pkg/protocol/proto/business.int.proto index 95ac3e5b..abaed2eb 100644 --- a/pkg/proto/business.int.proto +++ b/pkg/protocol/proto/business.int.proto @@ -1,13 +1,13 @@ syntax = "proto3"; package pb; -option go_package = "gim/pkg/pb/"; +option go_package = "gim/pkg/protocol/pb"; -import "common.ext.proto"; +import "google/protobuf/empty.proto"; import "business.ext.proto"; service BusinessInt { // 权限校验 - rpc Auth (AuthReq) returns (Empty); + rpc Auth (AuthReq) returns (google.protobuf.Empty); // 批量获取用户信息 rpc GetUser (GetUserReq) returns (GetUserResp); // 批量获取用户信息 diff --git a/pkg/protocol/proto/connect.ext.proto b/pkg/protocol/proto/connect.ext.proto new file mode 100644 index 00000000..88331186 --- /dev/null +++ b/pkg/protocol/proto/connect.ext.proto @@ -0,0 +1,62 @@ +syntax = "proto3"; +package pb; +option go_package = "gim/pkg/protocol/pb"; + +import "message.ext.proto"; + +enum PackageType { + PT_UNKNOWN = 0; // 未知 + PT_SIGN_IN = 1; // 设备登录请求 + PT_SYNC = 2; // 消息同步触发 + PT_HEARTBEAT = 3; // 心跳 + PT_MESSAGE = 4; // 消息投递 + PT_SUBSCRIBE_ROOM = 5; // 订阅房间 +} + +// 上行数据 +message Input { + PackageType type = 1; // 包的类型 + int64 request_id = 2; // 请求id + bytes data = 3; // 数据 +} + +// 下行数据 +message Output { + PackageType type = 1; // 包的类型 + int64 request_id = 2; // 请求id + int32 code = 3; // 错误码 + string message = 4; // 错误信息 + bytes data = 5; // 数据 +} + +// 设备登录,package_type:1 +message SignInInput { + int64 device_id = 1; // 设备id + int64 user_id = 2; // 用户id + string token = 3; // 秘钥 +} + +// 消息同步请求,package_type:2 +message SyncInput { + int64 seq = 1; // 客户端已经同步的序列号 +} +// 消息同步响应,package_type:2 +message SyncOutput { + repeated Message messages = 1; // 消息列表 + bool has_more = 2; // 是否有更多数据 +} + +// 订阅房间请求 +message SubscribeRoomInput { + int64 room_id = 1; // 房间ID,如果为0,取消房间订阅 + int64 seq = 2; // 消息消息序列号, +} + +// 消息投递,package_type:4 +// message.ext.proto文件下 Message + +// 投递消息回执,package_type:4 +message MessageACK { + int64 device_ack = 2; // 设备收到消息的确认号 + int64 receive_time = 3; // 消息接收时间戳,精确到毫秒 +} diff --git a/pkg/protocol/proto/connect.int.proto b/pkg/protocol/proto/connect.int.proto new file mode 100644 index 00000000..aea2e8e2 --- /dev/null +++ b/pkg/protocol/proto/connect.int.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +package pb; +option go_package = "gim/pkg/protocol/pb"; + +import "google/protobuf/empty.proto"; +import "message.ext.proto"; + +service ConnectInt { + // 消息投递 + rpc DeliverMessage (DeliverMessageReq) returns (google.protobuf.Empty); +} + +message DeliverMessageReq { + int64 device_id = 1; // 设备id + Message message = 2; // 数据 +} + +// 房间推送 +message PushRoomMsg{ + int64 room_id = 1; // 设备id + Message message = 2; // 数据 +} + +// 房间推送 +message PushAllMsg{ + Message message = 2; // 数据 +} + diff --git a/pkg/proto/logic.ext.proto b/pkg/protocol/proto/logic.ext.proto similarity index 79% rename from pkg/proto/logic.ext.proto rename to pkg/protocol/proto/logic.ext.proto index a2e1cd1e..0039374e 100644 --- a/pkg/proto/logic.ext.proto +++ b/pkg/protocol/proto/logic.ext.proto @@ -1,43 +1,44 @@ syntax = "proto3"; package pb; -option go_package = "gim/pkg/pb/"; +option go_package = "gim/pkg/protocol/pb"; -import "common.ext.proto"; -import "connect.ext.proto"; +import "google/protobuf/empty.proto"; service LogicExt { // 注册设备 rpc RegisterDevice (RegisterDeviceReq) returns (RegisterDeviceResp); - // 发送消息 - rpc SendMessage (SendMessageReq) returns (SendMessageResp); // 推送消息到房间 - rpc PushRoom(PushRoomReq)returns(Empty); + rpc PushRoom(PushRoomReq)returns(google.protobuf.Empty); + // 发送好友消息 + rpc SendMessageToFriend (SendMessageReq) returns (SendMessageResp); // 添加好友 - rpc AddFriend (AddFriendReq) returns (Empty); + rpc AddFriend (AddFriendReq) returns (google.protobuf.Empty); // 同意添加好友 - rpc AgreeAddFriend (AgreeAddFriendReq) returns (Empty); + rpc AgreeAddFriend (AgreeAddFriendReq) returns (google.protobuf.Empty); // 设置好友信息 rpc SetFriend (SetFriendReq) returns (SetFriendResp); // 获取好友列表 - rpc GetFriends (Empty) returns (GetFriendsResp); + rpc GetFriends (google.protobuf.Empty) returns (GetFriendsResp); + // 发送群组消息 + rpc SendMessageToGroup (SendMessageReq) returns (SendMessageResp); // 创建群组 rpc CreateGroup (CreateGroupReq) returns (CreateGroupResp); // 更新群组 - rpc UpdateGroup (UpdateGroupReq) returns (Empty); + rpc UpdateGroup (UpdateGroupReq) returns (google.protobuf.Empty); // 获取群组信息 rpc GetGroup (GetGroupReq) returns (GetGroupResp); // 获取用户加入的所有群组 - rpc GetGroups (Empty) returns (GetGroupsResp); + rpc GetGroups (google.protobuf.Empty) returns (GetGroupsResp); // 添加群组成员 rpc AddGroupMembers (AddGroupMembersReq) returns (AddGroupMembersResp); // 更新群组成员信息 - rpc UpdateGroupMember (UpdateGroupMemberReq) returns (Empty); + rpc UpdateGroupMember (UpdateGroupMemberReq) returns (google.protobuf.Empty); // 添加群组成员 - rpc DeleteGroupMember (DeleteGroupMemberReq) returns (Empty); + rpc DeleteGroupMember (DeleteGroupMemberReq) returns (google.protobuf.Empty); // 获取群组成员 rpc GetGroupMembers (GetGroupMembersReq) returns (GetGroupMembersResp); } @@ -54,13 +55,9 @@ message RegisterDeviceResp { } message SendMessageReq { - ReceiverType receiver_type = 1; // 接收者类型,1:user;2:group - int64 receiver_id = 2; // 用户id或者群组id - repeated int64 to_user_ids = 3; // 需要@的用户id列表 - MessageType message_type = 4; // 消息类型 - bytes message_content = 5; // 消息内容 - int64 send_time = 6; // 消息发送时间戳,精确到毫秒 - bool is_persist = 7; // 是否将消息持久化到数据库 + int64 receiver_id = 1; // 接收者ID,用户ID/群组ID + bytes content = 2; // 推动内容 + int64 send_time = 3; // 消息发送时间戳,精确到毫秒 } message SendMessageResp { int64 seq = 1; // 消息序列号 @@ -68,8 +65,8 @@ message SendMessageResp { message PushRoomReq{ int64 room_id = 1; // 房间id - MessageType message_type = 2; // 消息类型 - bytes message_content = 3; // 消息内容 + int32 code = 2; // 消息类型 + bytes content = 3; // 消息内容 int64 send_time = 4; // 消息发送时间戳,精确到毫秒 bool is_persist = 5; // 是否将消息持久化 bool is_priority = 6; // 是否优先推送 diff --git a/pkg/proto/logic.int.proto b/pkg/protocol/proto/logic.int.proto similarity index 71% rename from pkg/proto/logic.int.proto rename to pkg/protocol/proto/logic.int.proto index 38b2b1e6..85245a46 100644 --- a/pkg/proto/logic.int.proto +++ b/pkg/protocol/proto/logic.int.proto @@ -1,33 +1,33 @@ syntax = "proto3"; package pb; -option go_package = "gim/pkg/pb/"; +option go_package = "gim/pkg/protocol/pb"; -import "common.ext.proto"; -import "connect.ext.proto"; +import "google/protobuf/empty.proto"; import "logic.ext.proto"; +import "message.ext.proto"; service LogicInt { // 登录 - rpc ConnSignIn (ConnSignInReq) returns (Empty); + rpc ConnSignIn (ConnSignInReq) returns (google.protobuf.Empty); // 消息同步 rpc Sync (SyncReq) returns (SyncResp); // 设备收到消息回执 - rpc MessageACK (MessageACKReq) returns (Empty); + rpc MessageACK (MessageACKReq) returns (google.protobuf.Empty); // 设备离线 - rpc Offline (OfflineReq) returns (Empty); + rpc Offline (OfflineReq) returns (google.protobuf.Empty); // 订阅房间 - rpc SubscribeRoom(SubscribeRoomReq)returns(Empty); - // 发送消息 - rpc SendMessage (SendMessageReq) returns (SendMessageResp); + rpc SubscribeRoom(SubscribeRoomReq)returns(google.protobuf.Empty); + // 推送 + rpc Push (PushReq) returns (PushResp); // 推送消息到房间 - rpc PushRoom(PushRoomReq)returns(Empty); + rpc PushRoom(PushRoomReq)returns(google.protobuf.Empty); // 全服推送 - rpc PushAll(PushAllReq)returns(Empty); + rpc PushAll(PushAllReq)returns(google.protobuf.Empty); // 获取设备信息 rpc GetDevice (GetDeviceReq) returns (GetDeviceResp); // 服务停止 - rpc ServerStop (ServerStopReq) returns (Empty); + rpc ServerStop (ServerStopReq) returns (google.protobuf.Empty); } message ConnSignInReq { @@ -69,10 +69,19 @@ message SubscribeRoomReq{ string conn_addr = 5; // 服务器地址 } +message PushReq{ + int64 user_id = 1; // 用户ID + int32 code = 2; // 推送码 + bytes content = 3; // 推送内容 + bool is_persist = 4; // 是否持久化 +} +message PushResp{ + int64 seq = 1; +} + message PushAllReq{ - MessageType message_type = 1; // 消息类型 - bytes message_content = 2; // 消息内容 - int64 send_time = 3; // 消息发送时间戳,精确到毫秒 + int32 code = 1; // 推送码 + bytes content = 2; // 推送内容 } message GetDeviceReq { diff --git a/pkg/protocol/proto/message.ext.proto b/pkg/protocol/proto/message.ext.proto new file mode 100644 index 00000000..5a6d9514 --- /dev/null +++ b/pkg/protocol/proto/message.ext.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package pb; +option go_package = "gim/pkg/protocol/pb"; + +// 单条消息投递内容(估算大约100个字节),todo 通知栏提醒 +message Message { + int32 code = 1; // 推送码 + bytes content = 2; // 推送内容 + int64 seq = 3; // 用户消息发送序列号 + int64 send_time = 4; // 消息发送时间戳,精确到毫秒 + MessageStatus status = 5; // 消息状态 +} + +enum MessageStatus { + MS_NORMAL = 0; // 正常的 + MS_RECALL = 1; // 撤回 +} diff --git a/pkg/proto/push.ext.proto b/pkg/protocol/proto/push.ext.proto similarity index 50% rename from pkg/proto/push.ext.proto rename to pkg/protocol/proto/push.ext.proto index 50b592fa..7d6ecad5 100644 --- a/pkg/proto/push.ext.proto +++ b/pkg/protocol/proto/push.ext.proto @@ -1,23 +1,39 @@ syntax = "proto3"; package pb; -option go_package = "gim/pkg/pb/"; +option go_package = "gim/pkg/protocol/pb"; import "logic.ext.proto"; enum PushCode { PC_ADD_DEFAULT = 0; - PC_ADD_FRIEND = 100; // 添加好友请求 - PC_AGREE_ADD_FRIEND = 101; // 同意添加好友 + PC_USER_MESSAGE = 100; // 用户消息 + PC_GROUP_MESSAGE = 101; // 群组消息 - PC_UPDATE_GROUP = 110; // 更新群组 + PC_ADD_FRIEND = 110; // 添加好友请求 + PC_AGREE_ADD_FRIEND = 111; // 同意添加好友 - PC_ADD_GROUP_MEMBERS = 120; // 添加群组成员 - PC_REMOVE_GROUP_MEMBER = 121; // 移除群组成员 + PC_UPDATE_GROUP = 120; // 更新群组 + PC_ADD_GROUP_MEMBERS = 121; // 添加群组成员 + PC_REMOVE_GROUP_MEMBER = 122; // 移除群组成员 +} + +message Sender { + int64 user_id = 2; // 发送者id + int64 device_id = 3; // 发送者设备id + string avatar_url = 4; // 昵称 + string nickname = 5; // 头像 + string extra = 6; // 扩展字段 +} +// 用户消息 MC_USER_MESSAGE = 100 +message UserMessagePush{ + Sender sender = 1; + int64 receiver_id = 2; // 用户id或者群组id + bytes content = 3; // 用户发送的消息内容 } -// 推送码 PC_ADD_FRIEND = 100 +// 添加好友 PC_ADD_FRIEND = 110 message AddFriendPush { int64 friend_id = 1; // 好友id string nickname = 2; // 昵称 @@ -25,14 +41,14 @@ message AddFriendPush { string description = 4; // 描述 } -// 推送码 PC_AGREE_ADD_FRIEND = 101 +// 同意 添加好友 PC_AGREE_ADD_FRIEND = 111 message AgreeAddFriendPush { int64 friend_id = 1; // 好友id string nickname = 2; // 昵称 string avatar_url = 3; // 头像 } -// 更新群组 PC_UPDATE_GROUP = 110 +// 更新群组 PC_UPDATE_GROUP = 120 message UpdateGroupPush { int64 opt_id = 1; // 操作人用户id string opt_name = 2; // 操作人昵称 @@ -42,16 +58,17 @@ message UpdateGroupPush { string extra = 6; // 附加字段 } -// 添加群组成员 PC_AGREE_ADD_GROUPS = 120 +// 添加群组成员 PC_AGREE_ADD_GROUPS = 121 message AddGroupMembersPush { int64 opt_id = 1; // 操作人用户id string opt_name = 2; // 操作人昵称 repeated GroupMember members = 3; // 群组成员 } -// 删除群组成员 PC_REMOVE_GROUP_MEMBER = 121 +// 删除群组成员 PC_REMOVE_GROUP_MEMBER = 122 message RemoveGroupMemberPush { int64 opt_id = 1; // 操作人用户id string opt_name = 2; // 操作人昵称 int64 deleted_user_id = 3; // 被删除的成员id } + diff --git a/pkg/rpc/rpc.go b/pkg/rpc/rpc.go index 68ed273c..dfa60a58 100644 --- a/pkg/rpc/rpc.go +++ b/pkg/rpc/rpc.go @@ -2,68 +2,47 @@ package rpc import ( "context" - "fmt" "gim/config" - "gim/pkg/grpclib/picker" - "gim/pkg/grpclib/resolver/k8s" - "gim/pkg/pb" - - "google.golang.org/grpc/balancer/roundrobin" - - "google.golang.org/grpc" + "gim/pkg/protocol/pb" ) var ( - logicIntClient pb.LogicIntClient connectIntClient pb.ConnectIntClient + logicIntClient pb.LogicIntClient businessIntClient pb.BusinessIntClient ) -func GetLogicIntClient() pb.LogicIntClient { - if logicIntClient == nil { - initLogicIntClient() - } - return logicIntClient -} - func GetConnectIntClient() pb.ConnectIntClient { if connectIntClient == nil { - initConnectIntClient() + connectIntClient = config.Config.ConnectIntClientBuilder() } return connectIntClient } -func GetBusinessIntClient() pb.BusinessIntClient { - if businessIntClient == nil { - initBusinessIntClient() - } - return businessIntClient -} - -func initLogicIntClient() { - conn, err := grpc.DialContext(context.TODO(), k8s.GetK8STarget(config.Namespace, "logic", "8000"), grpc.WithInsecure(), - grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name))) - if err != nil { - panic(err) +func GetLogicIntClient() pb.LogicIntClient { + if logicIntClient == nil { + logicIntClient = config.Config.LogicIntClientBuilder() } - logicIntClient = pb.NewLogicIntClient(conn) + return logicIntClient } -func initConnectIntClient() { - conn, err := grpc.DialContext(context.TODO(), k8s.GetK8STarget(config.Namespace, "connect", "8000"), grpc.WithInsecure(), - grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, picker.AddrPickerName))) - if err != nil { - panic(err) +func GetBusinessIntClient() pb.BusinessIntClient { + if businessIntClient == nil { + businessIntClient = config.Config.BusinessIntClientBuilder() } - connectIntClient = pb.NewConnectIntClient(conn) + return businessIntClient } -func initBusinessIntClient() { - conn, err := grpc.DialContext(context.TODO(), k8s.GetK8STarget(config.Namespace, "business", "8000"), grpc.WithInsecure(), - grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name))) +func GetSender(deviceID, userID int64) (*pb.Sender, error) { + user, err := GetBusinessIntClient().GetUser(context.TODO(), &pb.GetUserReq{UserId: userID}) if err != nil { - panic(err) + return nil, err } - - businessIntClient = pb.NewBusinessIntClient(conn) + return &pb.Sender{ + UserId: userID, + DeviceId: deviceID, + AvatarUrl: user.User.AvatarUrl, + Nickname: user.User.Nickname, + Extra: user.User.Extra, + }, nil } diff --git a/pkg/util/json.go b/pkg/util/json.go index d973395f..79261330 100644 --- a/pkg/util/json.go +++ b/pkg/util/json.go @@ -1,68 +1,9 @@ package util import ( - "encoding/json" - "gim/pkg/logger" - "gim/pkg/pb" - - jsoniter "github.com/json-iterator/go" - "google.golang.org/protobuf/proto" - - "go.uber.org/zap" + "fmt" ) -func JsonMarshal(v interface{}) string { - bytes, err := json.Marshal(v) - if err != nil { - logger.Logger.Error("json序列化:", zap.Error(err)) - } - return Bytes2str(bytes) -} - -func FormatMessage(messageType pb.MessageType, messageContent []byte) string { - if messageType == pb.MessageType_MT_UNKNOWN { - logger.Logger.Error("error message type") - return "error message type" - } - var ( - msg proto.Message - err error - ) - switch messageType { - case pb.MessageType_MT_TEXT: - msg = &pb.Text{} - err = proto.Unmarshal(messageContent, msg) - case pb.MessageType_MT_FACE: - msg = &pb.Text{} - err = proto.Unmarshal(messageContent, msg) - case pb.MessageType_MT_VOICE: - msg = &pb.Text{} - err = proto.Unmarshal(messageContent, msg) - case pb.MessageType_MT_IMAGE: - msg = &pb.Text{} - err = proto.Unmarshal(messageContent, msg) - case pb.MessageType_MT_FILE: - msg = &pb.Text{} - err = proto.Unmarshal(messageContent, msg) - case pb.MessageType_MT_LOCATION: - msg = &pb.Text{} - err = proto.Unmarshal(messageContent, msg) - case pb.MessageType_MT_COMMAND: - msg = &pb.Text{} - err = proto.Unmarshal(messageContent, msg) - case pb.MessageType_MT_CUSTOM: - msg = &pb.Text{} - err = proto.Unmarshal(messageContent, msg) - } - if err != nil { - logger.Sugar.Error(err) - return "" - } - - bytes, err := jsoniter.Marshal(msg) - if err != nil { - logger.Sugar.Error(err) - return "" - } - return Bytes2str(bytes) +func FormatMessage(code int32, content []byte) string { + return fmt.Sprintf("code:%d,content:%s", code, string(content)) } diff --git a/pkg/util/message.go b/pkg/util/message.go new file mode 100644 index 00000000..a2f79c6e --- /dev/null +++ b/pkg/util/message.go @@ -0,0 +1,38 @@ +package util + +import ( + "encoding/json" + "fmt" + "gim/pkg/protocol/pb" + + "google.golang.org/protobuf/proto" +) + +var MessagePushes = map[pb.PushCode]proto.Message{ + pb.PushCode_PC_USER_MESSAGE: &pb.UserMessagePush{}, + pb.PushCode_PC_GROUP_MESSAGE: &pb.UserMessagePush{}, + pb.PushCode_PC_ADD_FRIEND: &pb.AddFriendPush{}, + pb.PushCode_PC_AGREE_ADD_FRIEND: &pb.AgreeAddFriendPush{}, + pb.PushCode_PC_UPDATE_GROUP: &pb.UpdateGroupPush{}, + pb.PushCode_PC_ADD_GROUP_MEMBERS: &pb.AddGroupMembersPush{}, + pb.PushCode_PC_REMOVE_GROUP_MEMBER: &pb.RemoveGroupMemberPush{}, +} + +func MessageToString(msg *pb.Message) string { + push, ok := MessagePushes[pb.PushCode(msg.Code)] + if !ok { + return fmt.Sprintf("%-5d:%s", msg.Code, "unknown") + } + proto.Unmarshal(msg.Content, push) + + switch pb.PushCode(msg.Code) { + case pb.PushCode_PC_USER_MESSAGE: + msgPush := push.(*pb.UserMessagePush) + bytes, _ := json.Marshal(push) + return fmt.Sprintf("%-5d:%s:%s", msg.Code, string(bytes), string(msgPush.Content)) + default: + proto.Unmarshal(msg.Content, push) + bytes, _ := json.Marshal(push) + return fmt.Sprintf("%-5d:%s", msg.Code, string(bytes)) + } +} diff --git a/pkg/util/sql.go b/pkg/util/sql.go deleted file mode 100644 index 344bfd99..00000000 --- a/pkg/util/sql.go +++ /dev/null @@ -1,19 +0,0 @@ -package util - -import ( - "strconv" - "strings" -) - -func In(ids []int64) string { - build := strings.Builder{} - build.WriteString("(") - for i := range ids { - build.WriteString(strconv.FormatInt(ids[i], 10)) - if i != len(ids)-1 { - build.WriteString(",") - } - } - build.WriteString(")") - return build.String() -} diff --git a/sql/create_table.sql b/sql/create_table.sql index 26a848f0..26cfbc5c 100644 --- a/sql/create_table.sql +++ b/sql/create_table.sql @@ -119,24 +119,19 @@ CREATE TABLE `seq` -- ---------------------------- -- Table structure for message -- ---------------------------- -DROP TABLE IF EXISTS `message_000`; -CREATE TABLE `message_000` +DROP TABLE IF EXISTS `message`; +CREATE TABLE `message` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `user_id` bigint(20) unsigned NOT NULL COMMENT '所属类型的id', - `request_id` bigint(20) NOT NULL COMMENT '请求id', - `sender_type` tinyint(3) NOT NULL COMMENT '发送者类型', - `sender_id` bigint(20) unsigned NOT NULL COMMENT '发送者id', - `receiver_type` tinyint(3) NOT NULL COMMENT '接收者类型,1:个人;2:群组', - `receiver_id` bigint(20) unsigned NOT NULL COMMENT '接收者id,如果是单聊信息,则为user_id,如果是群组消息,则为group_id', - `to_user_ids` varchar(255) NOT NULL COMMENT '需要@的用户id列表,多个用户用,隔开', - `type` tinyint(4) NOT NULL COMMENT '消息类型', - `content` blob NOT NULL COMMENT '消息内容', - `seq` bigint(20) unsigned NOT NULL COMMENT '消息序列号', - `send_time` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP (3) COMMENT '消息发送时间', - `status` tinyint(255) NOT NULL DEFAULT '0' COMMENT '消息状态,0:未处理1:消息撤回', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', + `user_id` bigint(20) unsigned NOT NULL COMMENT '所属类型的id', + `request_id` bigint(20) NOT NULL COMMENT '请求id', + `code` tinyint(4) NOT NULL COMMENT '消息类型', + `content` blob NOT NULL COMMENT '消息内容', + `seq` bigint(20) unsigned NOT NULL COMMENT '消息序列号', + `send_time` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP (3) COMMENT '消息发送时间', + `status` tinyint(255) NOT NULL DEFAULT '0' COMMENT '消息状态,0:未处理1:消息撤回', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`id`), UNIQUE KEY `uk_user_id_seq` (`user_id`, `seq`) USING BTREE ) ENGINE = InnoDB diff --git a/test/tcp_conn/main.go b/test/tcp_conn/main.go index 60347075..1213af8b 100644 --- a/test/tcp_conn/main.go +++ b/test/tcp_conn/main.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/util" "log" "net" @@ -65,7 +65,7 @@ func (c *TcpClient) Output(pt pb.PackageType, requestId int64, message proto.Mes } func (c *TcpClient) Start() { - connect, err := net.Dial("tcp", "127.0.0.1:8080") + connect, err := net.Dial("tcp", "127.0.0.1:8002") if err != nil { log.Println(err) return @@ -143,8 +143,7 @@ func (c *TcpClient) HandlePackage(bytes []byte) { } log.Println("离线消息同步响应:code", output.Code, "message:", output.Message) for _, msg := range syncResp.Messages { - log.Printf("消息:发送者类型:%d 发送者id:%d 接收者类型:%d 接收者id:%d 消息内容:%+v seq:%d \n", - msg.Sender.SenderType, msg.Sender.SenderId, msg.ReceiverType, msg.ReceiverId, util.FormatMessage(msg.MessageType, msg.MessageContent), msg.Seq) + log.Println(util.MessageToString(msg)) c.Seq = msg.Seq } @@ -155,17 +154,14 @@ func (c *TcpClient) HandlePackage(bytes []byte) { c.Output(pb.PackageType_PT_MESSAGE, output.RequestId, &ack) log.Println("离线消息同步结束------") case pb.PackageType_PT_MESSAGE: - messageSend := pb.MessageSend{} - err := proto.Unmarshal(output.Data, &messageSend) + msg := pb.Message{} + err := proto.Unmarshal(output.Data, &msg) if err != nil { log.Println(err) return } - msg := messageSend.Message - log.Printf("消息:发送者类型:%d 发送者id:%d 接收者类型:%d 接收者id:%d 消息内容:%+v seq:%d \n", - msg.Sender.SenderType, msg.Sender.SenderId, msg.ReceiverType, msg.ReceiverId, util.FormatMessage(msg.MessageType, msg.MessageContent), msg.Seq) - + log.Println(util.MessageToString(&msg)) c.Seq = msg.Seq ack := pb.MessageACK{ DeviceAck: msg.Seq, @@ -173,6 +169,6 @@ func (c *TcpClient) HandlePackage(bytes []byte) { } c.Output(pb.PackageType_PT_MESSAGE, output.RequestId, &ack) default: - log.Println("switch other") + log.Println("switch other", output, len(bytes)) } } diff --git a/test/ws_conn/main.go b/test/ws_conn/main.go index 145dc7db..6d7f6a47 100644 --- a/test/ws_conn/main.go +++ b/test/ws_conn/main.go @@ -2,9 +2,10 @@ package main import ( "fmt" - "gim/pkg/pb" + "gim/pkg/protocol/pb" "gim/pkg/util" "io/ioutil" + "log" "net/http" "time" @@ -130,8 +131,7 @@ func (c *WSClient) HandlePackage(bytes []byte) { fmt.Println("离线消息同步响应:code", output.Code, "message:", output.Message) fmt.Printf("%+v \n", &output) for _, msg := range syncResp.Messages { - fmt.Printf("消息:发送者类型:%d 发送者id:%d 接收者类型:%d 接收者id:%d 消息内容:%+v seq:%d \n", - msg.Sender.SenderId, msg.Sender.SenderId, msg.ReceiverType, msg.ReceiverId, util.FormatMessage(msg.MessageType, msg.MessageContent), msg.Seq) + log.Panicln(util.MessageToString(msg)) c.Seq = msg.Seq } @@ -142,16 +142,14 @@ func (c *WSClient) HandlePackage(bytes []byte) { c.Output(pb.PackageType_PT_MESSAGE, output.RequestId, &ack) fmt.Println("离线消息同步结束------") case pb.PackageType_PT_MESSAGE: - message := pb.MessageSend{} - err := proto.Unmarshal(output.Data, &message) + msg := pb.Message{} + err := proto.Unmarshal(output.Data, &msg) if err != nil { fmt.Println(err) return } - msg := message.Message - fmt.Printf("消息:发送者类型:%d 发送者id:%d 接收者类型:%d 接收者id:%d 消息内容:%+v seq:%d \n", - msg.Sender.SenderType, msg.Sender.SenderId, msg.ReceiverType, msg.ReceiverId, util.FormatMessage(msg.MessageType, msg.MessageContent), msg.Seq) + log.Println("消息:", util.MessageToString(&msg)) c.Seq = msg.Seq ack := pb.MessageACK{