删除了一些无关的业务代码
parent
d87c61f271
commit
c4917a65a2
|
@ -3,10 +3,10 @@ MAINTAINER caiyu "a7458969@gmail.com"
|
|||
|
||||
WORKDIR /home/ubuntu/api/bin
|
||||
|
||||
ADD rudy /bin
|
||||
ADD TcpServConfig.json /bin
|
||||
ADD go-tcpFramework-rudy /bin/go-tcpFramework-rudy
|
||||
ADD TcpServConfig.json /bin/TcpServConfig.json
|
||||
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
|
||||
|
||||
EXPOSE 9850
|
||||
|
||||
ENTRYPOINT ["rudy --conf_path=/bin/TcpServConfig.json"]
|
||||
ENTRYPOINT ["/bin/go-tcpFramework-rudy","--conf_path=/bin/TcpServConfig.json"]
|
31
README.md
31
README.md
|
@ -10,3 +10,34 @@
|
|||
支持apolo配置
|
||||
心跳包支持
|
||||
服务端推送支持
|
||||
#### How to use
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"go-tcpFramework-rudy/config"
|
||||
"go-tcpFramework-rudy/logger"
|
||||
"go-tcpFramework-rudy/network"
|
||||
"log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var confPath string
|
||||
flag.StringVar(&confPath,"conf_path","TcpServConfig.json","the path of configuration file")
|
||||
flag.Parse()
|
||||
config.InitConfig(confPath)
|
||||
|
||||
//network.SetHandler(handler.HandlePack)
|
||||
server := network.ServerFactory(config.Configs().Ipadress)
|
||||
server.SetHandler(nil)
|
||||
log.Print("start " + config.Configs().Type + " server " + "at address " + config.Configs().Ipadress)
|
||||
e := server.Run()
|
||||
if nil != e {
|
||||
logger.LogDebugError(e.Error())
|
||||
}
|
||||
}
|
||||
```
|
||||
server 服务实例
|
||||
server.SetHandler 设置处理句柄
|
||||
server.Run() 服务启动
|
1
main.go
1
main.go
|
@ -16,6 +16,7 @@ func main() {
|
|||
|
||||
//network.SetHandler(handler.HandlePack)
|
||||
server := network.ServerFactory(config.Configs().Ipadress)
|
||||
server.SetHandler(nil)
|
||||
log.Print("start " + config.Configs().Type + " server " + "at address " + config.Configs().Ipadress)
|
||||
e := server.Run()
|
||||
if nil != e {
|
||||
|
|
|
@ -1,142 +0,0 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: base.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package protocol is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
base.proto
|
||||
msgType.proto
|
||||
|
||||
It has these top-level messages:
|
||||
LoginReq
|
||||
OfflineReq
|
||||
LoginResp
|
||||
OfflineResp
|
||||
Request
|
||||
Response
|
||||
*/
|
||||
package protocol
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import 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 LoginReq struct {
|
||||
Timestamp *int64 `protobuf:"varint,1,opt,name=timestamp" json:"timestamp,omitempty"`
|
||||
Username *string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
|
||||
Passwd *string `protobuf:"bytes,3,opt,name=passwd" json:"passwd,omitempty"`
|
||||
Channel *string `protobuf:"bytes,4,opt,name=channel" json:"channel,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *LoginReq) Reset() { *m = LoginReq{} }
|
||||
func (m *LoginReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*LoginReq) ProtoMessage() {}
|
||||
func (*LoginReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *LoginReq) GetTimestamp() int64 {
|
||||
if m != nil && m.Timestamp != nil {
|
||||
return *m.Timestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *LoginReq) GetUsername() string {
|
||||
if m != nil && m.Username != nil {
|
||||
return *m.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *LoginReq) GetPasswd() string {
|
||||
if m != nil && m.Passwd != nil {
|
||||
return *m.Passwd
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *LoginReq) GetChannel() string {
|
||||
if m != nil && m.Channel != nil {
|
||||
return *m.Channel
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type OfflineReq struct {
|
||||
Timestamp *int64 `protobuf:"varint,1,opt,name=timestamp" json:"timestamp,omitempty"`
|
||||
Username *string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *OfflineReq) Reset() { *m = OfflineReq{} }
|
||||
func (m *OfflineReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*OfflineReq) ProtoMessage() {}
|
||||
func (*OfflineReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
func (m *OfflineReq) GetTimestamp() int64 {
|
||||
if m != nil && m.Timestamp != nil {
|
||||
return *m.Timestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *OfflineReq) GetUsername() string {
|
||||
if m != nil && m.Username != nil {
|
||||
return *m.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type LoginResp struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *LoginResp) Reset() { *m = LoginResp{} }
|
||||
func (m *LoginResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*LoginResp) ProtoMessage() {}
|
||||
func (*LoginResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
|
||||
type OfflineResp struct {
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *OfflineResp) Reset() { *m = OfflineResp{} }
|
||||
func (m *OfflineResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*OfflineResp) ProtoMessage() {}
|
||||
func (*OfflineResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*LoginReq)(nil), "protocol.LoginReq")
|
||||
proto.RegisterType((*OfflineReq)(nil), "protocol.OfflineReq")
|
||||
proto.RegisterType((*LoginResp)(nil), "protocol.LoginResp")
|
||||
proto.RegisterType((*OfflineResp)(nil), "protocol.OfflineResp")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("base.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 158 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x4a, 0x4a, 0x2c, 0x4e,
|
||||
0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x00, 0x53, 0xc9, 0xf9, 0x39, 0x4a, 0x65, 0x5c,
|
||||
0x1c, 0x3e, 0xf9, 0xe9, 0x99, 0x79, 0x41, 0xa9, 0x85, 0x42, 0x32, 0x5c, 0x9c, 0x25, 0x99, 0xb9,
|
||||
0xa9, 0xc5, 0x25, 0x89, 0xb9, 0x05, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x08, 0x01, 0x21,
|
||||
0x29, 0x2e, 0x8e, 0xd2, 0xe2, 0xd4, 0xa2, 0xbc, 0xc4, 0xdc, 0x54, 0x09, 0x26, 0xa0, 0x24, 0x67,
|
||||
0x10, 0x9c, 0x2f, 0x24, 0xc6, 0xc5, 0x56, 0x90, 0x58, 0x5c, 0x5c, 0x9e, 0x22, 0xc1, 0x0c, 0x96,
|
||||
0x81, 0xf2, 0x84, 0x24, 0xb8, 0xd8, 0x93, 0x33, 0x12, 0xf3, 0xf2, 0x52, 0x73, 0x24, 0x58, 0xc0,
|
||||
0x12, 0x30, 0xae, 0x92, 0x1b, 0x17, 0x97, 0x7f, 0x5a, 0x5a, 0x4e, 0x66, 0x5e, 0x2a, 0x45, 0x36,
|
||||
0x2b, 0x71, 0x73, 0x71, 0x42, 0xdd, 0x5f, 0x5c, 0xa0, 0xc4, 0xcb, 0xc5, 0x0d, 0x37, 0xb4, 0xb8,
|
||||
0x00, 0x10, 0x00, 0x00, 0xff, 0xff, 0x98, 0x8f, 0x49, 0x5a, 0xf2, 0x00, 0x00, 0x00,
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
package middle
|
|
@ -1,129 +0,0 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: msgType.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package protocol
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
type Request struct {
|
||||
Session *int32 `protobuf:"varint,1,req,name=session" json:"session,omitempty"`
|
||||
Sequence *int32 `protobuf:"varint,2,req,name=sequence" json:"sequence,omitempty"`
|
||||
Login *LoginReq `protobuf:"bytes,1001,opt,name=login" json:"login,omitempty"`
|
||||
Offline *OfflineReq `protobuf:"bytes,1002,opt,name=offline" json:"offline,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Request) Reset() { *m = Request{} }
|
||||
func (m *Request) String() string { return proto.CompactTextString(m) }
|
||||
func (*Request) ProtoMessage() {}
|
||||
func (*Request) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
|
||||
|
||||
func (m *Request) GetSession() int32 {
|
||||
if m != nil && m.Session != nil {
|
||||
return *m.Session
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Request) GetSequence() int32 {
|
||||
if m != nil && m.Sequence != nil {
|
||||
return *m.Sequence
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Request) GetLogin() *LoginReq {
|
||||
if m != nil {
|
||||
return m.Login
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Request) GetOffline() *OfflineReq {
|
||||
if m != nil {
|
||||
return m.Offline
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Response struct {
|
||||
Session *int32 `protobuf:"varint,1,req,name=session" json:"session,omitempty"`
|
||||
Sequence *int32 `protobuf:"varint,2,req,name=sequence" json:"sequence,omitempty"`
|
||||
Message *string `protobuf:"bytes,3,req,name=message" json:"message,omitempty"`
|
||||
RespLogin *LoginResp `protobuf:"bytes,1001,opt,name=respLogin" json:"respLogin,omitempty"`
|
||||
RespOffline *OfflineResp `protobuf:"bytes,1002,opt,name=respOffline" json:"respOffline,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Response) Reset() { *m = Response{} }
|
||||
func (m *Response) String() string { return proto.CompactTextString(m) }
|
||||
func (*Response) ProtoMessage() {}
|
||||
func (*Response) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} }
|
||||
|
||||
func (m *Response) GetSession() int32 {
|
||||
if m != nil && m.Session != nil {
|
||||
return *m.Session
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Response) GetSequence() int32 {
|
||||
if m != nil && m.Sequence != nil {
|
||||
return *m.Sequence
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Response) GetMessage() string {
|
||||
if m != nil && m.Message != nil {
|
||||
return *m.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Response) GetRespLogin() *LoginResp {
|
||||
if m != nil {
|
||||
return m.RespLogin
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Response) GetRespOffline() *OfflineResp {
|
||||
if m != nil {
|
||||
return m.RespOffline
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Request)(nil), "protocol.Request")
|
||||
proto.RegisterType((*Response)(nil), "protocol.Response")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("msgType.proto", fileDescriptor1) }
|
||||
|
||||
var fileDescriptor1 = []byte{
|
||||
// 222 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0xcd, 0x2d, 0x4e, 0x0f,
|
||||
0xa9, 0x2c, 0x48, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x00, 0x53, 0xc9, 0xf9, 0x39,
|
||||
0x52, 0x5c, 0x49, 0x89, 0xc5, 0x50, 0x51, 0xa5, 0xd9, 0x8c, 0x5c, 0xec, 0x41, 0xa9, 0x85, 0xa5,
|
||||
0xa9, 0xc5, 0x25, 0x42, 0x12, 0x5c, 0xec, 0xc5, 0xa9, 0xc5, 0xc5, 0x99, 0xf9, 0x79, 0x12, 0x8c,
|
||||
0x0a, 0x4c, 0x1a, 0xac, 0x41, 0x30, 0xae, 0x90, 0x14, 0x17, 0x47, 0x31, 0x48, 0x51, 0x5e, 0x72,
|
||||
0xaa, 0x04, 0x13, 0x58, 0x0a, 0xce, 0x17, 0xd2, 0xe4, 0x62, 0xcd, 0xc9, 0x4f, 0xcf, 0xcc, 0x93,
|
||||
0x78, 0xc9, 0xae, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xa4, 0x07, 0xb3, 0x48, 0xcf, 0x07, 0x24, 0x0e,
|
||||
0x34, 0x3d, 0x08, 0xa2, 0x42, 0x48, 0x9f, 0x8b, 0x3d, 0x3f, 0x2d, 0x2d, 0x27, 0x33, 0x2f, 0x55,
|
||||
0xe2, 0x15, 0x44, 0xb1, 0x08, 0x42, 0xb1, 0x3f, 0x44, 0x06, 0xa4, 0x1c, 0xa6, 0x4a, 0xe9, 0x04,
|
||||
0x23, 0x17, 0x47, 0x50, 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0x2a, 0x99, 0xce, 0x03, 0xea, 0xca,
|
||||
0x05, 0x2a, 0x4b, 0x4c, 0x4f, 0x95, 0x60, 0x06, 0x4a, 0x71, 0x06, 0xc1, 0xb8, 0x42, 0x46, 0x5c,
|
||||
0x9c, 0x45, 0x40, 0xb3, 0x7d, 0x90, 0x1d, 0x2f, 0x8c, 0xe1, 0xf8, 0xe2, 0x82, 0x20, 0x84, 0x32,
|
||||
0x21, 0x0b, 0x2e, 0x6e, 0x10, 0xc7, 0x1f, 0xd5, 0x17, 0xa2, 0x58, 0x7c, 0x01, 0xd4, 0x87, 0xac,
|
||||
0x14, 0x10, 0x00, 0x00, 0xff, 0xff, 0x15, 0x0d, 0x55, 0x5d, 0x8e, 0x01, 0x00, 0x00,
|
||||
}
|
|
@ -1,168 +0,0 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: base.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package protocol is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
base.proto
|
||||
msgType.proto
|
||||
|
||||
It has these top-level messages:
|
||||
LoginReq
|
||||
LoginResp
|
||||
OfflineReq
|
||||
OfflineResp
|
||||
Request
|
||||
Response
|
||||
*/
|
||||
package protocol
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import 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 LoginReq struct {
|
||||
Timestamp *int64 `protobuf:"varint,1,opt,name=timestamp" json:"timestamp,omitempty"`
|
||||
Username *string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
|
||||
Passwd *string `protobuf:"bytes,3,opt,name=passwd" json:"passwd,omitempty"`
|
||||
Channel *string `protobuf:"bytes,4,opt,name=channel" json:"channel,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *LoginReq) Reset() { *m = LoginReq{} }
|
||||
func (m *LoginReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*LoginReq) ProtoMessage() {}
|
||||
func (*LoginReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *LoginReq) GetTimestamp() int64 {
|
||||
if m != nil && m.Timestamp != nil {
|
||||
return *m.Timestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *LoginReq) GetUsername() string {
|
||||
if m != nil && m.Username != nil {
|
||||
return *m.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *LoginReq) GetPasswd() string {
|
||||
if m != nil && m.Passwd != nil {
|
||||
return *m.Passwd
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *LoginReq) GetChannel() string {
|
||||
if m != nil && m.Channel != nil {
|
||||
return *m.Channel
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type LoginResp struct {
|
||||
Message *string `protobuf:"bytes,1,req,name=Message" json:"Message,omitempty"`
|
||||
Code *int32 `protobuf:"varint,2,req,name=Code" json:"Code,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *LoginResp) Reset() { *m = LoginResp{} }
|
||||
func (m *LoginResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*LoginResp) ProtoMessage() {}
|
||||
func (*LoginResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
func (m *LoginResp) GetMessage() string {
|
||||
if m != nil && m.Message != nil {
|
||||
return *m.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *LoginResp) GetCode() int32 {
|
||||
if m != nil && m.Code != nil {
|
||||
return *m.Code
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type OfflineReq struct {
|
||||
Username *string `protobuf:"bytes,2,req,name=username" json:"username,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *OfflineReq) Reset() { *m = OfflineReq{} }
|
||||
func (m *OfflineReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*OfflineReq) ProtoMessage() {}
|
||||
func (*OfflineReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
|
||||
func (m *OfflineReq) GetUsername() string {
|
||||
if m != nil && m.Username != nil {
|
||||
return *m.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type OfflineResp struct {
|
||||
Message *string `protobuf:"bytes,1,req,name=Message" json:"Message,omitempty"`
|
||||
Code *int32 `protobuf:"varint,2,req,name=Code" json:"Code,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *OfflineResp) Reset() { *m = OfflineResp{} }
|
||||
func (m *OfflineResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*OfflineResp) ProtoMessage() {}
|
||||
func (*OfflineResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
||||
|
||||
func (m *OfflineResp) GetMessage() string {
|
||||
if m != nil && m.Message != nil {
|
||||
return *m.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *OfflineResp) GetCode() int32 {
|
||||
if m != nil && m.Code != nil {
|
||||
return *m.Code
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*LoginReq)(nil), "protocol.LoginReq")
|
||||
proto.RegisterType((*LoginResp)(nil), "protocol.LoginResp")
|
||||
proto.RegisterType((*OfflineReq)(nil), "protocol.OfflineReq")
|
||||
proto.RegisterType((*OfflineResp)(nil), "protocol.OfflineResp")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("base.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 192 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x8e, 0x31, 0xaf, 0x82, 0x30,
|
||||
0x14, 0x85, 0x43, 0xe1, 0xbd, 0x07, 0xf7, 0x6d, 0x1d, 0x5e, 0x9a, 0x17, 0x07, 0xd3, 0x89, 0xc9,
|
||||
0xdd, 0x38, 0xba, 0x6a, 0x4c, 0xfa, 0x0f, 0x2a, 0x5c, 0x90, 0x04, 0xda, 0xca, 0x45, 0xfd, 0xfb,
|
||||
0xd2, 0x06, 0x51, 0x47, 0xa7, 0xf6, 0xbb, 0xe7, 0x24, 0xdf, 0x01, 0x38, 0x6a, 0xc2, 0x95, 0xeb,
|
||||
0xed, 0x60, 0x79, 0x1a, 0x9e, 0xc2, 0xb6, 0xf2, 0x0a, 0xe9, 0xce, 0xd6, 0x8d, 0x51, 0x78, 0xe6,
|
||||
0x0b, 0xc8, 0x86, 0xa6, 0x43, 0x1a, 0x74, 0xe7, 0x44, 0xb4, 0x8c, 0xf2, 0x58, 0x3d, 0x0f, 0xfc,
|
||||
0x1f, 0xd2, 0x0b, 0x61, 0x6f, 0x74, 0x87, 0x82, 0x8d, 0x61, 0xa6, 0x66, 0xe6, 0x7f, 0xf0, 0xed,
|
||||
0x34, 0xd1, 0xad, 0x14, 0x71, 0x48, 0x26, 0xe2, 0x02, 0x7e, 0x8a, 0x93, 0x36, 0x06, 0x5b, 0x91,
|
||||
0x84, 0xe0, 0x81, 0x72, 0x0d, 0xd9, 0xe4, 0x25, 0xe7, 0x6b, 0x7b, 0x24, 0xd2, 0x35, 0x8e, 0x5a,
|
||||
0xe6, 0x6b, 0x13, 0x72, 0x0e, 0xc9, 0xd6, 0x96, 0x5e, 0xc8, 0xf2, 0x2f, 0x15, 0xfe, 0x32, 0x07,
|
||||
0x38, 0x54, 0x55, 0xdb, 0x18, 0xf4, 0xa3, 0xdf, 0x67, 0xb1, 0xd7, 0x59, 0x72, 0x03, 0xbf, 0x73,
|
||||
0xf3, 0x53, 0xcd, 0x3d, 0x00, 0x00, 0xff, 0xff, 0x29, 0x47, 0x03, 0x1e, 0x30, 0x01, 0x00, 0x00,
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package protocol;
|
||||
|
||||
message LoginReq{
|
||||
optional int64 timestamp =1 ;
|
||||
optional string username = 2;
|
||||
optional string passwd = 3;
|
||||
optional string channel = 4;
|
||||
}
|
||||
|
||||
message OfflineReq {
|
||||
optional int64 timestamp =1 ;
|
||||
optional string username = 2;
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
protoc.exe --plugin=protoc-gen-go=./protoc-gen-go.exe --go_out=./ *.proto
|
||||
pause
|
|
@ -1,121 +0,0 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: msgType.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package protocol
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
type Request struct {
|
||||
Session *int32 `protobuf:"varint,1,req,name=session" json:"session,omitempty"`
|
||||
Sequence *int32 `protobuf:"varint,2,req,name=sequence" json:"sequence,omitempty"`
|
||||
LoginReq *LoginReq `protobuf:"bytes,1001,opt,name=loginReq" json:"loginReq,omitempty"`
|
||||
OfflineReq *OfflineReq `protobuf:"bytes,1002,opt,name=offlineReq" json:"offlineReq,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Request) Reset() { *m = Request{} }
|
||||
func (m *Request) String() string { return proto.CompactTextString(m) }
|
||||
func (*Request) ProtoMessage() {}
|
||||
func (*Request) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
|
||||
|
||||
func (m *Request) GetSession() int32 {
|
||||
if m != nil && m.Session != nil {
|
||||
return *m.Session
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Request) GetSequence() int32 {
|
||||
if m != nil && m.Sequence != nil {
|
||||
return *m.Sequence
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Request) GetLoginReq() *LoginReq {
|
||||
if m != nil {
|
||||
return m.LoginReq
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Request) GetOfflineReq() *OfflineReq {
|
||||
if m != nil {
|
||||
return m.OfflineReq
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Response struct {
|
||||
Session *int32 `protobuf:"varint,1,req,name=session" json:"session,omitempty"`
|
||||
Sequence *int32 `protobuf:"varint,2,req,name=sequence" json:"sequence,omitempty"`
|
||||
LoginResp *LoginResp `protobuf:"bytes,3,opt,name=loginResp" json:"loginResp,omitempty"`
|
||||
OfflineResp *OfflineResp `protobuf:"bytes,4,opt,name=offlineResp" json:"offlineResp,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Response) Reset() { *m = Response{} }
|
||||
func (m *Response) String() string { return proto.CompactTextString(m) }
|
||||
func (*Response) ProtoMessage() {}
|
||||
func (*Response) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} }
|
||||
|
||||
func (m *Response) GetSession() int32 {
|
||||
if m != nil && m.Session != nil {
|
||||
return *m.Session
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Response) GetSequence() int32 {
|
||||
if m != nil && m.Sequence != nil {
|
||||
return *m.Sequence
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Response) GetLoginResp() *LoginResp {
|
||||
if m != nil {
|
||||
return m.LoginResp
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Response) GetOfflineResp() *OfflineResp {
|
||||
if m != nil {
|
||||
return m.OfflineResp
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Request)(nil), "protocol.Request")
|
||||
proto.RegisterType((*Response)(nil), "protocol.Response")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("msgType.proto", fileDescriptor1) }
|
||||
|
||||
var fileDescriptor1 = []byte{
|
||||
// 210 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0xcd, 0x2d, 0x4e, 0x0f,
|
||||
0xa9, 0x2c, 0x48, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x00, 0x53, 0xc9, 0xf9, 0x39,
|
||||
0x52, 0x5c, 0x49, 0x89, 0xc5, 0x50, 0x51, 0xa5, 0xe5, 0x8c, 0x5c, 0xec, 0x41, 0xa9, 0x85, 0xa5,
|
||||
0xa9, 0xc5, 0x25, 0x42, 0x12, 0x5c, 0xec, 0xc5, 0xa9, 0xc5, 0xc5, 0x99, 0xf9, 0x79, 0x12, 0x8c,
|
||||
0x0a, 0x4c, 0x1a, 0xac, 0x41, 0x30, 0xae, 0x90, 0x14, 0x17, 0x47, 0x31, 0x48, 0x51, 0x5e, 0x72,
|
||||
0xaa, 0x04, 0x13, 0x58, 0x0a, 0xce, 0x17, 0xd2, 0xe7, 0xe2, 0xc8, 0xc9, 0x4f, 0xcf, 0xcc, 0x03,
|
||||
0x9a, 0x22, 0xf1, 0x92, 0x5d, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x48, 0x0f, 0x66, 0x97, 0x9e, 0x0f,
|
||||
0x54, 0x2a, 0x08, 0xae, 0x48, 0xc8, 0x94, 0x8b, 0x2b, 0x3f, 0x2d, 0x2d, 0x27, 0x33, 0x2f, 0x15,
|
||||
0xa4, 0xe5, 0x15, 0x44, 0x8b, 0x08, 0x42, 0x8b, 0x3f, 0x5c, 0x32, 0x08, 0x49, 0xa1, 0xd2, 0x1a,
|
||||
0x46, 0x2e, 0x8e, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0x32, 0x9d, 0x6a, 0xc8, 0xc5,
|
||||
0x09, 0x75, 0x45, 0x71, 0x81, 0x04, 0x33, 0xd8, 0x5e, 0x61, 0x0c, 0xa7, 0x16, 0x17, 0x04, 0x21,
|
||||
0x54, 0x09, 0x99, 0x73, 0x71, 0xc3, 0xdd, 0x00, 0xd4, 0xc4, 0x02, 0xd6, 0x24, 0x8a, 0xc5, 0xb1,
|
||||
0x40, 0x6d, 0xc8, 0x2a, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe2, 0xe8, 0xbd, 0x08, 0x7e, 0x01,
|
||||
0x00, 0x00,
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package protocol;
|
||||
import "base.proto";
|
||||
|
||||
|
||||
message Request{//请求类型消息
|
||||
optional int32 session = 1; //消息序列
|
||||
optional int32 sequence = 2; //消息序号
|
||||
|
||||
optional LoginReq login = 1001;
|
||||
optional OfflineReq offline = 1002;
|
||||
}
|
||||
|
||||
message Response{//相应类型消息
|
||||
optional int32 session = 1; //消息序列
|
||||
optional int32 sequence = 2; //消息序号
|
||||
|
||||
}
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue