rendezvous protobuf
This commit is contained in:
parent
b7dd840ce4
commit
f946163e88
|
@ -0,0 +1,324 @@
|
|||
// Code generated by protoc-gen-gogo.
|
||||
// source: rendezvous.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package rendezvous_pb is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
rendezvous.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Message
|
||||
*/
|
||||
package rendezvous_pb
|
||||
|
||||
import proto "github.com/gogo/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 Message_MessageType int32
|
||||
|
||||
const (
|
||||
Message_REGISTER Message_MessageType = 0
|
||||
Message_REGISTER_RESPONSE Message_MessageType = 1
|
||||
Message_UNREGISTER Message_MessageType = 2
|
||||
Message_DISCOVER Message_MessageType = 3
|
||||
Message_DISCOVER_RESPONSE Message_MessageType = 4
|
||||
)
|
||||
|
||||
var Message_MessageType_name = map[int32]string{
|
||||
0: "REGISTER",
|
||||
1: "REGISTER_RESPONSE",
|
||||
2: "UNREGISTER",
|
||||
3: "DISCOVER",
|
||||
4: "DISCOVER_RESPONSE",
|
||||
}
|
||||
var Message_MessageType_value = map[string]int32{
|
||||
"REGISTER": 0,
|
||||
"REGISTER_RESPONSE": 1,
|
||||
"UNREGISTER": 2,
|
||||
"DISCOVER": 3,
|
||||
"DISCOVER_RESPONSE": 4,
|
||||
}
|
||||
|
||||
func (x Message_MessageType) Enum() *Message_MessageType {
|
||||
p := new(Message_MessageType)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
func (x Message_MessageType) String() string {
|
||||
return proto.EnumName(Message_MessageType_name, int32(x))
|
||||
}
|
||||
func (x *Message_MessageType) UnmarshalJSON(data []byte) error {
|
||||
value, err := proto.UnmarshalJSONEnum(Message_MessageType_value, data, "Message_MessageType")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*x = Message_MessageType(value)
|
||||
return nil
|
||||
}
|
||||
|
||||
type Message_RegisterStatus int32
|
||||
|
||||
const (
|
||||
Message_OK Message_RegisterStatus = 0
|
||||
Message_E_INVALID_NAMESPACE Message_RegisterStatus = 100
|
||||
Message_E_INVALID_PEER_INFO Message_RegisterStatus = 101
|
||||
Message_E_NOT_AUTHORIZED Message_RegisterStatus = 200
|
||||
)
|
||||
|
||||
var Message_RegisterStatus_name = map[int32]string{
|
||||
0: "OK",
|
||||
100: "E_INVALID_NAMESPACE",
|
||||
101: "E_INVALID_PEER_INFO",
|
||||
200: "E_NOT_AUTHORIZED",
|
||||
}
|
||||
var Message_RegisterStatus_value = map[string]int32{
|
||||
"OK": 0,
|
||||
"E_INVALID_NAMESPACE": 100,
|
||||
"E_INVALID_PEER_INFO": 101,
|
||||
"E_NOT_AUTHORIZED": 200,
|
||||
}
|
||||
|
||||
func (x Message_RegisterStatus) Enum() *Message_RegisterStatus {
|
||||
p := new(Message_RegisterStatus)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
func (x Message_RegisterStatus) String() string {
|
||||
return proto.EnumName(Message_RegisterStatus_name, int32(x))
|
||||
}
|
||||
func (x *Message_RegisterStatus) UnmarshalJSON(data []byte) error {
|
||||
value, err := proto.UnmarshalJSONEnum(Message_RegisterStatus_value, data, "Message_RegisterStatus")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*x = Message_RegisterStatus(value)
|
||||
return nil
|
||||
}
|
||||
|
||||
type Message struct {
|
||||
Type *Message_MessageType `protobuf:"varint,1,opt,name=type,enum=rendezvous.pb.Message_MessageType" json:"type,omitempty"`
|
||||
Register *Message_Register `protobuf:"bytes,2,opt,name=register" json:"register,omitempty"`
|
||||
RegisterResponse *Message_RegisterResponse `protobuf:"bytes,3,opt,name=registerResponse" json:"registerResponse,omitempty"`
|
||||
Unregister *Message_Unregister `protobuf:"bytes,4,opt,name=unregister" json:"unregister,omitempty"`
|
||||
Discover *Message_Discover `protobuf:"bytes,5,opt,name=discover" json:"discover,omitempty"`
|
||||
DiscoverResponse *Message_DiscoverResponse `protobuf:"bytes,6,opt,name=discoverResponse" json:"discoverResponse,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Message) Reset() { *m = Message{} }
|
||||
func (m *Message) String() string { return proto.CompactTextString(m) }
|
||||
func (*Message) ProtoMessage() {}
|
||||
|
||||
func (m *Message) GetType() Message_MessageType {
|
||||
if m != nil && m.Type != nil {
|
||||
return *m.Type
|
||||
}
|
||||
return Message_REGISTER
|
||||
}
|
||||
|
||||
func (m *Message) GetRegister() *Message_Register {
|
||||
if m != nil {
|
||||
return m.Register
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Message) GetRegisterResponse() *Message_RegisterResponse {
|
||||
if m != nil {
|
||||
return m.RegisterResponse
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Message) GetUnregister() *Message_Unregister {
|
||||
if m != nil {
|
||||
return m.Unregister
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Message) GetDiscover() *Message_Discover {
|
||||
if m != nil {
|
||||
return m.Discover
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Message) GetDiscoverResponse() *Message_DiscoverResponse {
|
||||
if m != nil {
|
||||
return m.DiscoverResponse
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Message_PeerInfo struct {
|
||||
Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
|
||||
Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Message_PeerInfo) Reset() { *m = Message_PeerInfo{} }
|
||||
func (m *Message_PeerInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*Message_PeerInfo) ProtoMessage() {}
|
||||
|
||||
func (m *Message_PeerInfo) GetId() []byte {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Message_PeerInfo) GetAddrs() [][]byte {
|
||||
if m != nil {
|
||||
return m.Addrs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Message_Register struct {
|
||||
Ns *string `protobuf:"bytes,1,opt,name=ns" json:"ns,omitempty"`
|
||||
Peer *Message_PeerInfo `protobuf:"bytes,2,opt,name=peer" json:"peer,omitempty"`
|
||||
Ttl *int64 `protobuf:"varint,3,opt,name=ttl" json:"ttl,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Message_Register) Reset() { *m = Message_Register{} }
|
||||
func (m *Message_Register) String() string { return proto.CompactTextString(m) }
|
||||
func (*Message_Register) ProtoMessage() {}
|
||||
|
||||
func (m *Message_Register) GetNs() string {
|
||||
if m != nil && m.Ns != nil {
|
||||
return *m.Ns
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Message_Register) GetPeer() *Message_PeerInfo {
|
||||
if m != nil {
|
||||
return m.Peer
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Message_Register) GetTtl() int64 {
|
||||
if m != nil && m.Ttl != nil {
|
||||
return *m.Ttl
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Message_RegisterResponse struct {
|
||||
Status *Message_RegisterStatus `protobuf:"varint,1,opt,name=status,enum=rendezvous.pb.Message_RegisterStatus" json:"status,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Message_RegisterResponse) Reset() { *m = Message_RegisterResponse{} }
|
||||
func (m *Message_RegisterResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*Message_RegisterResponse) ProtoMessage() {}
|
||||
|
||||
func (m *Message_RegisterResponse) GetStatus() Message_RegisterStatus {
|
||||
if m != nil && m.Status != nil {
|
||||
return *m.Status
|
||||
}
|
||||
return Message_OK
|
||||
}
|
||||
|
||||
type Message_Unregister struct {
|
||||
Ns *string `protobuf:"bytes,1,opt,name=ns" json:"ns,omitempty"`
|
||||
Id []byte `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Message_Unregister) Reset() { *m = Message_Unregister{} }
|
||||
func (m *Message_Unregister) String() string { return proto.CompactTextString(m) }
|
||||
func (*Message_Unregister) ProtoMessage() {}
|
||||
|
||||
func (m *Message_Unregister) GetNs() string {
|
||||
if m != nil && m.Ns != nil {
|
||||
return *m.Ns
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Message_Unregister) GetId() []byte {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Message_Discover struct {
|
||||
Ns *string `protobuf:"bytes,1,opt,name=ns" json:"ns,omitempty"`
|
||||
Limit *int64 `protobuf:"varint,2,opt,name=limit" json:"limit,omitempty"`
|
||||
Cookie []byte `protobuf:"bytes,3,opt,name=cookie" json:"cookie,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Message_Discover) Reset() { *m = Message_Discover{} }
|
||||
func (m *Message_Discover) String() string { return proto.CompactTextString(m) }
|
||||
func (*Message_Discover) ProtoMessage() {}
|
||||
|
||||
func (m *Message_Discover) GetNs() string {
|
||||
if m != nil && m.Ns != nil {
|
||||
return *m.Ns
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Message_Discover) GetLimit() int64 {
|
||||
if m != nil && m.Limit != nil {
|
||||
return *m.Limit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Message_Discover) GetCookie() []byte {
|
||||
if m != nil {
|
||||
return m.Cookie
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Message_DiscoverResponse struct {
|
||||
Registrations []*Message_Register `protobuf:"bytes,1,rep,name=registrations" json:"registrations,omitempty"`
|
||||
Cookie []byte `protobuf:"bytes,2,opt,name=cookie" json:"cookie,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Message_DiscoverResponse) Reset() { *m = Message_DiscoverResponse{} }
|
||||
func (m *Message_DiscoverResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*Message_DiscoverResponse) ProtoMessage() {}
|
||||
|
||||
func (m *Message_DiscoverResponse) GetRegistrations() []*Message_Register {
|
||||
if m != nil {
|
||||
return m.Registrations
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Message_DiscoverResponse) GetCookie() []byte {
|
||||
if m != nil {
|
||||
return m.Cookie
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Message)(nil), "rendezvous.pb.Message")
|
||||
proto.RegisterType((*Message_PeerInfo)(nil), "rendezvous.pb.Message.PeerInfo")
|
||||
proto.RegisterType((*Message_Register)(nil), "rendezvous.pb.Message.Register")
|
||||
proto.RegisterType((*Message_RegisterResponse)(nil), "rendezvous.pb.Message.RegisterResponse")
|
||||
proto.RegisterType((*Message_Unregister)(nil), "rendezvous.pb.Message.Unregister")
|
||||
proto.RegisterType((*Message_Discover)(nil), "rendezvous.pb.Message.Discover")
|
||||
proto.RegisterType((*Message_DiscoverResponse)(nil), "rendezvous.pb.Message.DiscoverResponse")
|
||||
proto.RegisterEnum("rendezvous.pb.Message_MessageType", Message_MessageType_name, Message_MessageType_value)
|
||||
proto.RegisterEnum("rendezvous.pb.Message_RegisterStatus", Message_RegisterStatus_name, Message_RegisterStatus_value)
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package rendezvous.pb;
|
||||
|
||||
message Message {
|
||||
enum MessageType {
|
||||
REGISTER = 0;
|
||||
REGISTER_RESPONSE = 1;
|
||||
UNREGISTER = 2;
|
||||
DISCOVER = 3;
|
||||
DISCOVER_RESPONSE = 4;
|
||||
}
|
||||
|
||||
message PeerInfo {
|
||||
optional bytes id = 1;
|
||||
repeated bytes addrs = 2;
|
||||
}
|
||||
|
||||
message Register {
|
||||
optional string ns = 1;
|
||||
optional PeerInfo peer = 2;
|
||||
optional int64 ttl = 3; // in seconds
|
||||
}
|
||||
|
||||
enum RegisterStatus {
|
||||
OK = 0;
|
||||
E_INVALID_NAMESPACE = 100;
|
||||
E_INVALID_PEER_INFO = 101;
|
||||
E_NOT_AUTHORIZED = 200;
|
||||
}
|
||||
|
||||
message RegisterResponse {
|
||||
optional RegisterStatus status = 1;
|
||||
}
|
||||
|
||||
message Unregister {
|
||||
optional string ns = 1;
|
||||
optional bytes id = 2;
|
||||
}
|
||||
|
||||
message Discover {
|
||||
optional string ns = 1;
|
||||
optional int64 limit = 2;
|
||||
optional bytes cookie = 3;
|
||||
}
|
||||
|
||||
message DiscoverResponse {
|
||||
repeated Register registrations = 1;
|
||||
optional bytes cookie = 2;
|
||||
}
|
||||
|
||||
optional MessageType type = 1;
|
||||
optional Register register = 2;
|
||||
optional RegisterResponse registerResponse = 3;
|
||||
optional Unregister unregister = 4;
|
||||
optional Discover discover = 5;
|
||||
optional DiscoverResponse discoverResponse = 6;
|
||||
}
|
Loading…
Reference in New Issue