2019-08-28 22:11:19 +03:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package go.micro.network;
|
|
|
|
|
2019-08-30 14:29:26 +03:00
|
|
|
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) {};
|
2019-09-10 03:14:23 +03:00
|
|
|
rpc ListPeers(PeerRequest) returns (PeerResponse) {};
|
2019-09-09 20:47:10 +03:00
|
|
|
rpc ListRoutes(go.micro.router.Request) returns (go.micro.router.ListResponse) {};
|
2019-08-30 14:29:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Empty request
|
|
|
|
message ListRequest {}
|
|
|
|
|
|
|
|
// ListResponse is returned by ListNodes and ListNeighbours
|
|
|
|
message ListResponse {
|
|
|
|
repeated Node nodes = 1;
|
|
|
|
}
|
|
|
|
|
2019-09-10 03:14:23 +03:00
|
|
|
// PeerRequest is sent to query node peers
|
|
|
|
message PeerRequest {
|
2019-09-02 13:42:45 +03:00
|
|
|
string id = 1;
|
|
|
|
}
|
|
|
|
|
2019-09-10 03:14:23 +03:00
|
|
|
// PeerResponse returns node neighbourhood
|
|
|
|
message PeerResponse {
|
|
|
|
Peers peers = 1;
|
2019-09-09 20:47:10 +03:00
|
|
|
}
|
|
|
|
|
2019-09-10 03:14:23 +03:00
|
|
|
message Peers {
|
2019-09-09 20:47:10 +03:00
|
|
|
Node node = 1;
|
2019-09-10 03:14:23 +03:00
|
|
|
repeated Node peers = 2;
|
2019-09-02 13:42:45 +03:00
|
|
|
}
|
|
|
|
|
2019-08-28 22:11:19 +03:00
|
|
|
// Node is network node
|
|
|
|
message Node {
|
|
|
|
// node ide
|
|
|
|
string id = 1;
|
|
|
|
// node address
|
|
|
|
string address = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Connect is sent when the node connects to the network
|
|
|
|
message Connect {
|
|
|
|
// network mode
|
|
|
|
Node node = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close is sent when the node disconnects from the network
|
|
|
|
message Close {
|
2019-09-02 13:42:45 +03:00
|
|
|
// network node
|
2019-08-28 22:11:19 +03:00
|
|
|
Node node = 1;
|
|
|
|
}
|
|
|
|
|
2019-09-05 18:04:44 +03:00
|
|
|
// Solicit is sent when requesting route advertisement from the network nodes
|
|
|
|
message Solicit {
|
|
|
|
// network node
|
|
|
|
Node node = 1;
|
|
|
|
}
|
|
|
|
|
2019-09-10 03:14:23 +03:00
|
|
|
// Peer is used to announce node peers
|
|
|
|
message Peer {
|
2019-09-02 13:42:45 +03:00
|
|
|
// network node
|
2019-08-28 22:11:19 +03:00
|
|
|
Node node = 1;
|
|
|
|
// neighbours
|
2019-09-10 03:14:23 +03:00
|
|
|
repeated Peer peers = 2;
|
2019-08-28 22:11:19 +03:00
|
|
|
}
|