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
This commit is contained in:
Jędrzej Stuczyński
2025-01-09 10:02:52 +01:00
committed by GitHub
parent 7c1c13e139
commit a46245ffe3
2 changed files with 13 additions and 0 deletions
+4
View File
@@ -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);
}
+9
View File
@@ -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(),
}
}