2019-08-28 22:11:19 +03:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package go.micro.network;
|
|
|
|
|
2020-03-30 23:58:32 +03:00
|
|
|
import "router/service/proto/router.proto";
|
2019-08-30 14:29:26 +03:00
|
|
|
|
|
|
|
// Network service is usesd to gain visibility into networks
|
|
|
|
service Network {
|
2020-01-14 21:48:42 +03:00
|
|
|
// Connect to the network
|
|
|
|
rpc Connect(ConnectRequest) returns (ConnectResponse) {};
|
|
|
|
// Returns the entire network graph
|
|
|
|
rpc Graph(GraphRequest) returns (GraphResponse) {};
|
|
|
|
// Returns a list of known nodes in the network
|
2019-09-23 17:41:05 +03:00
|
|
|
rpc Nodes(NodesRequest) returns (NodesResponse) {};
|
2020-01-14 21:48:42 +03:00
|
|
|
// Returns a list of known routes in the network
|
2019-09-23 17:41:05 +03:00
|
|
|
rpc Routes(RoutesRequest) returns (RoutesResponse) {};
|
2020-01-14 21:48:42 +03:00
|
|
|
// Returns a list of known services based on routes
|
|
|
|
rpc Services(ServicesRequest) returns (ServicesResponse) {};
|
2020-01-14 21:12:36 +03:00
|
|
|
// Status returns network status
|
|
|
|
rpc Status(StatusRequest) returns (StatusResponse) {};
|
2019-08-30 14:29:26 +03:00
|
|
|
}
|
|
|
|
|
2019-10-09 19:13:52 +03:00
|
|
|
// Query is passed in a LookupRequest
|
|
|
|
message Query {
|
|
|
|
string service = 1;
|
|
|
|
string address = 2;
|
|
|
|
string gateway = 3;
|
|
|
|
string router = 4;
|
|
|
|
string network = 5;
|
|
|
|
}
|
|
|
|
|
2019-10-13 14:37:39 +03:00
|
|
|
message ConnectRequest {
|
|
|
|
repeated Node nodes = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ConnectResponse {}
|
|
|
|
|
2019-09-10 15:31:02 +03:00
|
|
|
// PeerRequest requests list of peers
|
2019-09-23 17:41:05 +03:00
|
|
|
message NodesRequest {
|
2019-09-12 01:03:27 +03:00
|
|
|
// node topology depth
|
|
|
|
uint32 depth = 1;
|
2019-09-02 13:42:45 +03:00
|
|
|
}
|
|
|
|
|
2019-09-10 15:31:02 +03:00
|
|
|
// PeerResponse is returned by ListPeers
|
2019-09-23 17:41:05 +03:00
|
|
|
message NodesResponse {
|
2019-09-12 01:03:27 +03:00
|
|
|
// return peer topology
|
2019-09-23 17:41:05 +03:00
|
|
|
repeated Node nodes = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message GraphRequest {
|
|
|
|
// node topology depth
|
|
|
|
uint32 depth = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message GraphResponse {
|
|
|
|
Peer root = 1;
|
|
|
|
}
|
|
|
|
|
2020-01-09 20:49:06 +03:00
|
|
|
message RoutesRequest {
|
2019-10-09 19:13:52 +03:00
|
|
|
// filter based on
|
|
|
|
Query query = 1;
|
2019-09-23 17:41:05 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
message RoutesResponse {
|
|
|
|
repeated go.micro.router.Route routes = 1;
|
2019-09-02 13:42:45 +03:00
|
|
|
}
|
|
|
|
|
2019-09-30 09:51:13 +03:00
|
|
|
message ServicesRequest {}
|
|
|
|
|
|
|
|
message ServicesResponse {
|
|
|
|
repeated string services = 1;
|
|
|
|
}
|
|
|
|
|
2020-01-14 21:12:36 +03:00
|
|
|
message StatusRequest {}
|
|
|
|
|
|
|
|
message StatusResponse {
|
|
|
|
Status status = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Error tracks network errors
|
|
|
|
message Error {
|
|
|
|
uint32 count = 1;
|
|
|
|
string msg = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Status is node status
|
|
|
|
message Status {
|
|
|
|
Error error = 1;
|
|
|
|
}
|
|
|
|
|
2019-08-28 22:11:19 +03:00
|
|
|
// Node is network node
|
|
|
|
message Node {
|
2019-09-10 15:31:02 +03:00
|
|
|
// node id
|
2019-08-28 22:11:19 +03:00
|
|
|
string id = 1;
|
|
|
|
// node address
|
|
|
|
string address = 2;
|
2019-10-13 14:40:53 +03:00
|
|
|
// the network
|
|
|
|
string network = 3;
|
|
|
|
// associated metadata
|
|
|
|
map<string,string> metadata = 4;
|
2020-01-14 21:12:36 +03:00
|
|
|
// node status
|
|
|
|
Status status = 5;
|
2019-08-28 22:11:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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-10 15:31:02 +03:00
|
|
|
// Peer is used to advertise node peers
|
2019-09-10 03:14:23 +03:00
|
|
|
message Peer {
|
2019-09-02 13:42:45 +03:00
|
|
|
// network node
|
2019-08-28 22:11:19 +03:00
|
|
|
Node node = 1;
|
2019-09-10 15:31:02 +03:00
|
|
|
// node peers
|
2019-09-10 03:14:23 +03:00
|
|
|
repeated Peer peers = 2;
|
2019-08-28 22:11:19 +03:00
|
|
|
}
|
2020-01-09 20:49:06 +03:00
|
|
|
|
|
|
|
// Sync is network sync message
|
|
|
|
message Sync {
|
2020-01-10 14:57:34 +03:00
|
|
|
// peer origin
|
|
|
|
Peer peer = 1;
|
2020-01-09 20:49:06 +03:00
|
|
|
// node routes
|
2020-01-10 14:57:34 +03:00
|
|
|
repeated go.micro.router.Route routes = 2;
|
2020-01-09 20:49:06 +03:00
|
|
|
}
|