Functional loopback code

This commit is contained in:
Asim Aslam
2019-07-03 19:26:24 +01:00
parent 7008809eff
commit e54de56376
5 changed files with 313 additions and 137 deletions

View File

@@ -22,10 +22,12 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// A connect message is for connecting to the network
type Connect struct {
// the unique muid (mac) address of the node
Muid string `protobuf:"bytes,1,opt,name=muid,proto3" json:"muid,omitempty"`
// Lease specifies an existing lease to indicate
// we don't need a new address, we just want to
// establish a link.
Lease *Lease `protobuf:"bytes,1,opt,name=lease,proto3" json:"lease,omitempty"`
Lease *Lease `protobuf:"bytes,2,opt,name=lease,proto3" json:"lease,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -56,6 +58,13 @@ func (m *Connect) XXX_DiscardUnknown() {
var xxx_messageInfo_Connect proto.InternalMessageInfo
func (m *Connect) GetMuid() string {
if m != nil {
return m.Muid
}
return ""
}
func (m *Connect) GetLease() *Lease {
if m != nil {
return m.Lease
@@ -63,14 +72,16 @@ func (m *Connect) GetLease() *Lease {
return nil
}
// A lease is returned to anyone attempting to connect.
// A lease is returned to anyone attempting to connect with a valid muid.
type Lease struct {
// unique lease id
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// timestamp of lease
Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
// author is the muid of the author
Author string `protobuf:"bytes,3,opt,name=author,proto3" json:"author,omitempty"`
// the node
Node *Node `protobuf:"bytes,3,opt,name=node,proto3" json:"node,omitempty"`
Node *Node `protobuf:"bytes,4,opt,name=node,proto3" json:"node,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -115,6 +126,13 @@ func (m *Lease) GetTimestamp() int64 {
return 0
}
func (m *Lease) GetAuthor() string {
if m != nil {
return m.Author
}
return ""
}
func (m *Lease) GetNode() *Node {
if m != nil {
return m.Node
@@ -124,9 +142,10 @@ func (m *Lease) GetNode() *Node {
// A node is the network node
type Node struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
Network string `protobuf:"bytes,3,opt,name=network,proto3" json:"network,omitempty"`
Muid string `protobuf:"bytes,1,opt,name=muid,proto3" json:"muid,omitempty"`
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"`
Network string `protobuf:"bytes,4,opt,name=network,proto3" json:"network,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -157,6 +176,13 @@ func (m *Node) XXX_DiscardUnknown() {
var xxx_messageInfo_Node proto.InternalMessageInfo
func (m *Node) GetMuid() string {
if m != nil {
return m.Muid
}
return ""
}
func (m *Node) GetId() string {
if m != nil {
return m.Id
@@ -189,18 +215,20 @@ func init() {
}
var fileDescriptor_4daa91d05ddc28b6 = []byte{
// 203 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xc1, 0x4a, 0xc4, 0x30,
0x10, 0x86, 0x69, 0x77, 0xd7, 0x25, 0x23, 0x88, 0xe4, 0xa0, 0x39, 0x78, 0x58, 0x7a, 0x2a, 0x85,
0xa6, 0xa0, 0x17, 0xef, 0xde, 0x44, 0x3c, 0xe4, 0x0d, 0x62, 0x33, 0x94, 0xa0, 0xcd, 0x94, 0x24,
0xe0, 0xeb, 0x4b, 0xa7, 0xad, 0x82, 0xbd, 0xe5, 0x9b, 0xf9, 0xf3, 0x7f, 0x30, 0xd0, 0x8c, 0xbe,
0x8f, 0xd4, 0x0d, 0xd4, 0x2e, 0x8f, 0x80, 0xf9, 0x9b, 0xe2, 0x67, 0x37, 0x45, 0xca, 0xbf, 0xa4,
0x99, 0xe4, 0xed, 0x40, 0x9a, 0x53, 0x7a, 0x9d, 0x57, 0xcf, 0x70, 0x7e, 0xa1, 0x10, 0xb0, 0xcf,
0xb2, 0x85, 0xd3, 0x17, 0xda, 0x84, 0xaa, 0xb8, 0x14, 0xf5, 0xf5, 0xe3, 0xbd, 0xfe, 0x1f, 0xd6,
0x6f, 0xf3, 0xda, 0x2c, 0xa9, 0xca, 0xc2, 0x89, 0x59, 0xde, 0x40, 0xe9, 0x1d, 0x7f, 0x12, 0xa6,
0xf4, 0x4e, 0x3e, 0x80, 0xc8, 0x7e, 0xc4, 0x94, 0xed, 0x38, 0xa9, 0xf2, 0x52, 0xd4, 0x07, 0xf3,
0x37, 0x90, 0x0d, 0x1c, 0x03, 0x39, 0x54, 0x07, 0x96, 0xdc, 0xed, 0x25, 0xef, 0xe4, 0xd0, 0x70,
0xa6, 0x7a, 0x85, 0xe3, 0x4c, 0x3b, 0x83, 0x82, 0xb3, 0x75, 0x2e, 0x62, 0x4a, 0xdc, 0x2f, 0xcc,
0x86, 0xf3, 0x66, 0xed, 0x61, 0x81, 0x30, 0x1b, 0x7e, 0x5c, 0xf1, 0x05, 0x9e, 0x7e, 0x02, 0x00,
0x00, 0xff, 0xff, 0xf3, 0x2b, 0x3d, 0x08, 0x2f, 0x01, 0x00, 0x00,
// 229 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x6a, 0xc3, 0x30,
0x0c, 0x86, 0x49, 0x9a, 0xb6, 0x44, 0x83, 0x31, 0x74, 0xe8, 0x7c, 0xd8, 0xa1, 0xe4, 0x54, 0x0a,
0x75, 0x61, 0x7b, 0x84, 0x5d, 0xcb, 0x0e, 0x7e, 0x80, 0x41, 0x56, 0x8b, 0x2e, 0x6c, 0xb6, 0x8a,
0xed, 0x32, 0xf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network;
// A connect message is for connecting to the network
message Connect {
// the unique muid (mac) address of the node
string muid = 1;
// Lease specifies an existing lease to indicate
// we don't need a new address, we just want to
// establish a link.
Lease lease = 1;
Lease lease = 2;
}
// A lease is returned to anyone attempting to connect.
// A lease is returned to anyone attempting to connect with a valid muid.
message Lease {
// unique lease id
string id = 1;
// timestamp of lease
int64 timestamp = 2;
// author is the muid of the author
string author = 3;
// the node
Node node = 3;
Node node = 4;
}
// A node is the network node
message Node {
string id = 1;
string address = 2;
string network = 3;
string muid = 1;
string id = 2;
string address = 3;
string network = 4;
}