mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-04-16 22:13:14 -04:00
adds get_node_id for api
This commit is contained in:
parent
e9fe5928dc
commit
a4777fc551
@ -192,6 +192,20 @@ pub async fn test_attach_detach_multiple() {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn test_get_node_id() {
|
||||
trace!("test get node id");
|
||||
let (update_callback, config_callback) = setup_veilid_core();
|
||||
let api = api_startup(update_callback, config_callback)
|
||||
.await
|
||||
.expect("startup failed");
|
||||
api.attach().await.unwrap();
|
||||
sleep(5000).await;
|
||||
assert_eq!(api.get_node_id().unwrap(), api.config().unwrap().get().network.routing_table.node_id);
|
||||
api.detach().await.unwrap();
|
||||
sleep(2000).await;
|
||||
api.shutdown().await;
|
||||
}
|
||||
|
||||
pub async fn test_all() {
|
||||
test_startup_shutdown().await;
|
||||
test_startup_shutdown_from_config().await;
|
||||
@ -199,4 +213,5 @@ pub async fn test_all() {
|
||||
test_startup_shutdown_multiple().await;
|
||||
test_startup_shutdown_from_config_multiple().await;
|
||||
test_attach_detach_multiple().await;
|
||||
test_get_node_id().await;
|
||||
}
|
||||
|
@ -136,6 +136,10 @@ impl VeilidAPI {
|
||||
.ok_or(VeilidAPIError::NotInitialized)
|
||||
}
|
||||
|
||||
pub fn get_node_id(&self) -> VeilidAPIResult<CryptoTypedGroup<CryptoKey>> {
|
||||
Ok(self.config()?.get().network.routing_table.node_id.clone())
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Internal Accessors
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user