mirror of
https://github.com/duanhf2012/origin.git
synced 2026-03-03 04:07:39 +08:00
新增rpc被调用时可以异步返回,详情请参照originserver示例
This commit is contained in:
@@ -1,73 +0,0 @@
|
||||
package tcpgateway
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/duanhf2012/origin/service"
|
||||
"github.com/duanhf2012/origin/sysservice/tcpservice"
|
||||
"github.com/golang/protobuf/proto"
|
||||
)
|
||||
|
||||
type GateProxyModule struct{
|
||||
service.Module
|
||||
defaultGateRpc string
|
||||
}
|
||||
|
||||
func NewGateProxyModule() *GateProxyModule{
|
||||
return &GateProxyModule{defaultGateRpc:"TcpGateService.RPC_Dispatch"}
|
||||
}
|
||||
|
||||
func (gate *GateProxyModule) Send(clientId interface{},msgType uint16,msg proto.Message) error {
|
||||
//对agentId进行分组
|
||||
mapNodeClientId := map[int][]uint64{}
|
||||
switch clientId.(type) {
|
||||
case uint64:
|
||||
id := clientId.(uint64)
|
||||
nodeId := tcpservice.GetNodeId(id)
|
||||
mapNodeClientId[nodeId] = append(mapNodeClientId[nodeId],id)
|
||||
|
||||
case []uint64:
|
||||
idList := clientId.([]uint64)
|
||||
for _,id := range idList{
|
||||
nodeId := tcpservice.GetNodeId(id)
|
||||
mapNodeClientId[nodeId] = append(mapNodeClientId[nodeId],id)
|
||||
}
|
||||
}
|
||||
|
||||
bData,err := proto.Marshal(msg)
|
||||
if err!=nil {
|
||||
return err
|
||||
}
|
||||
var replyMsg ReplyMessage
|
||||
replyMsg.MsgType = proto.Uint32(uint32(msgType))
|
||||
replyMsg.Msg = bData
|
||||
|
||||
for nodeId,clientIdList := range mapNodeClientId {
|
||||
if nodeId <0 || nodeId>tcpservice.MaxNodeId {
|
||||
fmt.Errorf("nodeid is error %d",nodeId)
|
||||
continue
|
||||
}
|
||||
|
||||
replyMsg.ClientList = clientIdList
|
||||
gate.GetService().GetRpcHandler().GoNode(nodeId,gate.defaultGateRpc,&replyMsg)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gate *GateProxyModule) SetDefaultGateRpcMethodName(rpcMethodName string){
|
||||
gate.defaultGateRpc = rpcMethodName
|
||||
}
|
||||
|
||||
func (gate *GateProxyModule) send(clientId uint64,msgType uint16,msg []byte) error {
|
||||
nodeId := tcpservice.GetNodeId(clientId)
|
||||
if nodeId <0 || nodeId>tcpservice.MaxNodeId {
|
||||
return fmt.Errorf("nodeid is error %d",nodeId)
|
||||
}
|
||||
|
||||
var replyMsg ReplyMessage
|
||||
replyMsg.MsgType = proto.Uint32(uint32(msgType))
|
||||
replyMsg.Msg = msg
|
||||
replyMsg.ClientList = append(replyMsg.ClientList ,clientId)
|
||||
|
||||
return gate.GetService().GetRpcHandler().GoNode(nodeId, gate.defaultGateRpc,&replyMsg)
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package tcpgateway
|
||||
|
||||
type ILoadBalance interface {
|
||||
SelectNode(serviceName string,clientId uint64,eventType string,msgType uint16,msg []byte) int //选择一个结点,通过服务名称
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package tcpgateway
|
||||
|
||||
type IRouter interface {
|
||||
RouterMessage(clientId uint64,msgType uint16,msg []byte) //消息转发
|
||||
RouterEvent(clientId uint64,eventType string) bool//消息转发
|
||||
Load() //加载路由规则
|
||||
|
||||
OnDisconnected(clientId uint64)
|
||||
OnConnected(clientId uint64)
|
||||
//ReplyMessage(clientId uint64,msg []byte)
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package tcpgateway
|
||||
|
||||
type LoadBalance struct {
|
||||
}
|
||||
|
||||
func (balance *LoadBalance) SelectNode(serviceName string,clientId uint64,eventType string,msgType uint16,msg []byte) int {
|
||||
return 1
|
||||
}
|
||||
@@ -1,302 +0,0 @@
|
||||
package tcpgateway
|
||||
|
||||
import (
|
||||
"github.com/duanhf2012/origin/log"
|
||||
"github.com/duanhf2012/origin/network"
|
||||
"github.com/duanhf2012/origin/node"
|
||||
"github.com/duanhf2012/origin/rpc"
|
||||
"github.com/duanhf2012/origin/sysservice/tcpservice"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type RouterCfg struct {
|
||||
}
|
||||
|
||||
type Router struct {
|
||||
loadBalance ILoadBalance
|
||||
rpcHandler rpc.IRpcHandler
|
||||
|
||||
mapMsgRouterInfo map[uint16]*MsgRouterInfo
|
||||
mapEventRouterInfo map[string]*EventRouterInfo
|
||||
|
||||
tcpService *tcpservice.TcpService
|
||||
|
||||
mapClientRouterCache map[uint64]map[string]int //map[clientid]nodeid
|
||||
}
|
||||
|
||||
type MsgRouterInfo struct {
|
||||
Rpc string
|
||||
ServiceName string
|
||||
LoadBalanceType string
|
||||
}
|
||||
|
||||
type EventRouterInfo struct {
|
||||
Rpc string
|
||||
ServiceName string
|
||||
LoadBalanceType string
|
||||
}
|
||||
|
||||
func NewRouter(loadBalance ILoadBalance,rpcHandler rpc.IRpcHandler,cfg interface{}) IRouter {
|
||||
router := &Router{}
|
||||
router.loadBalance = loadBalance
|
||||
router.rpcHandler = rpcHandler
|
||||
router.tcpService = node.GetService("TcpService").(*tcpservice.TcpService)
|
||||
router.loadCfg(cfg)
|
||||
router.mapClientRouterCache = map[uint64]map[string]int{}
|
||||
return router
|
||||
}
|
||||
|
||||
func (r *Router) loadCfg(cfg interface{}){
|
||||
r.mapMsgRouterInfo = map[uint16]*MsgRouterInfo{}
|
||||
r.mapEventRouterInfo = map[string]*EventRouterInfo{}
|
||||
|
||||
mapRouter,ok := cfg.(map[string]interface{})
|
||||
if ok == false{
|
||||
//error....
|
||||
return
|
||||
}
|
||||
|
||||
//parse MsgRouter
|
||||
routerInfo,ok := mapRouter["MsgRouter"]
|
||||
if ok == false{
|
||||
//error...
|
||||
return
|
||||
}
|
||||
|
||||
//ar routerList []RouterItem
|
||||
routerList,ok := routerInfo.([]interface{})
|
||||
if ok == false{
|
||||
//error...
|
||||
return
|
||||
}
|
||||
|
||||
for _,v := range routerList{
|
||||
mapItem := v.(map[string]interface{})
|
||||
var iMsgId interface{}
|
||||
var iRpc interface{}
|
||||
var iLoadBalanceType interface{}
|
||||
|
||||
if iMsgId,ok = mapItem["MsgId"];ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
if iRpc,ok = mapItem["Rpc"];ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
if iLoadBalanceType,ok = mapItem["LoadBalanceType"];ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
msgIdList,ok := iMsgId.(string)
|
||||
if ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
var startMsgId int
|
||||
var endMsgId int
|
||||
var err error
|
||||
sliceId := strings.Split(msgIdList,"-")
|
||||
if len(sliceId) == 1 {
|
||||
startMsgId,err = strconv.Atoi(msgIdList)
|
||||
if err != nil {
|
||||
log.Fatal("TcpGateService %s config is error!",iRpc.(string))
|
||||
continue
|
||||
}
|
||||
endMsgId = startMsgId
|
||||
} else if len(sliceId) == 2 {
|
||||
startMsgId,err = strconv.Atoi(sliceId[0])
|
||||
if err != nil {
|
||||
log.Fatal("TcpGateService %s config is error!",iRpc.(string))
|
||||
continue
|
||||
}
|
||||
endMsgId,err = strconv.Atoi(sliceId[1])
|
||||
if err != nil {
|
||||
log.Fatal("TcpGateService %s config is error!",iRpc.(string))
|
||||
continue
|
||||
}
|
||||
if startMsgId>endMsgId {
|
||||
log.Fatal("TcpGateService %s config is error!",iRpc.(string))
|
||||
continue
|
||||
}
|
||||
}else {
|
||||
log.Fatal("TcpGateService %s config is error!",iRpc.(string))
|
||||
continue
|
||||
}
|
||||
|
||||
strService := strings.Split(iRpc.(string),".")
|
||||
if len(strService)!=2 {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
|
||||
msgInfo := &MsgRouterInfo{ServiceName: strService[0],Rpc: iRpc.(string),LoadBalanceType: iLoadBalanceType.(string)}
|
||||
for i:=startMsgId;i<=endMsgId;i++{
|
||||
r.mapMsgRouterInfo[uint16(i)] = msgInfo
|
||||
}
|
||||
}
|
||||
|
||||
//parse EventRouter
|
||||
eventRouterInfo,ok := mapRouter["EventRouter"]
|
||||
if ok == false{
|
||||
//error...
|
||||
return
|
||||
}
|
||||
|
||||
//ar routerList []RouterItem
|
||||
eRouterList,ok := eventRouterInfo.([]interface{})
|
||||
if ok == false{
|
||||
//error...
|
||||
return
|
||||
}
|
||||
|
||||
for _,v := range eRouterList{
|
||||
mapItem := v.(map[string]interface{})
|
||||
var eventType interface{}
|
||||
var iRpc interface{}
|
||||
var iLoadBalanceType interface{}
|
||||
|
||||
if eventType,ok = mapItem["EventType"];ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
if iRpc,ok = mapItem["Rpc"];ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
if iLoadBalanceType,ok = mapItem["LoadBalanceType"];ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
strEventType,ok := eventType.(string)
|
||||
if ok == false {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
|
||||
strService := strings.Split(iRpc.(string),".")
|
||||
if len(strService)!=2 {
|
||||
//error ...
|
||||
continue
|
||||
}
|
||||
|
||||
r.mapEventRouterInfo[strEventType] = &EventRouterInfo{ServiceName: strService[0],Rpc: iRpc.(string),LoadBalanceType: iLoadBalanceType.(string)}
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Router) GetMsgRouterService(msgType uint16) *MsgRouterInfo{
|
||||
info,ok := r.mapMsgRouterInfo[msgType]
|
||||
if ok == false {
|
||||
return nil
|
||||
}
|
||||
|
||||
return info
|
||||
}
|
||||
|
||||
func (r *Router) GetEventRouterService(eventType string) *EventRouterInfo{
|
||||
info,ok := r.mapEventRouterInfo[eventType]
|
||||
if ok == false {
|
||||
return nil
|
||||
}
|
||||
|
||||
return info
|
||||
}
|
||||
|
||||
func (r *Router) GetRouterId(clientId uint64,serviceName *string) int {
|
||||
mapServiceRouter,ok := r.mapClientRouterCache[clientId]
|
||||
if ok == false{
|
||||
return 0
|
||||
}
|
||||
|
||||
routerId,ok := mapServiceRouter[*serviceName]
|
||||
if ok == false {
|
||||
return 0
|
||||
}
|
||||
|
||||
return routerId
|
||||
}
|
||||
|
||||
func (r *Router) SetRouterId(clientId uint64,serviceName string,routerId int){
|
||||
r.mapClientRouterCache[clientId][serviceName] = routerId
|
||||
}
|
||||
|
||||
type RawInputArgs struct {
|
||||
rawData []byte
|
||||
clientId uint64
|
||||
}
|
||||
|
||||
var rawInputEmpty []byte
|
||||
func (args RawInputArgs) GetRawData() []byte{
|
||||
if len(args.rawData) < 2 {
|
||||
return args.rawData
|
||||
}
|
||||
|
||||
return args.rawData[2:]
|
||||
}
|
||||
|
||||
func (args RawInputArgs) GetAdditionParam() interface{}{
|
||||
return args.clientId
|
||||
}
|
||||
|
||||
func (args RawInputArgs) DoGc() {
|
||||
if len(args.rawData) < 2 {
|
||||
return
|
||||
}
|
||||
network.ReleaseByteSlice(args.rawData)
|
||||
}
|
||||
var msgEventType string
|
||||
|
||||
func (r *Router) RouterMessage(cliId uint64,msgType uint16,msg []byte) {
|
||||
routerInfo:= r.GetMsgRouterService(msgType)
|
||||
if routerInfo==nil {
|
||||
log.Error("The message type is %d with no configured route!",msgType)
|
||||
return
|
||||
}
|
||||
|
||||
routerId := r.GetRouterId(cliId,&routerInfo.ServiceName)
|
||||
if routerId ==0 {
|
||||
routerId = r.loadBalance.SelectNode(routerInfo.ServiceName,cliId,msgEventType,msgType,msg)
|
||||
r.SetRouterId(cliId,routerInfo.ServiceName,routerId)
|
||||
}
|
||||
|
||||
if routerId>0 {
|
||||
r.rpcHandler.RawGoNode(rpc.RpcProcessorPb,routerId,routerInfo.Rpc,RawInputArgs{rawData: msg,clientId: cliId})
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Router) Load(){
|
||||
}
|
||||
|
||||
func (r *Router) RouterEvent(clientId uint64,eventType string) bool{
|
||||
routerInfo:= r.GetEventRouterService(eventType)
|
||||
if routerInfo==nil {
|
||||
log.Error("The event type is %s with no register!",eventType)
|
||||
return false
|
||||
}
|
||||
|
||||
routerId := r.GetRouterId(clientId,&routerInfo.ServiceName)
|
||||
if routerId ==0 {
|
||||
routerId = r.loadBalance.SelectNode(routerInfo.ServiceName,clientId,eventType,0,nil)
|
||||
r.SetRouterId(clientId,routerInfo.ServiceName,routerId)
|
||||
}
|
||||
|
||||
if routerId>0 {
|
||||
r.rpcHandler.RawGoNode(rpc.RpcProcessorPb,routerId,routerInfo.Rpc,RawInputArgs{rawData: rawInputEmpty,clientId: clientId})
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
func (r *Router) OnDisconnected(clientId uint64){
|
||||
delete(r.mapClientRouterCache,clientId)
|
||||
//通知事件
|
||||
r.RouterEvent(clientId,"DisConnect")
|
||||
}
|
||||
|
||||
func (r *Router) OnConnected(clientId uint64){
|
||||
r.mapClientRouterCache[clientId] = map[string]int{}
|
||||
r.RouterEvent(clientId,"Connect")
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package tcpgateway
|
||||
|
||||
import (
|
||||
"github.com/duanhf2012/origin/log"
|
||||
"github.com/duanhf2012/origin/network/processor"
|
||||
"github.com/duanhf2012/origin/node"
|
||||
"github.com/duanhf2012/origin/service"
|
||||
"github.com/duanhf2012/origin/sysservice/tcpservice"
|
||||
)
|
||||
|
||||
type MsgTypeRouterInfo struct {
|
||||
router IRouter
|
||||
serviceName string
|
||||
}
|
||||
|
||||
type TcpGateService struct {
|
||||
service.Service
|
||||
|
||||
processor processor.IRawProcessor
|
||||
tcpService *tcpservice.TcpService
|
||||
loadBalance ILoadBalance
|
||||
router IRouter
|
||||
}
|
||||
|
||||
|
||||
func (gateService *TcpGateService) OnInit() error {
|
||||
gateService.OnLoad()
|
||||
//注册监听客户连接断开事件
|
||||
gateService.processor.SetDisConnectedHandler(gateService.router.OnDisconnected)
|
||||
//注册监听客户连接事件
|
||||
gateService.processor.SetConnectedHandler(gateService.router.OnConnected)
|
||||
|
||||
//注册监听消息类型MsgType_MsgReq,并注册回调
|
||||
gateService.processor.SetRawMsgHandler(gateService.router.RouterMessage)
|
||||
//将protobuf消息处理器设置到TcpService服务中
|
||||
gateService.tcpService.SetProcessor(gateService.processor, gateService.GetEventHandler())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gateService *TcpGateService) SetEventChannel(channelNum int){
|
||||
gateService.GetEventProcessor().SetEventChannel(channelNum)
|
||||
}
|
||||
|
||||
func (gateService *TcpGateService) OnLoad() {
|
||||
//设置默认LoadBalance
|
||||
if gateService.loadBalance == nil {
|
||||
gateService.loadBalance = &LoadBalance{}
|
||||
}
|
||||
|
||||
//设置默认Router
|
||||
if gateService.router == nil {
|
||||
gateService.router = NewRouter(gateService.loadBalance, gateService, gateService.GetServiceCfg())
|
||||
}
|
||||
|
||||
//新建内置的protobuf处理器,您也可以自定义路由器,比如json
|
||||
if gateService.processor == nil {
|
||||
gateService.processor = processor.NewPBRawProcessor()
|
||||
}
|
||||
|
||||
//加载路由
|
||||
gateService.router.Load()
|
||||
|
||||
//设置默认的TcpService服务
|
||||
if gateService.tcpService == nil {
|
||||
gateService.tcpService = node.GetService("TcpService").(*tcpservice.TcpService)
|
||||
}
|
||||
|
||||
if gateService.tcpService == nil {
|
||||
panic("TcpService is not installed!")
|
||||
}
|
||||
}
|
||||
|
||||
func (gateService *TcpGateService) SetLoadBalance(loadBalance ILoadBalance){
|
||||
gateService.loadBalance = loadBalance
|
||||
}
|
||||
|
||||
func (gateService *TcpGateService) SetRouter(router IRouter){
|
||||
gateService.router = router
|
||||
}
|
||||
|
||||
func (gateService *TcpGateService) SetRawProcessor(processor processor.IRawProcessor){
|
||||
gateService.processor = processor
|
||||
}
|
||||
|
||||
func (gateService *TcpGateService) SetTcpGateService(tcpService *tcpservice.TcpService){
|
||||
gateService.tcpService = tcpService
|
||||
}
|
||||
|
||||
func (gateService *TcpGateService) RPC_Dispatch(replyMsg *ReplyMessage) error {
|
||||
for _,id := range replyMsg.ClientList {
|
||||
err := gateService.tcpService.SendRawMsg(id,replyMsg.Msg)
|
||||
if err != nil {
|
||||
log.Debug("SendRawMsg fail:%+v!",err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1,473 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: base/base.proto
|
||||
|
||||
package tcpgateway
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type Int struct {
|
||||
Value *int32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Int) Reset() { *m = Int{} }
|
||||
func (m *Int) String() string { return proto.CompactTextString(m) }
|
||||
func (*Int) ProtoMessage() {}
|
||||
func (*Int) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{0}
|
||||
}
|
||||
|
||||
func (m *Int) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Int.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Int) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Int.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Int) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Int.Merge(m, src)
|
||||
}
|
||||
func (m *Int) XXX_Size() int {
|
||||
return xxx_messageInfo_Int.Size(m)
|
||||
}
|
||||
func (m *Int) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Int.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Int proto.InternalMessageInfo
|
||||
|
||||
func (m *Int) GetValue() int32 {
|
||||
if m != nil && m.Value != nil {
|
||||
return *m.Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Int64 struct {
|
||||
Value *int64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Int64) Reset() { *m = Int64{} }
|
||||
func (m *Int64) String() string { return proto.CompactTextString(m) }
|
||||
func (*Int64) ProtoMessage() {}
|
||||
func (*Int64) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{1}
|
||||
}
|
||||
|
||||
func (m *Int64) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Int64.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Int64) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Int64.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Int64) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Int64.Merge(m, src)
|
||||
}
|
||||
func (m *Int64) XXX_Size() int {
|
||||
return xxx_messageInfo_Int64.Size(m)
|
||||
}
|
||||
func (m *Int64) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Int64.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Int64 proto.InternalMessageInfo
|
||||
|
||||
func (m *Int64) GetValue() int64 {
|
||||
if m != nil && m.Value != nil {
|
||||
return *m.Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Bool struct {
|
||||
Value *bool `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Bool) Reset() { *m = Bool{} }
|
||||
func (m *Bool) String() string { return proto.CompactTextString(m) }
|
||||
func (*Bool) ProtoMessage() {}
|
||||
func (*Bool) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{2}
|
||||
}
|
||||
|
||||
func (m *Bool) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Bool.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Bool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Bool.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Bool) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Bool.Merge(m, src)
|
||||
}
|
||||
func (m *Bool) XXX_Size() int {
|
||||
return xxx_messageInfo_Bool.Size(m)
|
||||
}
|
||||
func (m *Bool) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Bool.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Bool proto.InternalMessageInfo
|
||||
|
||||
func (m *Bool) GetValue() bool {
|
||||
if m != nil && m.Value != nil {
|
||||
return *m.Value
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type String struct {
|
||||
Value *string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *String) Reset() { *m = String{} }
|
||||
func (m *String) String() string { return proto.CompactTextString(m) }
|
||||
func (*String) ProtoMessage() {}
|
||||
func (*String) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{3}
|
||||
}
|
||||
|
||||
func (m *String) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_String.Unmarshal(m, b)
|
||||
}
|
||||
func (m *String) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_String.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *String) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_String.Merge(m, src)
|
||||
}
|
||||
func (m *String) XXX_Size() int {
|
||||
return xxx_messageInfo_String.Size(m)
|
||||
}
|
||||
func (m *String) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_String.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_String proto.InternalMessageInfo
|
||||
|
||||
func (m *String) GetValue() string {
|
||||
if m != nil && m.Value != nil {
|
||||
return *m.Value
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Bytes struct {
|
||||
Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Bytes) Reset() { *m = Bytes{} }
|
||||
func (m *Bytes) String() string { return proto.CompactTextString(m) }
|
||||
func (*Bytes) ProtoMessage() {}
|
||||
func (*Bytes) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{4}
|
||||
}
|
||||
|
||||
func (m *Bytes) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Bytes.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Bytes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Bytes.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Bytes) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Bytes.Merge(m, src)
|
||||
}
|
||||
func (m *Bytes) XXX_Size() int {
|
||||
return xxx_messageInfo_Bytes.Size(m)
|
||||
}
|
||||
func (m *Bytes) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Bytes.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Bytes proto.InternalMessageInfo
|
||||
|
||||
func (m *Bytes) GetValue() []byte {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type MsgHead struct {
|
||||
Cid *int32 `protobuf:"varint,1,opt,name=cid" json:"cid,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *MsgHead) Reset() { *m = MsgHead{} }
|
||||
func (m *MsgHead) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgHead) ProtoMessage() {}
|
||||
func (*MsgHead) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{5}
|
||||
}
|
||||
|
||||
func (m *MsgHead) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MsgHead.Unmarshal(m, b)
|
||||
}
|
||||
func (m *MsgHead) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_MsgHead.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *MsgHead) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgHead.Merge(m, src)
|
||||
}
|
||||
func (m *MsgHead) XXX_Size() int {
|
||||
return xxx_messageInfo_MsgHead.Size(m)
|
||||
}
|
||||
func (m *MsgHead) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgHead.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgHead proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgHead) GetCid() int32 {
|
||||
if m != nil && m.Cid != nil {
|
||||
return *m.Cid
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Msg struct {
|
||||
Head *MsgHead `protobuf:"bytes,1,opt,name=head" json:"head,omitempty"`
|
||||
Ret *int32 `protobuf:"varint,2,opt,name=ret" json:"ret,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Msg) Reset() { *m = Msg{} }
|
||||
func (m *Msg) String() string { return proto.CompactTextString(m) }
|
||||
func (*Msg) ProtoMessage() {}
|
||||
func (*Msg) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{6}
|
||||
}
|
||||
|
||||
var extRange_Msg = []proto.ExtensionRange{
|
||||
{Start: 100, End: 10000},
|
||||
}
|
||||
|
||||
func (*Msg) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
return extRange_Msg
|
||||
}
|
||||
|
||||
func (m *Msg) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Msg.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Msg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Msg.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Msg) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Msg.Merge(m, src)
|
||||
}
|
||||
func (m *Msg) XXX_Size() int {
|
||||
return xxx_messageInfo_Msg.Size(m)
|
||||
}
|
||||
func (m *Msg) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Msg.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Msg proto.InternalMessageInfo
|
||||
|
||||
func (m *Msg) GetHead() *MsgHead {
|
||||
if m != nil {
|
||||
return m.Head
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Msg) GetRet() int32 {
|
||||
if m != nil && m.Ret != nil {
|
||||
return *m.Ret
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ClientList struct {
|
||||
ClientList []uint64 `protobuf:"varint,1,rep,name=clientList" json:"clientList,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ClientList) Reset() { *m = ClientList{} }
|
||||
func (m *ClientList) String() string { return proto.CompactTextString(m) }
|
||||
func (*ClientList) ProtoMessage() {}
|
||||
func (*ClientList) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{7}
|
||||
}
|
||||
|
||||
func (m *ClientList) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ClientList.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ClientList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ClientList.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ClientList) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ClientList.Merge(m, src)
|
||||
}
|
||||
func (m *ClientList) XXX_Size() int {
|
||||
return xxx_messageInfo_ClientList.Size(m)
|
||||
}
|
||||
func (m *ClientList) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ClientList.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ClientList proto.InternalMessageInfo
|
||||
|
||||
func (m *ClientList) GetClientList() []uint64 {
|
||||
if m != nil {
|
||||
return m.ClientList
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ReplyMessage struct {
|
||||
ClientList []uint64 `protobuf:"varint,1,rep,name=clientList" json:"clientList,omitempty"`
|
||||
MsgType *uint32 `protobuf:"varint,2,opt,name=msgType" json:"msgType,omitempty"`
|
||||
Msg []byte `protobuf:"bytes,3,opt,name=msg" json:"msg,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ReplyMessage) Reset() { *m = ReplyMessage{} }
|
||||
func (m *ReplyMessage) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReplyMessage) ProtoMessage() {}
|
||||
func (*ReplyMessage) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{8}
|
||||
}
|
||||
|
||||
func (m *ReplyMessage) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ReplyMessage.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ReplyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ReplyMessage.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ReplyMessage) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ReplyMessage.Merge(m, src)
|
||||
}
|
||||
func (m *ReplyMessage) XXX_Size() int {
|
||||
return xxx_messageInfo_ReplyMessage.Size(m)
|
||||
}
|
||||
func (m *ReplyMessage) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ReplyMessage.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ReplyMessage proto.InternalMessageInfo
|
||||
|
||||
func (m *ReplyMessage) GetClientList() []uint64 {
|
||||
if m != nil {
|
||||
return m.ClientList
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ReplyMessage) GetMsgType() uint32 {
|
||||
if m != nil && m.MsgType != nil {
|
||||
return *m.MsgType
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ReplyMessage) GetMsg() []byte {
|
||||
if m != nil {
|
||||
return m.Msg
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PlaceHolders struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *PlaceHolders) Reset() { *m = PlaceHolders{} }
|
||||
func (m *PlaceHolders) String() string { return proto.CompactTextString(m) }
|
||||
func (*PlaceHolders) ProtoMessage() {}
|
||||
func (*PlaceHolders) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d66ec2e140567106, []int{9}
|
||||
}
|
||||
|
||||
func (m *PlaceHolders) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PlaceHolders.Unmarshal(m, b)
|
||||
}
|
||||
func (m *PlaceHolders) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_PlaceHolders.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *PlaceHolders) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_PlaceHolders.Merge(m, src)
|
||||
}
|
||||
func (m *PlaceHolders) XXX_Size() int {
|
||||
return xxx_messageInfo_PlaceHolders.Size(m)
|
||||
}
|
||||
func (m *PlaceHolders) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_PlaceHolders.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_PlaceHolders proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Int)(nil), "tcpgateway.Int")
|
||||
proto.RegisterType((*Int64)(nil), "tcpgateway.Int64")
|
||||
proto.RegisterType((*Bool)(nil), "tcpgateway.Bool")
|
||||
proto.RegisterType((*String)(nil), "tcpgateway.String")
|
||||
proto.RegisterType((*Bytes)(nil), "tcpgateway.Bytes")
|
||||
proto.RegisterType((*MsgHead)(nil), "tcpgateway.MsgHead")
|
||||
proto.RegisterType((*Msg)(nil), "tcpgateway.Msg")
|
||||
proto.RegisterType((*ClientList)(nil), "tcpgateway.ClientList")
|
||||
proto.RegisterType((*ReplyMessage)(nil), "tcpgateway.ReplyMessage")
|
||||
proto.RegisterType((*PlaceHolders)(nil), "tcpgateway.PlaceHolders")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("base/base.proto", fileDescriptor_d66ec2e140567106) }
|
||||
|
||||
var fileDescriptor_d66ec2e140567106 = []byte{
|
||||
// 276 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x8f, 0x41, 0x4b, 0xc3, 0x40,
|
||||
0x10, 0x85, 0xa9, 0x9b, 0xd8, 0x3a, 0x46, 0x2d, 0xab, 0x87, 0x40, 0xb5, 0x94, 0xbd, 0x58, 0x44,
|
||||
0x22, 0x88, 0xf8, 0x03, 0xea, 0xc1, 0x16, 0x8c, 0x48, 0xf4, 0xe4, 0x6d, 0x4d, 0x86, 0x35, 0xb0,
|
||||
0x4d, 0x42, 0x66, 0x54, 0xf2, 0x33, 0xfc, 0xc7, 0x92, 0xa4, 0xd1, 0xe6, 0xe4, 0x65, 0x99, 0xb7,
|
||||
0xdf, 0xec, 0xdb, 0xf7, 0xe0, 0xe8, 0x4d, 0x13, 0x5e, 0xd5, 0x47, 0x50, 0x94, 0x39, 0xe7, 0x12,
|
||||
0x38, 0x2e, 0x8c, 0x66, 0xfc, 0xd2, 0x95, 0x9a, 0x80, 0x58, 0x65, 0x2c, 0x4f, 0xc0, 0xfd, 0xd4,
|
||||
0xf6, 0x03, 0xfd, 0xc1, 0x6c, 0x30, 0x77, 0xa3, 0x56, 0xa8, 0x33, 0x70, 0x57, 0x19, 0xdf, 0xde,
|
||||
0xf4, 0xb1, 0xe8, 0xf0, 0x29, 0x38, 0x8b, 0x3c, 0xb7, 0x7d, 0x3a, 0xea, 0xe8, 0x14, 0x76, 0x9f,
|
||||
0xb9, 0x4c, 0x33, 0xd3, 0xe7, 0x7b, 0x5b, 0xe6, 0x8b, 0x8a, 0x91, 0xfa, 0xd8, 0xeb, 0xf0, 0x04,
|
||||
0x86, 0x21, 0x99, 0x25, 0xea, 0x44, 0x8e, 0x41, 0xc4, 0x69, 0xb2, 0x89, 0x56, 0x8f, 0xea, 0x1e,
|
||||
0x44, 0x48, 0x46, 0x9e, 0x83, 0xf3, 0x8e, 0xba, 0x25, 0xfb, 0xd7, 0xc7, 0xc1, 0x5f, 0xaf, 0x60,
|
||||
0xf3, 0x36, 0x6a, 0x16, 0x6a, 0x87, 0x12, 0xd9, 0xdf, 0x69, 0x1d, 0x4a, 0xe4, 0x0b, 0x77, 0x94,
|
||||
0x8c, 0xbf, 0x1f, 0xd5, 0x25, 0xc0, 0x9d, 0x4d, 0x31, 0xe3, 0x87, 0x94, 0x58, 0x4e, 0x01, 0xe2,
|
||||
0x5f, 0xe5, 0x0f, 0x66, 0x62, 0xee, 0x44, 0x5b, 0x37, 0xea, 0x15, 0xbc, 0x08, 0x0b, 0x5b, 0x85,
|
||||
0x48, 0xa4, 0x0d, 0xfe, 0xb7, 0x2f, 0x7d, 0x18, 0xae, 0xc9, 0xbc, 0x54, 0x05, 0x36, 0x5f, 0x1f,
|
||||
0x44, 0x9d, 0xac, 0x03, 0xad, 0xc9, 0xf8, 0xa2, 0x69, 0x5c, 0x8f, 0xea, 0x10, 0xbc, 0x27, 0xab,
|
||||
0x63, 0x5c, 0xe6, 0x36, 0xc1, 0x92, 0x7e, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc7, 0xb1, 0xeb, 0xcb,
|
||||
0xb6, 0x01, 0x00, 0x00,
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package tcpgateway;
|
||||
|
||||
|
||||
message Int{
|
||||
optional int32 value = 1;
|
||||
}
|
||||
|
||||
|
||||
message Int64{
|
||||
optional int64 value = 1;
|
||||
}
|
||||
|
||||
|
||||
message Bool{
|
||||
optional bool value = 1;
|
||||
}
|
||||
|
||||
message String{
|
||||
optional string value = 1;
|
||||
}
|
||||
|
||||
message Bytes{
|
||||
optional bytes value = 1;
|
||||
}
|
||||
|
||||
|
||||
message MsgHead
|
||||
{
|
||||
optional int32 cid = 1;
|
||||
}
|
||||
|
||||
message Msg
|
||||
{
|
||||
optional MsgHead head = 1;
|
||||
optional int32 ret = 2;
|
||||
extensions 100 to 10000;
|
||||
}
|
||||
|
||||
message ClientList
|
||||
{
|
||||
repeated uint64 clientList = 1;
|
||||
}
|
||||
|
||||
message ReplyMessage
|
||||
{
|
||||
repeated uint64 clientList = 1;
|
||||
optional uint32 msgType = 2;
|
||||
optional bytes msg = 3;
|
||||
}
|
||||
|
||||
message PlaceHolders
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user