From 2052577174f77568bd4030b092401fda0169ff78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Fri, 8 Dec 2023 08:57:28 +0100 Subject: [PATCH 1/3] Add ip-packet-router info to node details printout in gateway --- common/types/src/gateway.rs | 13 +++++++++---- gateway/src/node/helpers.rs | 39 ++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/common/types/src/gateway.rs b/common/types/src/gateway.rs index 750871e881..80194218b1 100644 --- a/common/types/src/gateway.rs +++ b/common/types/src/gateway.rs @@ -77,7 +77,7 @@ impl GatewayBond { } } -#[derive(Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] pub struct GatewayNodeDetailsResponse { pub identity_key: String, pub sphinx_key: String, @@ -88,6 +88,7 @@ pub struct GatewayNodeDetailsResponse { pub data_store: String, pub network_requester: Option, + pub ip_packet_router: Option, } impl fmt::Display for GatewayNodeDetailsResponse { @@ -107,11 +108,15 @@ impl fmt::Display for GatewayNodeDetailsResponse { if let Some(nr) = &self.network_requester { nr.fmt(f)?; } + + if let Some(ipr) = &self.ip_packet_router { + ipr.fmt(f)?; + } Ok(()) } } -#[derive(Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] pub struct GatewayNetworkRequesterDetails { pub enabled: bool, @@ -149,7 +154,7 @@ impl fmt::Display for GatewayNetworkRequesterDetails { } } -#[derive(Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] pub struct GatewayIpPacketRouterDetails { pub enabled: bool, @@ -164,7 +169,7 @@ pub struct GatewayIpPacketRouterDetails { impl fmt::Display for GatewayIpPacketRouterDetails { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - writeln!(f, "IP packet router:")?; + writeln!(f, "ip packet router:")?; writeln!(f, "\tenabled: {}", self.enabled)?; writeln!(f, "\tconfig path: {}", self.config_path)?; diff --git a/gateway/src/node/helpers.rs b/gateway/src/node/helpers.rs index abeb50d009..65c6376cd1 100644 --- a/gateway/src/node/helpers.rs +++ b/gateway/src/node/helpers.rs @@ -8,7 +8,9 @@ use nym_crypto::asymmetric::{encryption, identity}; use nym_pemstore::traits::{PemStorableKey, PemStorableKeyPair}; use nym_pemstore::KeyPairPath; use nym_sphinx::addressing::clients::Recipient; -use nym_types::gateway::{GatewayNetworkRequesterDetails, GatewayNodeDetailsResponse}; +use nym_types::gateway::{ + GatewayIpPacketRouterDetails, GatewayNetworkRequesterDetails, GatewayNodeDetailsResponse, +}; use std::path::Path; fn display_maybe_path>(path: Option

) -> String { @@ -71,6 +73,40 @@ pub(crate) fn node_details(config: &Config) -> Result Result Date: Fri, 8 Dec 2023 09:00:21 +0100 Subject: [PATCH 2/3] rustfmt --- gateway/src/node/helpers.rs | 58 ++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/gateway/src/node/helpers.rs b/gateway/src/node/helpers.rs index 65c6376cd1..b6765cc7bb 100644 --- a/gateway/src/node/helpers.rs +++ b/gateway/src/node/helpers.rs @@ -73,39 +73,39 @@ pub(crate) fn node_details(config: &Config) -> Result Date: Fri, 8 Dec 2023 09:10:33 +0100 Subject: [PATCH 3/3] capitalization --- common/types/src/gateway.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/types/src/gateway.rs b/common/types/src/gateway.rs index 80194218b1..90d012a5ff 100644 --- a/common/types/src/gateway.rs +++ b/common/types/src/gateway.rs @@ -99,7 +99,7 @@ impl fmt::Display for GatewayNodeDetailsResponse { writeln!(f, "bind address: {}", self.bind_address)?; writeln!( f, - "mix Port: {}, clients port: {}", + "mix port: {}, clients port: {}", self.mix_port, self.clients_port )?;