Neighbour is now peer. Neighbourhood is Peers. Small refactor.

This commit is contained in:
Milos Gajdos 2019-09-10 01:14:23 +01:00
parent f91d0408ab
commit 195c6a8c90
No known key found for this signature in database
GPG Key ID: 8B31058CC55DFD4F
7 changed files with 385 additions and 394 deletions

View File

@ -1,7 +1,6 @@
package network
import (
"container/list"
"errors"
"sync"
"time"
@ -109,7 +108,7 @@ func newNetwork(opts ...Option) Network {
node: &node{
id: options.Id,
address: options.Address,
neighbours: make(map[string]*node),
peers: make(map[string]*node),
},
options: options,
Router: options.Router,
@ -261,70 +260,69 @@ func (n *network) processNetChan(client transport.Client, listener tunnel.Listen
n.Lock()
log.Debugf("Network received connect message from: %s", pbNetConnect.Node.Id)
// if the entry already exists skip adding it
if neighbour, ok := n.neighbours[pbNetConnect.Node.Id]; ok {
if peer, ok := n.peers[pbNetConnect.Node.Id]; ok {
// update lastSeen timestamp
if n.neighbours[pbNetConnect.Node.Id].lastSeen.Before(now) {
neighbour.lastSeen = now
if n.peers[pbNetConnect.Node.Id].lastSeen.Before(now) {
peer.lastSeen = now
}
n.Unlock()
continue
}
// add a new neighbour
// NOTE: new node does not have any neighbours
n.neighbours[pbNetConnect.Node.Id] = &node{
// add a new peer to the node peers
// NOTE: new node does not have any peers, yet
n.peers[pbNetConnect.Node.Id] = &node{
id: pbNetConnect.Node.Id,
address: pbNetConnect.Node.Address,
neighbours: make(map[string]*node),
peers: make(map[string]*node),
lastSeen: now,
}
n.Unlock()
// advertise yourself to the network
if err := n.sendMsg("neighbour", NetworkChannel); err != nil {
log.Debugf("Network failed to advertise neighbours: %v", err)
if err := n.sendMsg("peer", NetworkChannel); err != nil {
log.Debugf("Network failed to advertise peers: %v", err)
}
// advertise all the routes when a new node has connected
if err := n.Router.Solicit(); err != nil {
log.Debugf("Network failed to solicit routes: %s", err)
}
case "neighbour":
case "peer":
// mark the time the message has been received
now := time.Now()
pbNetNeighbour := &pbNet.Neighbour{}
if err := proto.Unmarshal(m.Body, pbNetNeighbour); err != nil {
log.Debugf("Network tunnel [%s] neighbour unmarshal error: %v", NetworkChannel, err)
pbNetPeer := &pbNet.Peer{}
if err := proto.Unmarshal(m.Body, pbNetPeer); err != nil {
log.Debugf("Network tunnel [%s] peer unmarshal error: %v", NetworkChannel, err)
continue
}
// don't process your own messages
if pbNetNeighbour.Node.Id == n.options.Id {
if pbNetPeer.Node.Id == n.options.Id {
continue
}
n.Lock()
log.Debugf("Network received neighbour message from: %s", pbNetNeighbour.Node.Id)
// only add the neighbour if it is NOT already in node's list of neighbours
_, exists := n.neighbours[pbNetNeighbour.Node.Id]
log.Debugf("Network received peer message from: %s", pbNetPeer.Node.Id)
// only add the peer if it is NOT already in node's list of peers
_, exists := n.peers[pbNetPeer.Node.Id]
if !exists {
n.neighbours[pbNetNeighbour.Node.Id] = &node{
id: pbNetNeighbour.Node.Id,
address: pbNetNeighbour.Node.Address,
neighbours: make(map[string]*node),
n.peers[pbNetPeer.Node.Id] = &node{
id: pbNetPeer.Node.Id,
address: pbNetPeer.Node.Address,
peers: make(map[string]*node),
lastSeen: now,
}
n.Unlock()
// send a solicit message when discovering new neighbour
// send a solicit message when discovering new peer
// NOTE: we need to release the Lock here as sendMsg locsk, too
if err := n.sendMsg("solicit", ControlChannel); err != nil {
log.Debugf("Network failed to send solicit message: %s", err)
}
continue
}
// update/store the node neighbour neighbours up to (MaxDepth-1) topology depth
// NOTE: we don't update max topology depth as we dont include this network node
if err := n.node.updateNeighbour(pbNetNeighbour, MaxDepth-1); err != nil {
log.Debugf("Network failed to update neighbours")
if err := n.node.updatePeerTopology(pbNetPeer, MaxDepth-1); err != nil {
log.Debugf("Network failed to update peers")
}
// update lastSeen timestamp if outdated
if n.neighbours[pbNetNeighbour.Node.Id].lastSeen.Before(now) {
n.neighbours[pbNetNeighbour.Node.Id].lastSeen = now
if n.peers[pbNetPeer.Node.Id].lastSeen.Before(now) {
n.peers[pbNetPeer.Node.Id].lastSeen = now
}
n.Unlock()
case "close":
@ -373,13 +371,13 @@ func (n *network) sendMsg(msgType string, channel string) error {
protoMsg = &pbNet.Solicit{
Node: node,
}
case "neighbour":
case "peer":
n.RLock()
var err error
// get all the neighbours down to MaxDepth
protoMsg, err = n.node.getNeighbours(MaxDepth)
// get all the node peers down to MaxDepth
protoMsg, err = n.node.getProtoTopology(MaxDepth)
if err != nil {
log.Debugf("Network unable to retrieve node neighbours: %s", err)
log.Debugf("Network unable to retrieve node peers: %s", err)
return err
}
n.RUnlock()
@ -416,7 +414,7 @@ func (n *network) sendMsg(msgType string, channel string) error {
return nil
}
// announce announces node neighbourhood to the network
// announce announces node peers to the network
func (n *network) announce(client transport.Client) {
announce := time.NewTicker(AnnounceTime)
defer announce.Stop()
@ -427,18 +425,18 @@ func (n *network) announce(client transport.Client) {
return
case <-announce.C:
// advertise yourself to the network
if err := n.sendMsg("neighbour", NetworkChannel); err != nil {
log.Debugf("Network failed to advertise neighbours: %v", err)
if err := n.sendMsg("peer", NetworkChannel); err != nil {
log.Debugf("Network failed to advertise peers: %v", err)
continue
}
}
}
}
// pruneNode removes a node with given id from the list of neighbours. It also removes all routes originted by this node.
// pruneNode removes a node with given id from the list of peers. It also removes all routes originted by this node.
// NOTE: this method is not thread-safe; when calling it make sure you lock the particular code segment
func (n *network) pruneNode(id string) error {
delete(n.neighbours, id)
delete(n.peers, id)
// lookup all the routes originated at this node
q := router.NewQuery(
router.QueryRouter(id),
@ -470,7 +468,7 @@ func (n *network) prune() {
return
case <-prune.C:
n.Lock()
for id, node := range n.neighbours {
for id, node := range n.peers {
if id == n.options.Id {
continue
}
@ -528,8 +526,8 @@ func (n *network) acceptCtrlConn(l tunnel.Listener, recv chan *transport.Message
// setRouteMetric calculates metric of the route and updates it in place
// - Local route metric is 1
// - Routes with ID of adjacent neighbour are 10
// - Routes of neighbours of the advertiser are 100
// - Routes with ID of adjacent nodes are 10
// - Routes by peers of the advertiser are 100
// - Routes beyond your neighbourhood are 1000
func (n *network) setRouteMetric(route *router.Route) {
// we are the origin of the route
@ -539,16 +537,16 @@ func (n *network) setRouteMetric(route *router.Route) {
}
n.RLock()
// check if the route origin is our neighbour
if _, ok := n.neighbours[route.Router]; ok {
// check if the route origin is our peer
if _, ok := n.peers[route.Router]; ok {
route.Metric = 10
n.RUnlock()
return
}
// check if the route origin is the neighbour of our neighbour
for _, node := range n.neighbours {
for id := range node.neighbours {
// check if the route origin is the peer of our peer
for _, peer := range n.peers {
for id := range peer.peers {
if route.Router == id {
route.Metric = 100
n.RUnlock()
@ -586,19 +584,19 @@ func (n *network) processCtrlChan(client transport.Client, listener tunnel.Liste
if pbRtrAdvert.Id == n.options.Id {
continue
}
// loookup advertising node in our neighbourhood
// loookup advertising node in our peers
n.RLock()
log.Debugf("Network received advert message from: %s", pbRtrAdvert.Id)
advertNode, ok := n.neighbours[pbRtrAdvert.Id]
advertNode, ok := n.peers[pbRtrAdvert.Id]
if !ok {
// advertising node has not been registered as our neighbour, yet
// let's add it to the map of our neighbours
// advertising node has not been registered as our peer, yet
// let's add it to our peers
advertNode = &node{
id: pbRtrAdvert.Id,
neighbours: make(map[string]*node),
peers: make(map[string]*node),
lastSeen: now,
}
n.neighbours[pbRtrAdvert.Id] = advertNode
n.peers[pbRtrAdvert.Id] = advertNode
// send a solicit message when discovering a new node
if err := n.sendMsg("solicit", NetworkChannel); err != nil {
log.Debugf("Network failed to send solicit message: %s", err)
@ -611,16 +609,16 @@ func (n *network) processCtrlChan(client transport.Client, listener tunnel.Liste
// set the address of the advertising node
// we know Route.Gateway is the address of advertNode
// NOTE: this is true only when advertNode had not been registered
// as our neighbour when we received the advert from it
// as our peer when we received the advert from it
if advertNode.address == "" {
advertNode.address = event.Route.Gateway
}
// if advertising node id is not the same as Route.Router
// we know the advertising node is not the origin of the route
if advertNode.id != event.Route.Router {
// if the origin router is not in the advertising node neighbourhood
// if the origin router is not the advertising node peer
// we can't rule out potential routing loops so we bail here
if _, ok := advertNode.neighbours[event.Route.Router]; !ok {
if _, ok := advertNode.peers[event.Route.Router]; !ok {
continue
}
}
@ -821,7 +819,7 @@ func (n *network) Connect() error {
// go resolving network nodes
go n.resolve()
// broadcast neighbourhood
// broadcast peers
go n.announce(netClient)
// prune stale nodes
go n.prune()
@ -839,48 +837,6 @@ func (n *network) Connect() error {
return nil
}
// Nodes returns a list of all network nodes
func (n *network) Nodes() []Node {
//track the visited nodes
visited := make(map[string]*node)
// queue of the nodes to visit
queue := list.New()
// we need to freeze the network graph here
// otherwise we might get invalid results
n.RLock()
defer n.RUnlock()
// push network node to the back of queue
queue.PushBack(n.node)
// mark the node as visited
visited[n.node.id] = n.node
// keep iterating over the queue until its empty
for queue.Len() > 0 {
// pop the node from the front of the queue
qnode := queue.Front()
// iterate through all of its neighbours
// mark the visited nodes; enqueue the non-visted
for id, node := range qnode.Value.(*node).neighbours {
if _, ok := visited[id]; !ok {
visited[id] = node
queue.PushBack(node)
}
}
// remove the node from the queue
queue.Remove(qnode)
}
var nodes []Node
// collect all the nodes and return them
for _, node := range visited {
nodes = append(nodes, node)
}
return nodes
}
func (n *network) close() error {
// stop the server
if err := n.server.Stop(); err != nil {

View File

@ -16,6 +16,74 @@ type Network struct {
Network network.Network
}
// ListNodes returns a list of all accessible nodes in the network
func (n *Network) ListNodes(ctx context.Context, req *pbNet.ListRequest, resp *pbNet.ListResponse) error {
nodes := n.Network.Nodes()
var respNodes []*pbNet.Node
for _, node := range nodes {
respNode := &pbNet.Node{
Id: node.Id(),
Address: node.Address(),
}
respNodes = append(respNodes, respNode)
}
resp.Nodes = respNodes
return nil
}
// ListPeers returns a list of all the nodes the node has a direct link with
func (n *Network) ListPeers(ctx context.Context, req *pbNet.PeerRequest, resp *pbNet.PeerResponse) error {
// extract the id of the node to query
id := req.Id
// if no id is passed, we assume local node
if id == "" {
id = n.Network.Id()
}
// get all the nodes in the network
nodes := n.Network.Nodes()
// sort the slice of nodes
sort.Slice(nodes, func(i, j int) bool { return nodes[i].Id() <= nodes[j].Id() })
// find a node with a given id
i := sort.Search(len(nodes), func(j int) bool { return nodes[j].Id() >= id })
var nodePeers []*pbNet.Node
// collect all the node peers into slice
if i < len(nodes) && nodes[i].Id() == id {
for _, peer := range nodes[i].Peers() {
// don't return yourself in response
if peer.Id() == n.Network.Id() {
continue
}
pbPeer := &pbNet.Node{
Id: peer.Id(),
Address: peer.Address(),
}
nodePeers = append(nodePeers, pbPeer)
}
}
// requested node
node := &pbNet.Node{
Id: nodes[i].Id(),
Address: nodes[i].Address(),
}
// creaate peers answer
peers := &pbNet.Peers{
Node: node,
Peers: nodePeers,
}
resp.Peers = peers
return nil
}
// ListRoutes returns a list of routing table routes
func (n *Network) ListRoutes(ctx context.Context, req *pbRtr.Request, resp *pbRtr.ListResponse) error {
routes, err := n.Network.Options().Router.Table().List()
@ -41,71 +109,3 @@ func (n *Network) ListRoutes(ctx context.Context, req *pbRtr.Request, resp *pbRt
return nil
}
// ListNodes returns a list of all accessible nodes in the network
func (n *Network) ListNodes(ctx context.Context, req *pbNet.ListRequest, resp *pbNet.ListResponse) error {
nodes := n.Network.Nodes()
var respNodes []*pbNet.Node
for _, node := range nodes {
respNode := &pbNet.Node{
Id: node.Id(),
Address: node.Address(),
}
respNodes = append(respNodes, respNode)
}
resp.Nodes = respNodes
return nil
}
// Neighbourhood returns a list of immediate neighbours
func (n *Network) Neighbourhood(ctx context.Context, req *pbNet.NeighbourhoodRequest, resp *pbNet.NeighbourhoodResponse) error {
// extract the id of the node to query
id := req.Id
// if no id is passed, we assume local node
if id == "" {
id = n.Network.Id()
}
// get all the nodes in the network
nodes := n.Network.Nodes()
// sort the slice of nodes
sort.Slice(nodes, func(i, j int) bool { return nodes[i].Id() <= nodes[j].Id() })
// find a node with a given id
i := sort.Search(len(nodes), func(j int) bool { return nodes[j].Id() >= id })
var neighbours []*pbNet.Node
// collect all the nodes in the neighbourhood of the found node
if i < len(nodes) && nodes[i].Id() == id {
for _, neighbour := range nodes[i].Neighbourhood() {
// don't return yourself in response
if neighbour.Id() == n.Network.Id() {
continue
}
pbNeighbour := &pbNet.Node{
Id: neighbour.Id(),
Address: neighbour.Address(),
}
neighbours = append(neighbours, pbNeighbour)
}
}
// requested neighbourhood node
node := &pbNet.Node{
Id: nodes[i].Id(),
Address: nodes[i].Address(),
}
// creaate neighbourhood answer
neighbourhood := &pbNet.Neighbourhood{
Node: node,
Neighbours: neighbours,
}
resp.Neighbourhood = neighbourhood
return nil
}

View File

@ -28,8 +28,8 @@ type Node interface {
Id() string
// Address is node bind address
Address() string
// Neighbourhood is node neighbourhood
Neighbourhood() []Node
// Peers returns node peers
Peers() []Node
// Network is the network node is in
Network() Network
}

View File

@ -1,6 +1,7 @@
package network
import (
"container/list"
"errors"
"sync"
"time"
@ -20,11 +21,11 @@ type node struct {
id string
// address is node address
address string
// neighbours maps the node neighbourhood
neighbours map[string]*node
// peers are nodes with direct link to this node
peers map[string]*node
// network returns the node network
network Network
// lastSeen stores the time the node has been seen last time
// lastSeen keeps track of node lifetime and updates
lastSeen time.Time
}
@ -43,112 +44,147 @@ func (n *node) Network() Network {
return n.network
}
// Neighbourhood returns node neighbourhood
func (n *node) Neighbourhood() []Node {
var nodes []Node
// Nodes returns a slice if all nodes in node topology
func (n *node) Nodes() []Node {
//track the visited nodes
visited := make(map[string]*node)
// queue of the nodes to visit
queue := list.New()
// we need to freeze the network graph here
// otherwise we might get invalid results
n.RLock()
for _, neighbourNode := range n.neighbours {
// make a copy of the node
n := &node{
id: neighbourNode.id,
address: neighbourNode.address,
network: neighbourNode.network,
defer n.RUnlock()
// push node to the back of queue
queue.PushBack(n)
// mark the node as visited
visited[n.id] = n
// keep iterating over the queue until its empty
for queue.Len() > 0 {
// pop the node from the front of the queue
qnode := queue.Front()
// iterate through all of the node peers
// mark the visited nodes; enqueue the non-visted
for id, node := range qnode.Value.(*node).peers {
if _, ok := visited[id]; !ok {
visited[id] = node
queue.PushBack(node)
}
// NOTE: we do not care about neighbour's neighbours
nodes = append(nodes, n)
}
n.RUnlock()
// remove the node from the queue
queue.Remove(qnode)
}
var nodes []Node
// collect all the nodes and return them
for _, node := range visited {
nodes = append(nodes, node)
}
return nodes
}
// getNeighbours collects node neighbours up to given depth into pbNeighbours
// NOTE: this method is not thread safe, so make sure you serialize access to it
// NOTE: we should be able to read-Lock this, even though it's recursive
func (n *node) getNeighbours(depth int) (*pbNet.Neighbour, error) {
// Peers returns node peers
func (n *node) Peers() []Node {
var peers []Node
n.RLock()
for _, peer := range n.peers {
// make a copy of the node
p := &node{
id: peer.id,
address: peer.address,
network: peer.network,
}
// NOTE: we do not care about peer's peers
peers = append(peers, p)
}
n.RUnlock()
return peers
}
// getProtoTopology returns node peers up to given depth encoded in protobufs
// NOTE: this method is NOT thread-safe, so make sure you serialize access to it
func (n *node) getProtoTopology(depth int) (*pbNet.Peer, error) {
node := &pbNet.Node{
Id: n.id,
Address: n.address,
}
pbNeighbours := &pbNet.Neighbour{
pbPeers := &pbNet.Peer{
Node: node,
Neighbours: make([]*pbNet.Neighbour, 0),
Peers: make([]*pbNet.Peer, 0),
}
// return if have either reached the depth or have no more neighbours
if depth == 0 || len(n.neighbours) == 0 {
return pbNeighbours, nil
// return if have either reached the depth or have no more peers
if depth == 0 || len(n.peers) == 0 {
return pbPeers, nil
}
// decrement the depth
depth--
var neighbours []*pbNet.Neighbour
for _, neighbour := range n.neighbours {
// get neighbours of the neighbour
var peers []*pbNet.Peer
for _, peer := range n.peers {
// get peers of the node peers
// NOTE: this is [not] a recursive call
pbNodeNeighbour, err := neighbour.getNeighbours(depth)
pbPeerPeer, err := peer.getProtoTopology(depth)
if err != nil {
return nil, err
}
// add current neighbour to explored neighbours
neighbours = append(neighbours, pbNodeNeighbour)
// add current peer to explored peers
peers = append(peers, pbPeerPeer)
}
// add neighbours to the parent topology
pbNeighbours.Neighbours = neighbours
// add peers to the parent topology
pbPeers.Peers = peers
return pbNeighbours, nil
return pbPeers, nil
}
// unpackNeighbour unpacks pbNet.Neighbour into node of given depth
// NOTE: this method is not thread safe, so make sure you serialize access to it
func unpackNeighbour(pbNeighbour *pbNet.Neighbour, depth int) (*node, error) {
if pbNeighbour == nil {
return nil, errors.New("neighbour not initialized")
// unpackPeer unpacks pbNet.Peer into node topology of given depth
// NOTE: this method is NOT thread-safe, so make sure you serialize access to it
func unpackPeer(pbPeer *pbNet.Peer, depth int) *node {
peerNode := &node{
id: pbPeer.Node.Id,
address: pbPeer.Node.Address,
peers: make(map[string]*node),
}
neighbourNode := &node{
id: pbNeighbour.Node.Id,
address: pbNeighbour.Node.Address,
neighbours: make(map[string]*node),
}
// return if have either reached the depth or have no more neighbours
if depth == 0 || len(pbNeighbour.Neighbours) == 0 {
return neighbourNode, nil
// return if have either reached the depth or have no more peers
if depth == 0 || len(pbPeer.Peers) == 0 {
return peerNode
}
// decrement the depth
depth--
neighbours := make(map[string]*node)
for _, pbNode := range pbNeighbour.Neighbours {
node, err := unpackNeighbour(pbNode, depth)
if err != nil {
return nil, err
}
neighbours[pbNode.Node.Id] = node
peers := make(map[string]*node)
for _, pbPeer := range pbPeer.Peers {
peer := unpackPeer(pbPeer, depth)
peers[pbPeer.Node.Id] = peer
}
neighbourNode.neighbours = neighbours
peerNode.peers = peers
return neighbourNode, nil
return peerNode
}
// updateNeighbour updates node neighbour up to given depth
// updatePeer updates node peer up to given depth
// NOTE: this method is not thread safe, so make sure you serialize access to it
func (n *node) updateNeighbour(neighbour *pbNet.Neighbour, depth int) error {
// unpack neighbour into topology of size MaxDepth-1
// NOTE: we need MaxDepth-1 because node n is the parent adding which
// gives us the max neighbour topology we maintain and propagate
node, err := unpackNeighbour(neighbour, MaxDepth-1)
if err != nil {
return err
func (n *node) updatePeerTopology(pbPeer *pbNet.Peer, depth int) error {
if pbPeer == nil {
return errors.New("peer not initialized")
}
// update node neighbours with new topology
n.neighbours[neighbour.Node.Id] = node
// NOTE: we need MaxDepth-1 because node n is the parent adding which
// gives us the max peer topology we maintain and propagate
peer := unpackPeer(pbPeer, MaxDepth-1)
// update node peers with new topology
n.peers[pbPeer.Node.Id] = peer
return nil
}

View File

@ -36,7 +36,7 @@ var _ server.Option
type NetworkService interface {
ListNodes(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
Neighbourhood(ctx context.Context, in *NeighbourhoodRequest, opts ...client.CallOption) (*NeighbourhoodResponse, error)
ListPeers(ctx context.Context, in *PeerRequest, opts ...client.CallOption) (*PeerResponse, error)
ListRoutes(ctx context.Context, in *proto1.Request, opts ...client.CallOption) (*proto1.ListResponse, error)
}
@ -68,9 +68,9 @@ func (c *networkService) ListNodes(ctx context.Context, in *ListRequest, opts ..
return out, nil
}
func (c *networkService) Neighbourhood(ctx context.Context, in *NeighbourhoodRequest, opts ...client.CallOption) (*NeighbourhoodResponse, error) {
req := c.c.NewRequest(c.name, "Network.Neighbourhood", in)
out := new(NeighbourhoodResponse)
func (c *networkService) ListPeers(ctx context.Context, in *PeerRequest, opts ...client.CallOption) (*PeerResponse, error) {
req := c.c.NewRequest(c.name, "Network.ListPeers", in)
out := new(PeerResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
@ -92,14 +92,14 @@ func (c *networkService) ListRoutes(ctx context.Context, in *proto1.Request, opt
type NetworkHandler interface {
ListNodes(context.Context, *ListRequest, *ListResponse) error
Neighbourhood(context.Context, *NeighbourhoodRequest, *NeighbourhoodResponse) error
ListPeers(context.Context, *PeerRequest, *PeerResponse) error
ListRoutes(context.Context, *proto1.Request, *proto1.ListResponse) error
}
func RegisterNetworkHandler(s server.Server, hdlr NetworkHandler, opts ...server.HandlerOption) error {
type network interface {
ListNodes(ctx context.Context, in *ListRequest, out *ListResponse) error
Neighbourhood(ctx context.Context, in *NeighbourhoodRequest, out *NeighbourhoodResponse) error
ListPeers(ctx context.Context, in *PeerRequest, out *PeerResponse) error
ListRoutes(ctx context.Context, in *proto1.Request, out *proto1.ListResponse) error
}
type Network struct {
@ -117,8 +117,8 @@ func (h *networkHandler) ListNodes(ctx context.Context, in *ListRequest, out *Li
return h.NetworkHandler.ListNodes(ctx, in, out)
}
func (h *networkHandler) Neighbourhood(ctx context.Context, in *NeighbourhoodRequest, out *NeighbourhoodResponse) error {
return h.NetworkHandler.Neighbourhood(ctx, in, out)
func (h *networkHandler) ListPeers(ctx context.Context, in *PeerRequest, out *PeerResponse) error {
return h.NetworkHandler.ListPeers(ctx, in, out)
}
func (h *networkHandler) ListRoutes(ctx context.Context, in *proto1.Request, out *proto1.ListResponse) error {

View File

@ -93,129 +93,129 @@ func (m *ListResponse) GetNodes() []*Node {
return nil
}
// NeighbourhoodRequest is sent to query node neighbourhood
type NeighbourhoodRequest struct {
// PeerRequest is sent to query node peers
type PeerRequest struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *NeighbourhoodRequest) Reset() { *m = NeighbourhoodRequest{} }
func (m *NeighbourhoodRequest) String() string { return proto.CompactTextString(m) }
func (*NeighbourhoodRequest) ProtoMessage() {}
func (*NeighbourhoodRequest) Descriptor() ([]byte, []int) {
func (m *PeerRequest) Reset() { *m = PeerRequest{} }
func (m *PeerRequest) String() string { return proto.CompactTextString(m) }
func (*PeerRequest) ProtoMessage() {}
func (*PeerRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_8571034d60397816, []int{2}
}
func (m *NeighbourhoodRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_NeighbourhoodRequest.Unmarshal(m, b)
func (m *PeerRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PeerRequest.Unmarshal(m, b)
}
func (m *NeighbourhoodRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_NeighbourhoodRequest.Marshal(b, m, deterministic)
func (m *PeerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PeerRequest.Marshal(b, m, deterministic)
}
func (m *NeighbourhoodRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_NeighbourhoodRequest.Merge(m, src)
func (m *PeerRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_PeerRequest.Merge(m, src)
}
func (m *NeighbourhoodRequest) XXX_Size() int {
return xxx_messageInfo_NeighbourhoodRequest.Size(m)
func (m *PeerRequest) XXX_Size() int {
return xxx_messageInfo_PeerRequest.Size(m)
}
func (m *NeighbourhoodRequest) XXX_DiscardUnknown() {
xxx_messageInfo_NeighbourhoodRequest.DiscardUnknown(m)
func (m *PeerRequest) XXX_DiscardUnknown() {
xxx_messageInfo_PeerRequest.DiscardUnknown(m)
}
var xxx_messageInfo_NeighbourhoodRequest proto.InternalMessageInfo
var xxx_messageInfo_PeerRequest proto.InternalMessageInfo
func (m *NeighbourhoodRequest) GetId() string {
func (m *PeerRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
// NeighbourhoodResponse returns node neighbourhood
type NeighbourhoodResponse struct {
Neighbourhoodi *Neighbourhood `protobuf:"bytes,1,opt,name=neighbourhoodi,proto3" json:"neighbourhoodi,omitempty"`
// PeerResponse returns node neighbourhood
type PeerResponse struct {
Peers *Peers `protobuf:"bytes,1,opt,name=peers,proto3" json:"peers,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *NeighbourhoodResponse) Reset() { *m = NeighbourhoodResponse{} }
func (m *NeighbourhoodResponse) String() string { return proto.CompactTextString(m) }
func (*NeighbourhoodResponse) ProtoMessage() {}
func (*NeighbourhoodResponse) Descriptor() ([]byte, []int) {
func (m *PeerResponse) Reset() { *m = PeerResponse{} }
func (m *PeerResponse) String() string { return proto.CompactTextString(m) }
func (*PeerResponse) ProtoMessage() {}
func (*PeerResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_8571034d60397816, []int{3}
}
func (m *NeighbourhoodResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_NeighbourhoodResponse.Unmarshal(m, b)
func (m *PeerResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PeerResponse.Unmarshal(m, b)
}
func (m *NeighbourhoodResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_NeighbourhoodResponse.Marshal(b, m, deterministic)
func (m *PeerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PeerResponse.Marshal(b, m, deterministic)
}
func (m *NeighbourhoodResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_NeighbourhoodResponse.Merge(m, src)
func (m *PeerResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_PeerResponse.Merge(m, src)
}
func (m *NeighbourhoodResponse) XXX_Size() int {
return xxx_messageInfo_NeighbourhoodResponse.Size(m)
func (m *PeerResponse) XXX_Size() int {
return xxx_messageInfo_PeerResponse.Size(m)
}
func (m *NeighbourhoodResponse) XXX_DiscardUnknown() {
xxx_messageInfo_NeighbourhoodResponse.DiscardUnknown(m)
func (m *PeerResponse) XXX_DiscardUnknown() {
xxx_messageInfo_PeerResponse.DiscardUnknown(m)
}
var xxx_messageInfo_NeighbourhoodResponse proto.InternalMessageInfo
var xxx_messageInfo_PeerResponse proto.InternalMessageInfo
func (m *NeighbourhoodResponse) GetNeighbourhoodi() *Neighbourhood {
func (m *PeerResponse) GetPeers() *Peers {
if m != nil {
return m.Neighbourhoodi
return m.Peers
}
return nil
}
type Neighbourhood struct {
type Peers struct {
Node *Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"`
Neighbours []*Node `protobuf:"bytes,2,rep,name=neighbours,proto3" json:"neighbours,omitempty"`
Peers []*Node `protobuf:"bytes,2,rep,name=peers,proto3" json:"peers,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Neighbourhood) Reset() { *m = Neighbourhood{} }
func (m *Neighbourhood) String() string { return proto.CompactTextString(m) }
func (*Neighbourhood) ProtoMessage() {}
func (*Neighbourhood) Descriptor() ([]byte, []int) {
func (m *Peers) Reset() { *m = Peers{} }
func (m *Peers) String() string { return proto.CompactTextString(m) }
func (*Peers) ProtoMessage() {}
func (*Peers) Descriptor() ([]byte, []int) {
return fileDescriptor_8571034d60397816, []int{4}
}
func (m *Neighbourhood) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Neighbourhood.Unmarshal(m, b)
func (m *Peers) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Peers.Unmarshal(m, b)
}
func (m *Neighbourhood) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Neighbourhood.Marshal(b, m, deterministic)
func (m *Peers) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Peers.Marshal(b, m, deterministic)
}
func (m *Neighbourhood) XXX_Merge(src proto.Message) {
xxx_messageInfo_Neighbourhood.Merge(m, src)
func (m *Peers) XXX_Merge(src proto.Message) {
xxx_messageInfo_Peers.Merge(m, src)
}
func (m *Neighbourhood) XXX_Size() int {
return xxx_messageInfo_Neighbourhood.Size(m)
func (m *Peers) XXX_Size() int {
return xxx_messageInfo_Peers.Size(m)
}
func (m *Neighbourhood) XXX_DiscardUnknown() {
xxx_messageInfo_Neighbourhood.DiscardUnknown(m)
func (m *Peers) XXX_DiscardUnknown() {
xxx_messageInfo_Peers.DiscardUnknown(m)
}
var xxx_messageInfo_Neighbourhood proto.InternalMessageInfo
var xxx_messageInfo_Peers proto.InternalMessageInfo
func (m *Neighbourhood) GetNode() *Node {
func (m *Peers) GetNode() *Node {
if m != nil {
return m.Node
}
return nil
}
func (m *Neighbourhood) GetNeighbours() []*Node {
func (m *Peers) GetPeers() []*Node {
if m != nil {
return m.Neighbours
return m.Peers
}
return nil
}
@ -393,52 +393,52 @@ func (m *Solicit) GetNode() *Node {
return nil
}
// Neighbour is used to nnounce node neighbourhood
type Neighbour struct {
// Peer is used to announce node peers
type Peer struct {
// network node
Node *Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"`
// neighbours
Neighbours []*Neighbour `protobuf:"bytes,2,rep,name=neighbours,proto3" json:"neighbours,omitempty"`
Peers []*Peer `protobuf:"bytes,2,rep,name=peers,proto3" json:"peers,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Neighbour) Reset() { *m = Neighbour{} }
func (m *Neighbour) String() string { return proto.CompactTextString(m) }
func (*Neighbour) ProtoMessage() {}
func (*Neighbour) Descriptor() ([]byte, []int) {
func (m *Peer) Reset() { *m = Peer{} }
func (m *Peer) String() string { return proto.CompactTextString(m) }
func (*Peer) ProtoMessage() {}
func (*Peer) Descriptor() ([]byte, []int) {
return fileDescriptor_8571034d60397816, []int{9}
}
func (m *Neighbour) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Neighbour.Unmarshal(m, b)
func (m *Peer) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Peer.Unmarshal(m, b)
}
func (m *Neighbour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Neighbour.Marshal(b, m, deterministic)
func (m *Peer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Peer.Marshal(b, m, deterministic)
}
func (m *Neighbour) XXX_Merge(src proto.Message) {
xxx_messageInfo_Neighbour.Merge(m, src)
func (m *Peer) XXX_Merge(src proto.Message) {
xxx_messageInfo_Peer.Merge(m, src)
}
func (m *Neighbour) XXX_Size() int {
return xxx_messageInfo_Neighbour.Size(m)
func (m *Peer) XXX_Size() int {
return xxx_messageInfo_Peer.Size(m)
}
func (m *Neighbour) XXX_DiscardUnknown() {
xxx_messageInfo_Neighbour.DiscardUnknown(m)
func (m *Peer) XXX_DiscardUnknown() {
xxx_messageInfo_Peer.DiscardUnknown(m)
}
var xxx_messageInfo_Neighbour proto.InternalMessageInfo
var xxx_messageInfo_Peer proto.InternalMessageInfo
func (m *Neighbour) GetNode() *Node {
func (m *Peer) GetNode() *Node {
if m != nil {
return m.Node
}
return nil
}
func (m *Neighbour) GetNeighbours() []*Neighbour {
func (m *Peer) GetPeers() []*Peer {
if m != nil {
return m.Neighbours
return m.Peers
}
return nil
}
@ -446,42 +446,41 @@ func (m *Neighbour) GetNeighbours() []*Neighbour {
func init() {
proto.RegisterType((*ListRequest)(nil), "go.micro.network.ListRequest")
proto.RegisterType((*ListResponse)(nil), "go.micro.network.ListResponse")
proto.RegisterType((*NeighbourhoodRequest)(nil), "go.micro.network.NeighbourhoodRequest")
proto.RegisterType((*NeighbourhoodResponse)(nil), "go.micro.network.NeighbourhoodResponse")
proto.RegisterType((*Neighbourhood)(nil), "go.micro.network.Neighbourhood")
proto.RegisterType((*PeerRequest)(nil), "go.micro.network.PeerRequest")
proto.RegisterType((*PeerResponse)(nil), "go.micro.network.PeerResponse")
proto.RegisterType((*Peers)(nil), "go.micro.network.Peers")
proto.RegisterType((*Node)(nil), "go.micro.network.Node")
proto.RegisterType((*Connect)(nil), "go.micro.network.Connect")
proto.RegisterType((*Close)(nil), "go.micro.network.Close")
proto.RegisterType((*Solicit)(nil), "go.micro.network.Solicit")
proto.RegisterType((*Neighbour)(nil), "go.micro.network.Neighbour")
proto.RegisterType((*Peer)(nil), "go.micro.network.Peer")
}
func init() { proto.RegisterFile("network.proto", fileDescriptor_8571034d60397816) }
var fileDescriptor_8571034d60397816 = []byte{
// 372 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x5d, 0x4f, 0xea, 0x40,
0x10, 0xbd, 0xf4, 0xc2, 0x6d, 0x18, 0x2e, 0xc4, 0x6c, 0xd4, 0x34, 0x18, 0x94, 0xec, 0x03, 0x12,
0xa3, 0xc5, 0x40, 0xf0, 0x45, 0xdf, 0x78, 0xe0, 0x85, 0xf0, 0x80, 0x7f, 0x40, 0xdb, 0x6e, 0xca,
0x46, 0xe8, 0xe0, 0xee, 0x36, 0xfe, 0x01, 0x7f, 0xb8, 0xd9, 0x76, 0xc1, 0x52, 0xbe, 0xd2, 0xb7,
0xee, 0xcc, 0x99, 0x73, 0x66, 0xa6, 0x67, 0xa0, 0x1e, 0x31, 0xf5, 0x85, 0xe2, 0xc3, 0x5d, 0x09,
0x54, 0x48, 0xce, 0x42, 0x74, 0x97, 0xdc, 0x17, 0xe8, 0x9a, 0x78, 0x73, 0x10, 0x72, 0x35, 0x8f,
0x3d, 0xd7, 0xc7, 0x65, 0x2f, 0xc9, 0xf4, 0x42, 0x7c, 0x48, 0x3f, 0x04, 0xc6, 0x8a, 0x89, 0x5e,
0x52, 0x69, 0x1e, 0x29, 0x0d, 0xad, 0x43, 0x6d, 0xc2, 0xa5, 0x9a, 0xb1, 0xcf, 0x98, 0x49, 0x45,
0x5f, 0xe0, 0x7f, 0xfa, 0x94, 0x2b, 0x8c, 0x24, 0x23, 0xf7, 0x50, 0x89, 0x30, 0x60, 0xd2, 0x29,
0xb5, 0xff, 0x76, 0x6b, 0xfd, 0x4b, 0x37, 0xaf, 0xea, 0x4e, 0x31, 0x60, 0xb3, 0x14, 0x44, 0x3b,
0x70, 0x3e, 0x65, 0x3c, 0x9c, 0x7b, 0x18, 0x8b, 0x39, 0x62, 0x60, 0x58, 0x49, 0x03, 0x2c, 0x1e,
0x38, 0xa5, 0x76, 0xa9, 0x5b, 0x9d, 0x59, 0x3c, 0xa0, 0x6f, 0x70, 0x91, 0xc3, 0x19, 0xb9, 0x31,
0x34, 0xa2, 0x6c, 0x82, 0x27, 0x45, 0xb5, 0xfe, 0xcd, 0x1e, 0xdd, 0x2d, 0x82, 0x5c, 0x19, 0x95,
0x50, 0xdf, 0x02, 0x90, 0x3b, 0x28, 0xeb, 0x1e, 0x0d, 0xdf, 0xa1, 0x39, 0x12, 0x0c, 0x79, 0x02,
0xd8, 0xd0, 0x49, 0xc7, 0x3a, 0x3a, 0x79, 0x06, 0x49, 0x1f, 0xa1, 0xac, 0x63, 0xf9, 0x71, 0x89,
0x03, 0xf6, 0x7b, 0x10, 0x08, 0x26, 0x35, 0x99, 0x0e, 0xae, 0x9f, 0x74, 0x08, 0xf6, 0x08, 0xa3,
0x88, 0xf9, 0xaa, 0x48, 0x83, 0x74, 0x00, 0x95, 0xd1, 0x02, 0x25, 0x2b, 0x54, 0x34, 0x04, 0xfb,
0x15, 0x17, 0xdc, 0xe7, 0xc5, 0xb4, 0x14, 0x54, 0x37, 0x9b, 0x2c, 0xb4, 0xc5, 0xe7, 0x3d, 0x5b,
0xbc, 0x3a, 0xf2, 0x1f, 0xb3, 0xab, 0xec, 0x7f, 0x5b, 0x60, 0x4f, 0x53, 0x04, 0x99, 0x40, 0x55,
0x7b, 0x52, 0x53, 0x4b, 0xd2, 0xda, 0x65, 0xc8, 0xf8, 0xb7, 0x79, 0x7d, 0x28, 0x9d, 0x1a, 0x8c,
0xfe, 0x21, 0x5e, 0xde, 0x19, 0x9d, 0x53, 0xde, 0x32, 0xd4, 0xb7, 0x27, 0x71, 0x1b, 0x8d, 0x31,
0x40, 0xa2, 0xaa, 0x0f, 0x4d, 0x12, 0xe7, 0xb7, 0xd0, 0x9c, 0xde, 0x9a, 0xb2, 0xb5, 0x93, 0xd9,
0x6e, 0xd6, 0xfb, 0x97, 0x1c, 0xe9, 0xe0, 0x27, 0x00, 0x00, 0xff, 0xff, 0x63, 0xe7, 0xb4, 0xb0,
0xfc, 0x03, 0x00, 0x00,
// 353 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0x51, 0x4f, 0xc2, 0x30,
0x10, 0xc7, 0x19, 0x32, 0x17, 0x6e, 0x60, 0x4c, 0x1f, 0x74, 0x21, 0x99, 0x21, 0x7d, 0x22, 0x46,
0x86, 0x81, 0xf0, 0xa6, 0x4f, 0x3c, 0xf8, 0x42, 0x88, 0x99, 0x5f, 0x40, 0xd8, 0x2e, 0xd8, 0x08,
0x3b, 0x6c, 0x4b, 0xfc, 0xd6, 0x7e, 0x06, 0xd3, 0x76, 0x44, 0x84, 0xcc, 0x84, 0xc4, 0xb7, 0xde,
0xdd, 0xff, 0x7e, 0x77, 0x6d, 0xef, 0xa0, 0x5d, 0xa0, 0xfe, 0x24, 0xf9, 0x9e, 0x6c, 0x24, 0x69,
0x62, 0x97, 0x4b, 0x4a, 0xd6, 0x22, 0x93, 0x94, 0x94, 0xfe, 0xce, 0x68, 0x29, 0xf4, 0xdb, 0x76,
0x91, 0x64, 0xb4, 0x1e, 0xd8, 0xc8, 0x60, 0x49, 0x7d, 0x77, 0x90, 0xb4, 0xd5, 0x28, 0x07, 0x36,
0xb3, 0x34, 0x1c, 0x86, 0xb7, 0x21, 0x9c, 0x0a, 0xa5, 0x53, 0xfc, 0xd8, 0xa2, 0xd2, 0xfc, 0x01,
0x5a, 0xce, 0x54, 0x1b, 0x2a, 0x14, 0xb2, 0x3b, 0xf0, 0x0b, 0xca, 0x51, 0x45, 0x5e, 0xf7, 0xac,
0x17, 0x0e, 0xaf, 0x92, 0xc3, 0xaa, 0xc9, 0x8c, 0x72, 0x4c, 0x9d, 0x88, 0xc7, 0x10, 0x3e, 0x23,
0xca, 0x12, 0xc6, 0x2e, 0xa0, 0x2e, 0xf2, 0xc8, 0xeb, 0x7a, 0xbd, 0x66, 0x5a, 0x17, 0x39, 0x7f,
0x84, 0x96, 0x0b, 0x97, 0xf0, 0x3e, 0xf8, 0x1b, 0x44, 0xa9, 0xac, 0x24, 0x1c, 0x5e, 0x1f, 0xc3,
0x8d, 0x5c, 0xa5, 0x4e, 0xc5, 0xe7, 0xe0, 0x5b, 0x9b, 0xdd, 0x42, 0xc3, 0xd4, 0x2b, 0xd3, 0xaa,
0x7a, 0xb2, 0x1a, 0x73, 0x01, 0x57, 0xa3, 0xfe, 0xf7, 0x05, 0x5c, 0x89, 0x7b, 0x68, 0x18, 0xf3,
0xb0, 0x73, 0x16, 0x41, 0x30, 0xcf, 0x73, 0x89, 0xca, 0x70, 0x8c, 0x73, 0x67, 0xf2, 0x31, 0x04,
0x13, 0x2a, 0x0a, 0xcc, 0xf4, 0x29, 0x6d, 0xf1, 0x11, 0xf8, 0x93, 0x15, 0x29, 0x3c, 0x29, 0x69,
0x0c, 0xc1, 0x0b, 0xad, 0x44, 0x26, 0x4e, 0xab, 0xf5, 0x0a, 0x0d, 0xf3, 0x6e, 0xff, 0xfc, 0x6c,
0xf6, 0x27, 0x9d, 0x68, 0xf8, 0xe5, 0x41, 0x30, 0x73, 0x7e, 0x36, 0x85, 0xa6, 0x99, 0x20, 0xc3,
0x52, 0x2c, 0x3e, 0xce, 0xdb, 0x9b, 0xb6, 0xce, 0x4d, 0x55, 0xd8, 0x0d, 0x08, 0xaf, 0xed, 0x68,
0xee, 0xdf, 0xe3, 0x8a, 0x2e, 0xaa, 0x69, 0xfb, 0xe3, 0xc6, 0x6b, 0xec, 0x09, 0xc0, 0xf2, 0xcd,
0x02, 0x28, 0x16, 0xfd, 0xe8, 0xcb, 0x95, 0xd8, 0x91, 0xe2, 0xa3, 0xc8, 0xef, 0xb6, 0x16, 0xe7,
0x76, 0x79, 0x46, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xaf, 0xb8, 0x9b, 0x3f, 0x94, 0x03, 0x00,
0x00,
}

View File

@ -7,7 +7,7 @@ import "github.com/micro/go-micro/router/proto/router.proto";
// Network service is usesd to gain visibility into networks
service Network {
rpc ListNodes(ListRequest) returns (ListResponse) {};
rpc Neighbourhood(NeighbourhoodRequest) returns (NeighbourhoodResponse) {};
rpc ListPeers(PeerRequest) returns (PeerResponse) {};
rpc ListRoutes(go.micro.router.Request) returns (go.micro.router.ListResponse) {};
}
@ -19,19 +19,19 @@ message ListResponse {
repeated Node nodes = 1;
}
// NeighbourhoodRequest is sent to query node neighbourhood
message NeighbourhoodRequest {
// PeerRequest is sent to query node peers
message PeerRequest {
string id = 1;
}
// NeighbourhoodResponse returns node neighbourhood
message NeighbourhoodResponse {
Neighbourhood neighbourhoodi = 1;
// PeerResponse returns node neighbourhood
message PeerResponse {
Peers peers = 1;
}
message Neighbourhood {
message Peers {
Node node = 1;
repeated Node neighbours = 2;
repeated Node peers = 2;
}
// Node is network node
@ -60,10 +60,10 @@ message Solicit {
Node node = 1;
}
// Neighbour is used to nnounce node neighbourhood
message Neighbour {
// Peer is used to announce node peers
message Peer {
// network node
Node node = 1;
// neighbours
repeated Neighbour neighbours = 2;
repeated Peer peers = 2;
}