gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/network/proto/network.proto (about)

     1  syntax = "proto3";
     2  
     3  package go.micro.network;
     4  
     5  import "gitee.com/liuxuezhan/go-micro-v1.18.0/router/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  }
    20  
    21  // Query is passed in a LookupRequest
    22  message Query {
    23  	string service = 1;
    24  	string address = 2;
    25  	string gateway = 3;
    26  	string router = 4;
    27  	string network = 5;
    28  }
    29  
    30  message ConnectRequest {
    31  	repeated Node nodes = 1;
    32  }
    33  
    34  message ConnectResponse {}
    35  
    36  // PeerRequest requests list of peers
    37  message NodesRequest {
    38          // node topology depth
    39          uint32 depth = 1;
    40  }
    41  
    42  // PeerResponse is returned by ListPeers
    43  message NodesResponse {
    44          // return peer topology
    45          repeated Node nodes = 1;
    46  }
    47  
    48  message GraphRequest {
    49          // node topology depth
    50          uint32 depth = 1;
    51  }
    52  
    53  message GraphResponse {
    54  	Peer root = 1;
    55  }
    56  
    57  message RoutesRequest {	
    58  	// filter based on
    59  	Query query = 1;
    60  }
    61  
    62  message RoutesResponse {
    63  	repeated go.micro.router.Route routes = 1;
    64  }
    65  
    66  message ServicesRequest {}
    67  
    68  message ServicesResponse {
    69  	repeated string services = 1;
    70  }
    71  
    72  // Node is network node
    73  message Node {
    74          // node id
    75          string id = 1;
    76          // node address
    77          string address = 2;
    78          // the network
    79          string network = 3;
    80          // associated metadata
    81          map<string,string> metadata = 4;
    82  }
    83  
    84  // Connect is sent when the node connects to the network
    85  message Connect {
    86          // network mode
    87          Node node = 1;
    88  }
    89  
    90  // Close is sent when the node disconnects from the network
    91  message Close {
    92          // network node
    93          Node node = 1;
    94  }
    95  
    96  // Peer is used to advertise node peers
    97  message Peer {
    98          // network node
    99          Node node = 1;
   100          // node peers
   101          repeated Peer peers = 2;
   102  }