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