Merge branch 'master' of http://git.legu.cc/liwei_3d/go_dreamfactory
This commit is contained in:
commit
5122c74b5e
3
.gitignore
vendored
3
.gitignore
vendored
@ -12,7 +12,8 @@
|
||||
*.log
|
||||
bin/conf
|
||||
|
||||
.vscode/
|
||||
.vscode
|
||||
./bin/conf
|
||||
./bin/log
|
||||
~$*.xlsx
|
||||
cmd/luban/
|
@ -13,6 +13,7 @@ sys:
|
||||
Loglevel: 0 #日志文件输出级别
|
||||
LogMaxSize: 128 #日志文件最大Size
|
||||
LogMaxAge: 7 #日志文件最多保留天数
|
||||
Debugmode: true
|
||||
registry: #注册表系统 服务发现
|
||||
RegistryType: 0 #服务发现系统 0 Consul 组件
|
||||
Consul_Addr: "10.0.0.9:8500"
|
||||
|
@ -13,6 +13,7 @@ sys:
|
||||
Loglevel: 0 #日志文件输出级别
|
||||
LogMaxSize: 128 #日志文件最大Size
|
||||
LogMaxAge: 7 #日志文件最多保留天数
|
||||
Debugmode: true
|
||||
registry: #注册表系统 服务发现
|
||||
RegistryType: 0 #服务发现系统 0 Consul 组件
|
||||
Consul_Addr: "10.0.0.9:8500"
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"reflect"
|
||||
|
||||
"github.com/liwei1dao/lego/core"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -34,7 +35,9 @@ type IUserSession interface {
|
||||
GetSessionId() string
|
||||
GetIP() string
|
||||
GetGatewayServiceId() string
|
||||
SendMsg(ServiceMethod string, msg interface{}) (err error)
|
||||
Build(uid uint32) (err error)
|
||||
UnBuild(ServiceMethod string, msg proto.Message) (err error)
|
||||
SendMsg(ServiceMethod string, msg proto.Message) (err error)
|
||||
Close() (err error)
|
||||
ToString() string
|
||||
}
|
||||
|
40
comm/errorcode.go
Normal file
40
comm/errorcode.go
Normal file
@ -0,0 +1,40 @@
|
||||
package comm
|
||||
|
||||
import (
|
||||
"github.com/liwei1dao/lego/core"
|
||||
)
|
||||
|
||||
///内置错误码 0-1000 请外部应用服务不要占用
|
||||
const (
|
||||
ErrorCode_Success core.ErrorCode = 0 //成功
|
||||
ErrorCode_NoFindService core.ErrorCode = 10 //没有找到远程服务器
|
||||
ErrorCode_RpcFuncExecutionError core.ErrorCode = 11 //Rpc方法执行错误
|
||||
ErrorCode_CacheReadError core.ErrorCode = 12 //缓存读取失败
|
||||
ErrorCode_SqlExecutionError core.ErrorCode = 13 //数据库执行错误
|
||||
ErrorCode_ReqParameterError core.ErrorCode = 14 //请求参数错误
|
||||
ErrorCode_SignError core.ErrorCode = 15 //签名错误
|
||||
ErrorCode_InsufficientPermissions core.ErrorCode = 16 //权限不足
|
||||
ErrorCode_NoLogin core.ErrorCode = 17 //未登录
|
||||
ErrorCode_UserSessionNobeing core.ErrorCode = 18 //用户不存在
|
||||
)
|
||||
|
||||
var ErrorCodeMsg = map[core.ErrorCode]string{
|
||||
ErrorCode_Success: "成功",
|
||||
ErrorCode_NoFindService: "没有找到远程服务器",
|
||||
ErrorCode_RpcFuncExecutionError: "Rpc方法执行错误",
|
||||
ErrorCode_CacheReadError: "缓存读取失败",
|
||||
ErrorCode_SqlExecutionError: "数据库执行错误",
|
||||
ErrorCode_ReqParameterError: "请求参数错误",
|
||||
ErrorCode_SignError: "签名错误",
|
||||
ErrorCode_InsufficientPermissions: "权限不足",
|
||||
ErrorCode_NoLogin: "未登录",
|
||||
ErrorCode_UserSessionNobeing: "用户不存在",
|
||||
}
|
||||
|
||||
func GetErrorCodeMsg(code core.ErrorCode) string {
|
||||
if v, ok := ErrorCodeMsg[code]; ok {
|
||||
return v
|
||||
} else {
|
||||
return core.GetErrorCodeMsg(code)
|
||||
}
|
||||
}
|
@ -1,9 +1,13 @@
|
||||
package comm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"github.com/liwei1dao/lego/base"
|
||||
"github.com/liwei1dao/lego/sys/log"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func NewUserSession(service base.IRPCXService, ip, sessionId, gatewayServiceId string, uid uint32) IUserSession {
|
||||
@ -33,13 +37,50 @@ func (this *UserSession) GetIP() string {
|
||||
func (this *UserSession) GetGatewayServiceId() string {
|
||||
return this.GatewayServiceId
|
||||
}
|
||||
func (this *UserSession) SendMsg(ServiceMethod string, msg interface{}) (err error) {
|
||||
|
||||
func (this *UserSession) Build(uid uint32) (err error) {
|
||||
reply := &pb.RPCMessageReply{}
|
||||
if err := this.service.RpcCallById(this.GatewayServiceId, string(Rpc_GatewayAgentBuild), context.Background(), &pb.AgentBuildReq{
|
||||
UserSessionId: this.SessionId,
|
||||
UserId: uid,
|
||||
}, reply); err != nil {
|
||||
log.Errorf("UserSession:%s UserId:%d Build:%s err:%v", this.SessionId, this.UserId, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *UserSession) UnBuild(ServiceMethod string, msg proto.Message) (err error) {
|
||||
reply := &pb.RPCMessageReply{}
|
||||
if err := this.service.RpcCallById(this.GatewayServiceId, string(Rpc_GatewayAgentUnBuild), context.Background(), &pb.AgentUnBuildReq{
|
||||
UserSessionId: this.SessionId,
|
||||
}, reply); err != nil {
|
||||
log.Errorf("UserSession:%s UserId:%d UnBuild err:%v", this.SessionId, this.UserId, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *UserSession) SendMsg(ServiceMethod string, msg proto.Message) (err error) {
|
||||
reply := &pb.RPCMessageReply{}
|
||||
data, _ := proto.Marshal(msg)
|
||||
if err := this.service.RpcCallById(this.GatewayServiceId, string(Rpc_GatewayAgentSendMsg), context.Background(), &pb.AgentSendMessageReq{
|
||||
UserSessionId: this.SessionId,
|
||||
ServiceMethod: ServiceMethod,
|
||||
Data: data,
|
||||
}, reply); err != nil {
|
||||
log.Errorf("UserSession:%s UserId:%d SendMsg:%s err:%v", this.SessionId, this.UserId, ServiceMethod, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
func (this *UserSession) Close() (err error) {
|
||||
reply := &pb.RPCMessageReply{}
|
||||
if err := this.service.RpcCallById(this.GatewayServiceId, string(Rpc_GatewayAgentSendMsg), context.Background(), &pb.AgentCloseeReq{
|
||||
UserSessionId: this.SessionId,
|
||||
}, reply); err != nil {
|
||||
log.Errorf("UserSession:%s UserId:%d Close:%s err:%v", this.SessionId, this.UserId, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *UserSession) ToString() string {
|
||||
return fmt.Sprintf("SessionId:%s UserId:%d GatewayServiceId:%s", this.SessionId, this.UserId, this.GatewayServiceId)
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ func newAgent(gateway IGateway, conn *websocket.Conn) *Agent {
|
||||
wsConn: conn,
|
||||
sessionId: id.NewUUId(),
|
||||
uId: 0,
|
||||
writeChan: make(chan *pb.Message, 2),
|
||||
writeChan: make(chan *pb.UserMessage, 2),
|
||||
closeSignal: make(chan bool),
|
||||
state: 1,
|
||||
}
|
||||
@ -35,7 +35,7 @@ type Agent struct {
|
||||
wsConn *websocket.Conn
|
||||
sessionId string
|
||||
uId uint32
|
||||
writeChan chan *pb.Message
|
||||
writeChan chan *pb.UserMessage
|
||||
closeSignal chan bool
|
||||
state int32 //状态 0 关闭 1 运行 2 关闭中
|
||||
wg sync.WaitGroup
|
||||
@ -45,7 +45,7 @@ func (this *Agent) readLoop() {
|
||||
defer this.wg.Done()
|
||||
var (
|
||||
data []byte
|
||||
msg *pb.Message = &pb.Message{}
|
||||
msg *pb.UserMessage = &pb.UserMessage{}
|
||||
err error
|
||||
)
|
||||
locp:
|
||||
@ -102,7 +102,20 @@ func (this *Agent) IP() string {
|
||||
func (this *Agent) UserId() uint32 {
|
||||
return this.uId
|
||||
}
|
||||
|
||||
func (this *Agent) Build(uId uint32) {
|
||||
this.uId = uId
|
||||
}
|
||||
|
||||
func (this *Agent) UnBuild() {
|
||||
this.uId = 0
|
||||
}
|
||||
|
||||
func (this *Agent) WriteMsg(msg *pb.UserMessage) (err error) {
|
||||
if atomic.LoadInt32(&this.state) != 1 {
|
||||
return
|
||||
}
|
||||
this.writeChan <- msg
|
||||
return
|
||||
}
|
||||
|
||||
@ -119,15 +132,15 @@ func (this *Agent) Close() {
|
||||
}
|
||||
|
||||
//分发用户消息
|
||||
func (this *Agent) messageDistribution(msg *pb.Message) {
|
||||
reply := &pb.UserMessageReply{}
|
||||
log.Debugf("agent:%s uId:%d MessageDistribution msg:%s", this.sessionId, this.uId, msg.Head.ServiceMethod)
|
||||
if err := this.gateway.Service().RpcCallByType("worker", string(comm.Rpc_GatewayRoute), context.Background(), &pb.UserMessage{
|
||||
func (this *Agent) messageDistribution(msg *pb.UserMessage) {
|
||||
reply := &pb.RPCMessageReply{}
|
||||
log.Debugf("agent:%s uId:%d MessageDistribution msg:%s", this.sessionId, this.uId, msg.ServiceMethod)
|
||||
if err := this.gateway.Service().RpcCallByType("worker", string(comm.Rpc_GatewayRoute), context.Background(), &pb.AgentMessage{
|
||||
Ip: this.IP(),
|
||||
UserSessionId: this.sessionId,
|
||||
UserId: this.uId,
|
||||
GatewayServiceId: this.gateway.Service().GetId(),
|
||||
Method: msg.Head.ServiceMethod,
|
||||
Method: msg.ServiceMethod,
|
||||
Message: msg.Data,
|
||||
}, reply); err != nil {
|
||||
log.Errorf("agent:%s uId:%d MessageDistribution err:%v", this.sessionId, this.uId, err)
|
||||
|
@ -1,6 +1,9 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"context"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
"sync"
|
||||
|
||||
"github.com/liwei1dao/lego/core"
|
||||
@ -23,3 +26,63 @@ func (this *AgentMgr_Comp) Connect(a IAgent) {
|
||||
func (this *AgentMgr_Comp) DisConnect(a IAgent) {
|
||||
this.agents.Delete(a.SessionId())
|
||||
}
|
||||
|
||||
//用户登录绑定Id
|
||||
func (this *AgentMgr_Comp) Build(ctx context.Context, args *pb.AgentBuildReq, reply *pb.RPCMessageReply) error {
|
||||
if a, ok := this.agents.Load(args.UserSessionId); ok {
|
||||
a.(IAgent).Build(args.UserId)
|
||||
} else {
|
||||
reply.Code = int32(comm.ErrorCode_UserSessionNobeing)
|
||||
reply.Msg = comm.GetErrorCodeMsg(comm.ErrorCode_UserSessionNobeing)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//用户登录解绑Id
|
||||
func (this *AgentMgr_Comp) UnBuild(ctx context.Context, args *pb.AgentUnBuildReq, reply *pb.RPCMessageReply) error {
|
||||
if a, ok := this.agents.Load(args.UserSessionId); ok {
|
||||
a.(IAgent).UnBuild()
|
||||
} else {
|
||||
reply.Code = int32(comm.ErrorCode_UserSessionNobeing)
|
||||
reply.Msg = comm.GetErrorCodeMsg(comm.ErrorCode_UserSessionNobeing)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//向用户发送消息
|
||||
func (this *AgentMgr_Comp) SendMsgToAgent(ctx context.Context, args *pb.AgentSendMessageReq, reply *pb.RPCMessageReply) error {
|
||||
if a, ok := this.agents.Load(args.UserSessionId); ok {
|
||||
a.(IAgent).WriteMsg(&pb.UserMessage{
|
||||
ServiceMethod: args.ServiceMethod,
|
||||
Data: args.Data,
|
||||
})
|
||||
} else {
|
||||
reply.Code = int32(comm.ErrorCode_UserSessionNobeing)
|
||||
reply.Msg = comm.GetErrorCodeMsg(comm.ErrorCode_UserSessionNobeing)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//向所有户发送消息
|
||||
func (this *AgentMgr_Comp) SendMsgToAllAgent(ctx context.Context, args *pb.BroadCastMessageReq, reply *pb.RPCMessageReply) error {
|
||||
msg := &pb.UserMessage{
|
||||
ServiceMethod: args.ServiceMethod,
|
||||
Data: args.Data,
|
||||
}
|
||||
this.agents.Range(func(key, value any) bool {
|
||||
value.(IAgent).WriteMsg(msg)
|
||||
return true
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
//关闭代理
|
||||
func (this *AgentMgr_Comp) CloseAgent(ctx context.Context, args *pb.AgentCloseeReq, reply *pb.RPCMessageReply) error {
|
||||
if a, ok := this.agents.Load(args.UserSessionId); ok {
|
||||
a.(IAgent).Close()
|
||||
} else {
|
||||
reply.Code = int32(comm.ErrorCode_UserSessionNobeing)
|
||||
reply.Msg = comm.GetErrorCodeMsg(comm.ErrorCode_UserSessionNobeing)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -3,8 +3,10 @@ package gateway_test
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/pb"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"google.golang.org/protobuf/proto"
|
||||
@ -17,18 +19,40 @@ func Test_WebSocket(t *testing.T) {
|
||||
fmt.Printf("err:%v", err)
|
||||
return
|
||||
}
|
||||
|
||||
go func() {
|
||||
var msg *pb.UserMessage = &pb.UserMessage{}
|
||||
for {
|
||||
_, data, err := ws.ReadMessage()
|
||||
if err != nil {
|
||||
fmt.Printf("err:%v\n", err)
|
||||
}
|
||||
if err = proto.Unmarshal(data, msg); err != nil {
|
||||
fmt.Printf("err:%v\n", err)
|
||||
} else {
|
||||
fmt.Printf("ReadMessage msg:%v\n", msg)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
loginreq := &pb.UserLoginReq{
|
||||
Name: "liwei",
|
||||
}
|
||||
logindata, _ := proto.Marshal(loginreq)
|
||||
message := &pb.Message{
|
||||
Head: &pb.MessageHead{ServiceMethod: "Login"},
|
||||
Data: logindata,
|
||||
message := &pb.UserMessage{
|
||||
ServiceMethod: "Login",
|
||||
Data: logindata,
|
||||
}
|
||||
data, _ := proto.Marshal(message)
|
||||
err = ws.WriteMessage(websocket.BinaryMessage, data)
|
||||
if err != nil {
|
||||
fmt.Printf("err:%v", err)
|
||||
fmt.Printf("err:%v\n", err)
|
||||
}
|
||||
|
||||
sigterm := make(chan os.Signal, 1)
|
||||
signal.Notify(sigterm, syscall.SIGINT, syscall.SIGTERM)
|
||||
select {
|
||||
case <-sigterm:
|
||||
fmt.Printf("terminating: via signal\n")
|
||||
}
|
||||
time.Sleep(time.Second * 2)
|
||||
}
|
||||
|
@ -12,6 +12,8 @@ type (
|
||||
SessionId() string
|
||||
IP() string
|
||||
UserId() uint32
|
||||
Build(uId uint32)
|
||||
UnBuild()
|
||||
WriteMsg(msg *pb.UserMessage) (err error)
|
||||
Close() //主动关闭接口
|
||||
}
|
||||
|
@ -36,13 +36,15 @@ func (this *Gateway) Service() base.IRPCXService {
|
||||
func (this *Gateway) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleBase.Init(service, module, options)
|
||||
this.service = service.(base.IRPCXService)
|
||||
log.Debugf("Module.Gate Init")
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Gateway) Start() (err error) {
|
||||
this.service.RegisterFunctionName(string(comm.Rpc_GatewayAgentBuild), this.agentmgr_comp.Build)
|
||||
this.service.RegisterFunctionName(string(comm.Rpc_GatewayAgentUnBuild), this.agentmgr_comp.UnBuild)
|
||||
this.service.RegisterFunctionName(string(comm.Rpc_GatewayAgentSendMsg), this.agentmgr_comp.SendMsgToAgent)
|
||||
this.service.RegisterFunctionName(string(comm.Rpc_GatewayAgentClose), this.agentmgr_comp.CloseAgent)
|
||||
err = this.ModuleBase.Start()
|
||||
log.Debugf("Module.Gate Start")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -21,5 +21,8 @@ func (this *User_Comp) Init(service core.IService, module core.IModule, comp cor
|
||||
|
||||
func (this *User_Comp) Login(ctx context.Context, session comm.IUserSession, rsp *pb.UserLoginReq) error {
|
||||
log.Debugf("User_Comp Login: session:%v rsp:%v", session.ToString(), rsp)
|
||||
session.SendMsg("LogigResp", &pb.UserLoginResp{
|
||||
Code: 200,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
681
pb/comm.pb.go
681
pb/comm.pb.go
@ -20,127 +20,20 @@ const (
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
//消息体
|
||||
type MessageHead struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ServiceMethod string `protobuf:"bytes,1,opt,name=ServiceMethod,proto3" json:"ServiceMethod,omitempty"` //服务名
|
||||
}
|
||||
|
||||
func (x *MessageHead) Reset() {
|
||||
*x = MessageHead{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_comm_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *MessageHead) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*MessageHead) ProtoMessage() {}
|
||||
|
||||
func (x *MessageHead) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_comm_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 MessageHead.ProtoReflect.Descriptor instead.
|
||||
func (*MessageHead) Descriptor() ([]byte, []int) {
|
||||
return file_comm_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *MessageHead) GetServiceMethod() string {
|
||||
if x != nil {
|
||||
return x.ServiceMethod
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
//处理JSON消息
|
||||
type Message struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Head *MessageHead `protobuf:"bytes,1,opt,name=Head,proto3" json:"Head,omitempty"`
|
||||
Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Message) Reset() {
|
||||
*x = Message{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_comm_proto_msgTypes[1]
|
||||
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_comm_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 Message.ProtoReflect.Descriptor instead.
|
||||
func (*Message) Descriptor() ([]byte, []int) {
|
||||
return file_comm_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *Message) GetHead() *MessageHead {
|
||||
if x != nil {
|
||||
return x.Head
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Message) GetData() []byte {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//用户消息流结构
|
||||
type UserMessage struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Ip string `protobuf:"bytes,1,opt,name=Ip,proto3" json:"Ip,omitempty"`
|
||||
UserSessionId string `protobuf:"bytes,2,opt,name=UserSessionId,proto3" json:"UserSessionId,omitempty"`
|
||||
UserId uint32 `protobuf:"varint,3,opt,name=UserId,proto3" json:"UserId,omitempty"`
|
||||
GatewayServiceId string `protobuf:"bytes,4,opt,name=GatewayServiceId,proto3" json:"GatewayServiceId,omitempty"`
|
||||
Method string `protobuf:"bytes,5,opt,name=Method,proto3" json:"Method,omitempty"`
|
||||
Message []byte `protobuf:"bytes,6,opt,name=Message,proto3" json:"Message,omitempty"`
|
||||
ServiceMethod string `protobuf:"bytes,1,opt,name=ServiceMethod,proto3" json:"ServiceMethod,omitempty"` //服务名
|
||||
Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UserMessage) Reset() {
|
||||
*x = UserMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_comm_proto_msgTypes[2]
|
||||
mi := &file_comm_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -153,7 +46,7 @@ func (x *UserMessage) String() string {
|
||||
func (*UserMessage) ProtoMessage() {}
|
||||
|
||||
func (x *UserMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_comm_proto_msgTypes[2]
|
||||
mi := &file_comm_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -166,52 +59,113 @@ func (x *UserMessage) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use UserMessage.ProtoReflect.Descriptor instead.
|
||||
func (*UserMessage) Descriptor() ([]byte, []int) {
|
||||
return file_comm_proto_rawDescGZIP(), []int{2}
|
||||
return file_comm_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *UserMessage) GetIp() string {
|
||||
func (x *UserMessage) GetServiceMethod() string {
|
||||
if x != nil {
|
||||
return x.ServiceMethod
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UserMessage) GetData() []byte {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//代理用户转发消息结构
|
||||
type AgentMessage struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Ip string `protobuf:"bytes,1,opt,name=Ip,proto3" json:"Ip,omitempty"`
|
||||
UserSessionId string `protobuf:"bytes,2,opt,name=UserSessionId,proto3" json:"UserSessionId,omitempty"`
|
||||
UserId uint32 `protobuf:"varint,3,opt,name=UserId,proto3" json:"UserId,omitempty"`
|
||||
GatewayServiceId string `protobuf:"bytes,4,opt,name=GatewayServiceId,proto3" json:"GatewayServiceId,omitempty"`
|
||||
Method string `protobuf:"bytes,5,opt,name=Method,proto3" json:"Method,omitempty"`
|
||||
Message []byte `protobuf:"bytes,6,opt,name=Message,proto3" json:"Message,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AgentMessage) Reset() {
|
||||
*x = AgentMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_comm_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AgentMessage) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AgentMessage) ProtoMessage() {}
|
||||
|
||||
func (x *AgentMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_comm_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 AgentMessage.ProtoReflect.Descriptor instead.
|
||||
func (*AgentMessage) Descriptor() ([]byte, []int) {
|
||||
return file_comm_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *AgentMessage) GetIp() string {
|
||||
if x != nil {
|
||||
return x.Ip
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UserMessage) GetUserSessionId() string {
|
||||
func (x *AgentMessage) GetUserSessionId() string {
|
||||
if x != nil {
|
||||
return x.UserSessionId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UserMessage) GetUserId() uint32 {
|
||||
func (x *AgentMessage) GetUserId() uint32 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UserMessage) GetGatewayServiceId() string {
|
||||
func (x *AgentMessage) GetGatewayServiceId() string {
|
||||
if x != nil {
|
||||
return x.GatewayServiceId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UserMessage) GetMethod() string {
|
||||
func (x *AgentMessage) GetMethod() string {
|
||||
if x != nil {
|
||||
return x.Method
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UserMessage) GetMessage() []byte {
|
||||
func (x *AgentMessage) GetMessage() []byte {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type UserMessageReply struct {
|
||||
//RPC 服务固定回复结构
|
||||
type RPCMessageReply struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
@ -220,8 +174,64 @@ type UserMessageReply struct {
|
||||
Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UserMessageReply) Reset() {
|
||||
*x = UserMessageReply{}
|
||||
func (x *RPCMessageReply) Reset() {
|
||||
*x = RPCMessageReply{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_comm_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RPCMessageReply) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RPCMessageReply) ProtoMessage() {}
|
||||
|
||||
func (x *RPCMessageReply) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_comm_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 RPCMessageReply.ProtoReflect.Descriptor instead.
|
||||
func (*RPCMessageReply) Descriptor() ([]byte, []int) {
|
||||
return file_comm_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *RPCMessageReply) GetCode() int32 {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RPCMessageReply) GetMsg() string {
|
||||
if x != nil {
|
||||
return x.Msg
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
//用户代理绑定Uid请求
|
||||
type AgentBuildReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
UserSessionId string `protobuf:"bytes,1,opt,name=UserSessionId,proto3" json:"UserSessionId,omitempty"`
|
||||
UserId uint32 `protobuf:"varint,2,opt,name=UserId,proto3" json:"UserId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AgentBuildReq) Reset() {
|
||||
*x = AgentBuildReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_comm_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@ -229,13 +239,13 @@ func (x *UserMessageReply) Reset() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *UserMessageReply) String() string {
|
||||
func (x *AgentBuildReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UserMessageReply) ProtoMessage() {}
|
||||
func (*AgentBuildReq) ProtoMessage() {}
|
||||
|
||||
func (x *UserMessageReply) ProtoReflect() protoreflect.Message {
|
||||
func (x *AgentBuildReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_comm_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@ -247,21 +257,237 @@ func (x *UserMessageReply) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UserMessageReply.ProtoReflect.Descriptor instead.
|
||||
func (*UserMessageReply) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use AgentBuildReq.ProtoReflect.Descriptor instead.
|
||||
func (*AgentBuildReq) Descriptor() ([]byte, []int) {
|
||||
return file_comm_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *UserMessageReply) GetCode() int32 {
|
||||
func (x *AgentBuildReq) GetUserSessionId() string {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
return x.UserSessionId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AgentBuildReq) GetUserId() uint32 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UserMessageReply) GetMsg() string {
|
||||
//用户代理解绑请求
|
||||
type AgentUnBuildReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
UserSessionId string `protobuf:"bytes,1,opt,name=UserSessionId,proto3" json:"UserSessionId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AgentUnBuildReq) Reset() {
|
||||
*x = AgentUnBuildReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_comm_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AgentUnBuildReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AgentUnBuildReq) ProtoMessage() {}
|
||||
|
||||
func (x *AgentUnBuildReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_comm_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 AgentUnBuildReq.ProtoReflect.Descriptor instead.
|
||||
func (*AgentUnBuildReq) Descriptor() ([]byte, []int) {
|
||||
return file_comm_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *AgentUnBuildReq) GetUserSessionId() string {
|
||||
if x != nil {
|
||||
return x.Msg
|
||||
return x.UserSessionId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
//向用户代理发送消息请求
|
||||
type AgentSendMessageReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
UserSessionId string `protobuf:"bytes,1,opt,name=UserSessionId,proto3" json:"UserSessionId,omitempty"`
|
||||
ServiceMethod string `protobuf:"bytes,2,opt,name=ServiceMethod,proto3" json:"ServiceMethod,omitempty"` //服务名
|
||||
Data []byte `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AgentSendMessageReq) Reset() {
|
||||
*x = AgentSendMessageReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_comm_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AgentSendMessageReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AgentSendMessageReq) ProtoMessage() {}
|
||||
|
||||
func (x *AgentSendMessageReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_comm_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 AgentSendMessageReq.ProtoReflect.Descriptor instead.
|
||||
func (*AgentSendMessageReq) Descriptor() ([]byte, []int) {
|
||||
return file_comm_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *AgentSendMessageReq) GetUserSessionId() string {
|
||||
if x != nil {
|
||||
return x.UserSessionId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AgentSendMessageReq) GetServiceMethod() string {
|
||||
if x != nil {
|
||||
return x.ServiceMethod
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AgentSendMessageReq) GetData() []byte {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//广播消息到所有用户代理
|
||||
type BroadCastMessageReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ServiceMethod string `protobuf:"bytes,1,opt,name=ServiceMethod,proto3" json:"ServiceMethod,omitempty"` //服务名
|
||||
Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *BroadCastMessageReq) Reset() {
|
||||
*x = BroadCastMessageReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_comm_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *BroadCastMessageReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*BroadCastMessageReq) ProtoMessage() {}
|
||||
|
||||
func (x *BroadCastMessageReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_comm_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 BroadCastMessageReq.ProtoReflect.Descriptor instead.
|
||||
func (*BroadCastMessageReq) Descriptor() ([]byte, []int) {
|
||||
return file_comm_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *BroadCastMessageReq) GetServiceMethod() string {
|
||||
if x != nil {
|
||||
return x.ServiceMethod
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *BroadCastMessageReq) GetData() []byte {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//关闭用户代理
|
||||
type AgentCloseeReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
UserSessionId string `protobuf:"bytes,1,opt,name=UserSessionId,proto3" json:"UserSessionId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AgentCloseeReq) Reset() {
|
||||
*x = AgentCloseeReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_comm_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AgentCloseeReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AgentCloseeReq) ProtoMessage() {}
|
||||
|
||||
func (x *AgentCloseeReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_comm_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 AgentCloseeReq.ProtoReflect.Descriptor instead.
|
||||
func (*AgentCloseeReq) Descriptor() ([]byte, []int) {
|
||||
return file_comm_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *AgentCloseeReq) GetUserSessionId() string {
|
||||
if x != nil {
|
||||
return x.UserSessionId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@ -269,31 +495,53 @@ func (x *UserMessageReply) GetMsg() string {
|
||||
var File_comm_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_comm_proto_rawDesc = []byte{
|
||||
0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x33, 0x0a, 0x0b,
|
||||
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x65, 0x61, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x53,
|
||||
0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x47, 0x0a, 0x0b,
|
||||
0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x53,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f,
|
||||
0x64, 0x22, 0x3f, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x20, 0x0a, 0x04,
|
||||
0x48, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x4d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x48, 0x65, 0x61, 0x64, 0x52, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61,
|
||||
0x74, 0x61, 0x22, 0xb9, 0x01, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
|
||||
0x49, 0x70, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72,
|
||||
0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64,
|
||||
0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x47, 0x61, 0x74, 0x65,
|
||||
0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4d, 0x65,
|
||||
0x74, 0x68, 0x6f, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18,
|
||||
0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x38,
|
||||
0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70,
|
||||
0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x64, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52,
|
||||
0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0xba, 0x01, 0x0a, 0x0c, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x4d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x70, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x02, 0x49, 0x70, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65,
|
||||
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55,
|
||||
0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x55, 0x73,
|
||||
0x65, 0x72, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10,
|
||||
0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73,
|
||||
0x61, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x22, 0x37, 0x0a, 0x0f, 0x52, 0x50, 0x43, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x22, 0x4d, 0x0a, 0x0d, 0x41,
|
||||
0x67, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d,
|
||||
0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0d, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x37, 0x0a, 0x0f, 0x41, 0x67,
|
||||
0x65, 0x6e, 0x74, 0x55, 0x6e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a,
|
||||
0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x49, 0x64, 0x22, 0x75, 0x0a, 0x13, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x6e, 0x64,
|
||||
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73,
|
||||
0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64,
|
||||
0x12, 0x24, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f,
|
||||
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x4f, 0x0a, 0x13, 0x42, 0x72,
|
||||
0x6f, 0x61, 0x64, 0x43, 0x61, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65,
|
||||
0x71, 0x12, 0x24, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x68,
|
||||
0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
|
||||
0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x36, 0x0a, 0x0e, 0x41,
|
||||
0x67, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a,
|
||||
0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -308,20 +556,23 @@ func file_comm_proto_rawDescGZIP() []byte {
|
||||
return file_comm_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_comm_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_comm_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_comm_proto_goTypes = []interface{}{
|
||||
(*MessageHead)(nil), // 0: MessageHead
|
||||
(*Message)(nil), // 1: Message
|
||||
(*UserMessage)(nil), // 2: UserMessage
|
||||
(*UserMessageReply)(nil), // 3: UserMessageReply
|
||||
(*UserMessage)(nil), // 0: UserMessage
|
||||
(*AgentMessage)(nil), // 1: AgentMessage
|
||||
(*RPCMessageReply)(nil), // 2: RPCMessageReply
|
||||
(*AgentBuildReq)(nil), // 3: AgentBuildReq
|
||||
(*AgentUnBuildReq)(nil), // 4: AgentUnBuildReq
|
||||
(*AgentSendMessageReq)(nil), // 5: AgentSendMessageReq
|
||||
(*BroadCastMessageReq)(nil), // 6: BroadCastMessageReq
|
||||
(*AgentCloseeReq)(nil), // 7: AgentCloseeReq
|
||||
}
|
||||
var file_comm_proto_depIdxs = []int32{
|
||||
0, // 0: Message.Head:type_name -> MessageHead
|
||||
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
|
||||
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_comm_proto_init() }
|
||||
@ -331,30 +582,6 @@ func file_comm_proto_init() {
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_comm_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*MessageHead); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_comm_proto_msgTypes[1].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_comm_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UserMessage); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@ -366,8 +593,80 @@ func file_comm_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_comm_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AgentMessage); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_comm_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RPCMessageReply); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_comm_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UserMessageReply); i {
|
||||
switch v := v.(*AgentBuildReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_comm_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AgentUnBuildReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_comm_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AgentSendMessageReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_comm_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*BroadCastMessageReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_comm_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AgentCloseeReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -385,7 +684,7 @@ func file_comm_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_comm_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
@ -1,19 +1,14 @@
|
||||
syntax = "proto3";
|
||||
option go_package = ".;pb";
|
||||
|
||||
|
||||
//消息体
|
||||
message MessageHead {
|
||||
string ServiceMethod =1; //服务名
|
||||
}
|
||||
|
||||
//处理JSON消息
|
||||
message Message {
|
||||
MessageHead Head =1;
|
||||
//用户消息流结构
|
||||
message UserMessage {
|
||||
string ServiceMethod =1; //服务名
|
||||
bytes Data = 2;
|
||||
}
|
||||
|
||||
message UserMessage {
|
||||
//代理用户转发消息结构
|
||||
message AgentMessage {
|
||||
string Ip = 1;
|
||||
string UserSessionId = 2;
|
||||
uint32 UserId = 3;
|
||||
@ -22,7 +17,33 @@ message UserMessage {
|
||||
bytes Message = 6;
|
||||
}
|
||||
|
||||
message UserMessageReply {
|
||||
//RPC 服务固定回复结构
|
||||
message RPCMessageReply {
|
||||
int32 Code = 1;
|
||||
string Msg = 2;
|
||||
}
|
||||
|
||||
//用户代理绑定Uid请求
|
||||
message AgentBuildReq {
|
||||
string UserSessionId = 1;
|
||||
uint32 UserId = 2;
|
||||
}
|
||||
//用户代理解绑请求
|
||||
message AgentUnBuildReq {
|
||||
string UserSessionId = 1;
|
||||
}
|
||||
//向用户代理发送消息请求
|
||||
message AgentSendMessageReq {
|
||||
string UserSessionId = 1;
|
||||
string ServiceMethod = 2; //服务名
|
||||
bytes Data = 3;
|
||||
}
|
||||
//广播消息到所有用户代理
|
||||
message BroadCastMessageReq {
|
||||
string ServiceMethod = 1; //服务名
|
||||
bytes Data = 2;
|
||||
}
|
||||
//关闭用户代理
|
||||
message AgentCloseeReq {
|
||||
string UserSessionId = 1;
|
||||
}
|
11
pb/proto/user_db.proto
Normal file
11
pb/proto/user_db.proto
Normal file
@ -0,0 +1,11 @@
|
||||
syntax = "proto3";
|
||||
option go_package = ".;pb";
|
||||
|
||||
message Cache_UserData {
|
||||
uint32 UserId = 1;
|
||||
string SessionId = 2;
|
||||
string GatewayServiceId = 3;
|
||||
string NiceName = 4;
|
||||
string Email = 5;
|
||||
string Password = 6;
|
||||
}
|
@ -4,6 +4,7 @@ option go_package = ".;pb";
|
||||
message UserLoginReq {
|
||||
string Name = 1;
|
||||
}
|
||||
|
||||
message UserLoginResp {
|
||||
int32 Code = 1;
|
||||
}
|
||||
|
191
pb/user_db.pb.go
Normal file
191
pb/user_db.pb.go
Normal file
@ -0,0 +1,191 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.0
|
||||
// protoc v3.20.0
|
||||
// source: user_db.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 Cache_UserData struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
UserId uint32 `protobuf:"varint,1,opt,name=UserId,proto3" json:"UserId,omitempty"`
|
||||
SessionId string `protobuf:"bytes,2,opt,name=SessionId,proto3" json:"SessionId,omitempty"`
|
||||
GatewayServiceId string `protobuf:"bytes,3,opt,name=GatewayServiceId,proto3" json:"GatewayServiceId,omitempty"`
|
||||
NiceName string `protobuf:"bytes,4,opt,name=NiceName,proto3" json:"NiceName,omitempty"`
|
||||
Email string `protobuf:"bytes,5,opt,name=Email,proto3" json:"Email,omitempty"`
|
||||
Password string `protobuf:"bytes,6,opt,name=Password,proto3" json:"Password,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Cache_UserData) Reset() {
|
||||
*x = Cache_UserData{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_user_db_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Cache_UserData) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Cache_UserData) ProtoMessage() {}
|
||||
|
||||
func (x *Cache_UserData) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_db_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 Cache_UserData.ProtoReflect.Descriptor instead.
|
||||
func (*Cache_UserData) Descriptor() ([]byte, []int) {
|
||||
return file_user_db_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Cache_UserData) GetUserId() uint32 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Cache_UserData) GetSessionId() string {
|
||||
if x != nil {
|
||||
return x.SessionId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Cache_UserData) GetGatewayServiceId() string {
|
||||
if x != nil {
|
||||
return x.GatewayServiceId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Cache_UserData) GetNiceName() string {
|
||||
if x != nil {
|
||||
return x.NiceName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Cache_UserData) GetEmail() string {
|
||||
if x != nil {
|
||||
return x.Email
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Cache_UserData) GetPassword() string {
|
||||
if x != nil {
|
||||
return x.Password
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_user_db_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_user_db_proto_rawDesc = []byte{
|
||||
0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
||||
0xc0, 0x01, 0x0a, 0x0e, 0x43, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61,
|
||||
0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0d, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x65,
|
||||
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65,
|
||||
0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65,
|
||||
0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x05, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f,
|
||||
0x72, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f,
|
||||
0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_user_db_proto_rawDescOnce sync.Once
|
||||
file_user_db_proto_rawDescData = file_user_db_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_user_db_proto_rawDescGZIP() []byte {
|
||||
file_user_db_proto_rawDescOnce.Do(func() {
|
||||
file_user_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_user_db_proto_rawDescData)
|
||||
})
|
||||
return file_user_db_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_user_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_user_db_proto_goTypes = []interface{}{
|
||||
(*Cache_UserData)(nil), // 0: Cache_UserData
|
||||
}
|
||||
var file_user_db_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_user_db_proto_init() }
|
||||
func file_user_db_proto_init() {
|
||||
if File_user_db_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_user_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Cache_UserData); 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_user_db_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_user_db_proto_goTypes,
|
||||
DependencyIndexes: file_user_db_proto_depIdxs,
|
||||
MessageInfos: file_user_db_proto_msgTypes,
|
||||
}.Build()
|
||||
File_user_db_proto = out.File
|
||||
file_user_db_proto_rawDesc = nil
|
||||
file_user_db_proto_goTypes = nil
|
||||
file_user_db_proto_depIdxs = nil
|
||||
}
|
@ -26,4 +26,5 @@ def buildProto(pbpath,outpath,pbfile):
|
||||
f.write(file_data)
|
||||
|
||||
buildProto('./pb/proto','./pb','comm')
|
||||
buildProto('./pb/proto','./pb','user_db')
|
||||
buildProto('./pb/proto','./pb','user_msg')
|
@ -65,7 +65,7 @@ func (this *SComp_GateRouteComp) RegisterRoute(methodName string, comp reflect.V
|
||||
this.mrlock.Unlock()
|
||||
}
|
||||
|
||||
func (this *SComp_GateRouteComp) ReceiveMsg(ctx context.Context, args *pb.UserMessage, reply *pb.UserMessageReply) error {
|
||||
func (this *SComp_GateRouteComp) ReceiveMsg(ctx context.Context, args *pb.AgentMessage, reply *pb.RPCMessageReply) error {
|
||||
log.Debugf("SComp_GateRouteComp ReceiveMsg agent:%s uId:%d MessageDistribution msg:%s", args.UserSessionId, args.UserId, args.Method)
|
||||
this.mrlock.RLock()
|
||||
msghandle, ok := this.msghandles[args.Method]
|
||||
|
2
sys/cache/core.go
vendored
2
sys/cache/core.go
vendored
@ -5,6 +5,8 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
const ()
|
||||
|
||||
var defsys ISys
|
||||
|
||||
func OnInit(config map[string]interface{}, option ...Option) (err error) {
|
||||
|
16
sys/cache/user.go
vendored
Normal file
16
sys/cache/user.go
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"github.com/liwei1dao/lego/core"
|
||||
)
|
||||
|
||||
const ( //Redis
|
||||
Redis_UserCache core.Redis_Key = "user:%d" //会话列表
|
||||
)
|
||||
|
||||
func (this *Cache) UpdateUserCache(data *pb.Cache_UserData) (err error) {
|
||||
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue
Block a user