github.com/annwntech/go-micro/v2@v2.9.5/network/service/proto/network.proto (about)

     1  syntax = "proto3";
     2  
     3  package go.micro.network;
     4  
     5  import "router/service/proto/router.proto";
     6  
     7  // Network service is usesd to gain visibility into networks
     8  service Network {
     9          // Connect to the network
    10          rpc Connect(ConnectRequest) returns (ConnectResponse) {};
    11          // Returns the entire network graph
    12          rpc Graph(GraphRequest) returns (GraphResponse) {};
    13          // Returns a list of known nodes in the network
    14          rpc Nodes(NodesRequest) returns (NodesResponse) {};
    15          // Returns a list of known routes in the network
    16          rpc Routes(RoutesRequest) returns (RoutesResponse) {};
    17          // Returns a list of known services based on routes
    18          rpc Services(ServicesRequest) returns (ServicesResponse) {};
    19          // Status returns network status
    20          rpc Status(StatusRequest) returns (StatusResponse) {};
    21  }
    22  
    23  // Query is passed in a LookupRequest
    24  message Query {
    25  	string service = 1;
    26  	string address = 2;
    27  	string gateway = 3;
    28  	string router = 4;
    29  	string network = 5;
    30  }
    31  
    32  message ConnectRequest {
    33  	repeated Node nodes = 1;
    34  }
    35  
    36  message ConnectResponse {}
    37  
    38  // PeerRequest requests list of peers
    39  message NodesRequest {
    40          // node topology depth
    41          uint32 depth = 1;
    42  }
    43  
    44  // PeerResponse is returned by ListPeers
    45  message NodesResponse {
    46          // return peer topology
    47          repeated Node nodes = 1;
    48  }
    49  
    50  message GraphRequest {
    51          // node topology depth
    52          uint32 depth = 1;
    53  }
    54  
    55  message GraphResponse {
    56  	Peer root = 1;
    57  }
    58  
    59  message RoutesRequest {
    60  	// filter based on
    61  	Query query = 1;
    62  }
    63  
    64  message RoutesResponse {
    65  	repeated go.micro.router.Route routes = 1;
    66  }
    67  
    68  message ServicesRequest {}
    69  
    70  message ServicesResponse {
    71  	repeated string services = 1;
    72  }
    73  
    74  message StatusRequest {}
    75  
    76  message StatusResponse {
    77          Status status = 1;
    78  }
    79  
    80  // Error tracks network errors
    81  message Error {
    82          uint32 count = 1;
    83          string msg = 2;
    84  }
    85  
    86  // Status is node status
    87  message Status {
    88          Error error = 1;
    89  }
    90  
    91  // Node is network node
    92  message Node {
    93          // node id
    94          string id = 1;
    95          // node address
    96          string address = 2;
    97          // the network
    98          string network = 3;
    99          // associated metadata
   100          map<string,string> metadata = 4;
   101          // node status
   102          Status status = 5;
   103  }
   104  
   105  // Connect is sent when the node connects to the network
   106  message Connect {
   107          // network mode
   108          Node node = 1;
   109  }
   110  
   111  // Close is sent when the node disconnects from the network
   112  message Close {
   113          // network node
   114          Node node = 1;
   115  }
   116  
   117  // Peer is used to advertise node peers
   118  message Peer {
   119          // network node
   120          Node node = 1;
   121          // node peers
   122          repeated Peer peers = 2;
   123  }
   124  
   125  // Sync is network sync message
   126  message Sync {
   127          // peer origin
   128          Peer peer = 1;
   129          // node routes
   130          repeated go.micro.router.Route routes = 2;
   131  }