Add to nym-api node-describe-cache

This commit is contained in:
Jon Häggblad
2023-12-07 23:57:17 +01:00
parent 91fed4d994
commit d922e35860
2 changed files with 21 additions and 1 deletions
+9
View File
@@ -366,6 +366,9 @@ pub struct NymNodeDescription {
#[serde(default)]
pub network_requester: Option<NetworkRequesterDetails>,
#[serde(default)]
pub ip_packet_router: Option<IpPacketRouterDetails>,
// for now we only care about their ws/wss situation, nothing more
pub mixnet_websockets: WebSockets,
}
@@ -393,3 +396,9 @@ pub struct NetworkRequesterDetails {
/// flag indicating whether this network requester uses the exit policy rather than the deprecated allow list
pub uses_exit_policy: bool,
}
#[derive(Clone, Debug, Serialize, Deserialize, schemars::JsonSchema)]
pub struct IpPacketRouterDetails {
/// address of the embedded ip packet router
pub address: String,
}
+12 -1
View File
@@ -7,7 +7,9 @@ use crate::support::caching::refresher::{CacheItemProvider, CacheRefresher};
use crate::support::config;
use crate::support::config::DEFAULT_NODE_DESCRIBE_BATCH_SIZE;
use futures_util::{stream, StreamExt};
use nym_api_requests::models::{NetworkRequesterDetails, NymNodeDescription};
use nym_api_requests::models::{
IpPacketRouterDetails, NetworkRequesterDetails, NymNodeDescription,
};
use nym_config::defaults::{mainnet, DEFAULT_NYM_NODE_HTTP_PORT};
use nym_contracts_common::IdentityKey;
use nym_mixnet_contract_common::Gateway;
@@ -170,10 +172,19 @@ async fn get_gateway_description(
None
};
let ip_packet_router = if let Ok(ipr) = client.get_ip_packet_router().await {
Some(IpPacketRouterDetails {
address: ipr.address,
})
} else {
None
};
let description = NymNodeDescription {
host_information: host_info.data,
build_information: build_info,
network_requester,
ip_packet_router,
mixnet_websockets: websockets,
};