github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/proto/network/network.proto (about)

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