Networking
Peer / network management. Every RPC returns NOT_FOUND if the node was started without networking.
Peer / network management. Every RPC returns NOT_FOUND if the node was started without networking.
The names ListDht, WatchDht and AddPeer (with their request/response
messages) are retired from this service and MUST NOT be reused. Cluster
membership is etcd TTL leases and the indexer derives bucket ownership from
the member list by HRW, so provider discovery is an internal daemon detail
with no public API. A node joins by taking out its own etcd lease under the
cluster prefix — something only that node can do — so introducing a node to
the cluster is a config action (networking.etcd.endpoints +
networking.internal_grpc.advertise), not an RPC.
Service builder.Networking, 5 rpcs.
GetNetInfo(GetNetInfoRequest) -> GetNetInfoResponse
Return this node's peer ID and all current listen addresses.
Request: GetNetInfoRequest
message GetNetInfoRequest {
// no fields
}Response: GetNetInfoResponse
message GetNetInfoResponse {
optional string peer_id = 1;
repeated string listen_addrs = 2;
repeated string external_addrs = 3;
optional uint32 connected_peers = 4;
optional bool bootstrapped = 6;
}| Field | |
|---|---|
peer_id | This node's peer ID (base-58 multihash of its Ed25519 identity key). |
listen_addrs | All active listen addresses, including the /p2p/<id> suffix. |
external_addrs | Addresses confirmed by the identify protocol (what peers can reach us on), including the /p2p/<id> suffix. |
connected_peers | Number of currently connected peers. |
bootstrapped | True if a network bootstrap has been successfully initiated at least once. |
ListPeers(ListPeersRequest) -> ListPeersResponse
Return the IDs of all currently connected peers.
Request: ListPeersRequest
message ListPeersRequest {
// no fields
}Response: ListPeersResponse
message ListPeersResponse {
repeated ConnectedPeer peers = 1;
}WatchPeers(WatchPeersRequest) -> stream WatchPeersEvent
Stream peer-connection events: an initial KIND_CONNECTED snapshot, then live connect/disconnect events until the client cancels.
Request: WatchPeersRequest
message WatchPeersRequest {
// no fields
}Response: WatchPeersEvent
message WatchPeersEvent {
optional Kind kind = 1;
optional string peer_id = 2;
}GetPeer(GetPeerRequest) -> GetPeerResponse
Detail for a single peer by id (addresses + whether it is connected now).
Request: GetPeerRequest
message GetPeerRequest {
optional string peer_id = 1;
}Response: GetPeerResponse
message GetPeerResponse {
optional ConnectedPeer peer = 1;
optional bool connected = 2;
}| Field | |
|---|---|
peer | The peer's id + known addresses. |
connected | Whether the node currently has an open connection to it. |
WatchPeer(WatchPeerRequest) -> stream WatchPeersEvent
Stream one peer's connect/disconnect events (a leading snapshot of its current state, then live changes).
Request: WatchPeerRequest
message WatchPeerRequest {
optional string peer_id = 1;
}Response: WatchPeersEvent
The same message as WatchPeersEvent.
Types used above
ConnectedPeer
message ConnectedPeer {
optional string peer_id = 1;
repeated string addrs = 2;
oneof _rtt_micros {
uint64 rtt_micros = 3;
}
}| Field | |
|---|---|
peer_id | |
addrs | The "host:port" internal-gRPC endpoints this peer advertised in its cluster member record — where it is actually dialed. |
rtt_micros | Latest round-trip time to this peer, in microseconds, as measured by the internal Ping prober. Absent until a probe has succeeded, and again once the peer stops answering — a stale number is worse than none. |
Kind
enum Kind {
KIND_UNSPECIFIED = 0;
KIND_CONNECTED = 1;
KIND_DISCONNECTED = 2;
}| Value | |
|---|---|
KIND_UNSPECIFIED | Default / unset — never emitted by the server. |
KIND_CONNECTED | A peer has connected (or was already connected at subscription time). |
KIND_DISCONNECTED | All connections to a peer have been closed. |