ns-api: add descriptions to dVPN gateway responses (#6102)

* ns-api: add descriptions to dVPN gateway responses

* clippy

* fmt

---------

Co-authored-by: Mark Sinclair <mmsinclair@users.noreply.github.com>
This commit is contained in:
Mark Sinclair
2025-10-10 15:40:18 +01:00
committed by benedettadavico
parent 22c36f5d6a
commit 591126375d
3 changed files with 6 additions and 5 deletions
Generated
+1 -1
View File
@@ -6598,7 +6598,7 @@ dependencies = [
[[package]]
name = "nym-node-status-api"
version = "4.0.8"
version = "4.0.9"
dependencies = [
"ammonia",
"anyhow",
@@ -3,7 +3,7 @@
[package]
name = "nym-node-status-api"
version = "4.0.8"
version = "4.0.9"
authors.workspace = true
repository.workspace = true
homepage.workspace = true
@@ -99,6 +99,7 @@ pub struct DVpnGatewayPerformance {
pub struct DVpnGateway {
pub identity_key: String,
pub name: String,
pub description: Option<String>,
pub ip_packet_router: Option<IpPacketRouterDetails>,
pub authenticator: Option<AuthenticatorDetails>,
pub location: Location,
@@ -326,6 +327,7 @@ impl DVpnGateway {
Ok(Self {
identity_key: gateway.gateway_identity_key,
name: gateway.description.moniker,
description: Some(gateway.description.details),
ip_packet_router: self_described.ip_packet_router,
authenticator: self_described.authenticator,
location: Location {
@@ -401,9 +403,8 @@ fn calculate_score(gateway: &Gateway, probe_outcome: &LastProbeResult) -> ScoreV
/ 1000f64;
// get the file size downloaded in bytes and convert to MB, or default to 1MB
let file_size_mb = p.downloaded_file_size_bytes_v4.unwrap_or_else(|| 1048576) as f64
/ 1024f64
/ 1024f64;
let file_size_mb =
p.downloaded_file_size_bytes_v4.unwrap_or(1048576) as f64 / 1024f64 / 1024f64;
let speed_mbps = file_size_mb / duration_sec;
let file_download_score = if speed_mbps > 5.0 {