add command to show local node info (#271)

This commit is contained in:
Sijie.Sun
2024-08-23 11:50:11 +08:00
committed by GitHub
parent b7d85ad2ff
commit 833e7eca22
4 changed files with 113 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ use std::sync::Arc;
use crate::rpc::{
cli::PeerInfo, peer_manage_rpc_server::PeerManageRpc, DumpRouteRequest, DumpRouteResponse,
ListForeignNetworkRequest, ListForeignNetworkResponse, ListPeerRequest, ListPeerResponse,
ListRouteRequest, ListRouteResponse,
ListRouteRequest, ListRouteResponse, ShowNodeInfoRequest, ShowNodeInfoResponse,
};
use tonic::{Request, Response, Status};
@@ -81,4 +81,13 @@ impl PeerManageRpc for PeerManagerRpcService {
.await;
Ok(Response::new(reply))
}
async fn show_node_info(
&self,
_request: Request<ShowNodeInfoRequest>, // Accept request of type HelloRequest
) -> Result<Response<ShowNodeInfoResponse>, Status> {
Ok(Response::new(ShowNodeInfoResponse {
node_info: Some(self.peer_manager.get_my_info()),
}))
}
}