From a46245ffe3f788f752aa0bd8c5aefb63bfe57ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Thu, 9 Jan 2025 10:02:52 +0100 Subject: [PATCH] feat: warn users if node is run in exit mode only (#5320) * added 'full-gateway' nymnode mode to enable both entry and exit at the same time * warning for running node in exit mode only --- nym-node/src/cli/commands/run/mod.rs | 4 ++++ nym-node/src/config/mod.rs | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/nym-node/src/cli/commands/run/mod.rs b/nym-node/src/cli/commands/run/mod.rs index bcaa1e5106..9dfd1061f0 100644 --- a/nym-node/src/cli/commands/run/mod.rs +++ b/nym-node/src/cli/commands/run/mod.rs @@ -83,6 +83,10 @@ pub(crate) async fn execute(mut args: Args) -> Result<(), NymNodeError> { warn!("this node is going to run without mixnode or gateway support! consider providing `mode` value"); } + if config.modes.standalone_exit() { + warn!("this node is going to run in EXIT gateway mode only - it will not be able to accept client traffic and thus will NOT be eligible for any rewards. consider running it alongside `entry` (or `full-gateway`) mode") + } + if config.host.public_ips.is_empty() { return Err(NymNodeError::NoPublicIps); } diff --git a/nym-node/src/config/mod.rs b/nym-node/src/config/mod.rs index 8f0cb9f220..c9d614e6b1 100644 --- a/nym-node/src/config/mod.rs +++ b/nym-node/src/config/mod.rs @@ -77,6 +77,9 @@ pub enum NodeMode { #[clap(alias = "exit")] ExitGateway, + + // entry + exit + FullGateway, } impl Display for NodeMode { @@ -85,6 +88,7 @@ impl Display for NodeMode { NodeMode::Mixnode => "mixnode".fmt(f), NodeMode::EntryGateway => "entry-gateway".fmt(f), NodeMode::ExitGateway => "exit-gateway".fmt(f), + NodeMode::FullGateway => "full-gateway".fmt(f), } } } @@ -117,11 +121,16 @@ impl NodeModes { self.mixnode || self.entry || self.exit } + pub fn standalone_exit(&self) -> bool { + !self.mixnode && !self.entry && self.exit + } + pub fn with_mode(&mut self, mode: NodeMode) -> &mut Self { match mode { NodeMode::Mixnode => self.with_mixnode(), NodeMode::EntryGateway => self.with_entry(), NodeMode::ExitGateway => self.with_exit(), + NodeMode::FullGateway => self.with_entry().with_exit(), } }