From 00ca4d2afa3d1e1109bf5af912cf6d3ecfb8e6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Tue, 31 Oct 2023 10:13:10 +0100 Subject: [PATCH] Rename to nym-ip-packet-router --- Cargo.lock | 4 +-- gateway/Cargo.toml | 2 +- gateway/src/commands/helpers.rs | 28 +++++++-------- gateway/src/commands/init.rs | 14 ++++---- gateway/src/commands/mod.rs | 6 ++-- gateway/src/commands/run.rs | 6 ++-- ...forwarder.rs => setup_ip_packet_router.rs} | 12 +++---- gateway/src/config/mod.rs | 16 ++++----- gateway/src/config/old_config_v1_1_31.rs | 4 +-- gateway/src/config/persistence/paths.rs | 26 +++++++------- gateway/src/config/template.rs | 6 ++-- gateway/src/error.rs | 2 +- .../embedded_network_requester/mod.rs | 2 +- gateway/src/node/helpers.rs | 6 ++-- gateway/src/node/mod.rs | 34 +++++++++---------- service-providers/ip-forwarder/Cargo.toml | 2 +- 16 files changed, 85 insertions(+), 85 deletions(-) rename gateway/src/commands/{setup_ip_forwarder.rs => setup_ip_packet_router.rs} (79%) diff --git a/Cargo.lock b/Cargo.lock index 938ab2606d..e7f8983425 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6540,7 +6540,7 @@ dependencies = [ "nym-credentials", "nym-crypto", "nym-gateway-requests", - "nym-ip-forwarder", + "nym-ip-packet-router", "nym-mixnet-client", "nym-mixnode-common", "nym-network-defaults", @@ -6645,7 +6645,7 @@ dependencies = [ ] [[package]] -name = "nym-ip-forwarder" +name = "nym-ip-packet-router" version = "0.1.0" dependencies = [ "futures", diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index b5881ef080..aa595f0584 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -76,7 +76,7 @@ nym-task = { path = "../common/task" } nym-types = { path = "../common/types" } nym-validator-client = { path = "../common/client-libs/validator-client" } nym-wireguard = { path = "../common/wireguard", optional = true } -nym-ip-forwarder = { path = "../service-providers/ip-forwarder" } +nym-ip-packet-router = { path = "../service-providers/ip-forwarder" } [dev-dependencies] tower = "0.4.13" diff --git a/gateway/src/commands/helpers.rs b/gateway/src/commands/helpers.rs index 56c9d74292..99289b8b16 100644 --- a/gateway/src/commands/helpers.rs +++ b/gateway/src/commands/helpers.rs @@ -4,7 +4,7 @@ use crate::commands::upgrade_helpers; use crate::config::default_config_filepath; use crate::config::persistence::paths::{ - default_ip_forwarder_data_dir, default_network_requester_data_dir, + default_ip_packet_router_data_dir, default_network_requester_data_dir, }; use crate::config::Config; use crate::error::GatewayError; @@ -41,7 +41,7 @@ pub(crate) struct OverrideConfig { pub(crate) nyxd_urls: Option>, pub(crate) only_coconut_credentials: Option, pub(crate) with_network_requester: Option, - pub(crate) with_ip_forwarder: Option, + pub(crate) with_ip_packet_router: Option, } impl OverrideConfig { @@ -80,15 +80,15 @@ impl OverrideConfig { Config::with_enabled_network_requester, self.with_network_requester, ) - .with_optional(Config::with_enabled_ip_forwarder, self.with_ip_forwarder); + .with_optional(Config::with_enabled_ip_packet_router, self.with_ip_packet_router); if config.network_requester.enabled && config.storage_paths.network_requester_config.is_none() { Ok(config.with_default_network_requester_config_path()) - } else if config.ip_forwarder.enabled && config.storage_paths.ip_forwarder_config.is_none() + } else if config.ip_packet_router.enabled && config.storage_paths.ip_packet_router_config.is_none() { - Ok(config.with_default_ip_forwarder_config_path()) + Ok(config.with_default_ip_packet_router_config_path()) } else { Ok(config) } @@ -236,10 +236,10 @@ pub(crate) fn override_network_requester_config( ) } -pub(crate) fn override_ip_forwarder_config( - cfg: nym_ip_forwarder::Config, +pub(crate) fn override_ip_packet_router_config( + cfg: nym_ip_packet_router::Config, _opts: Option, -) -> nym_ip_forwarder::Config { +) -> nym_ip_packet_router::Config { cfg } @@ -315,21 +315,21 @@ pub(crate) async fn initialise_local_network_requester( }) } -pub(crate) async fn initialise_local_ip_forwarder( +pub(crate) async fn initialise_local_ip_packet_router( gateway_config: &Config, opts: OverrideIpForwarderConfig, identity: identity::PublicKey, ) -> Result { info!("initialising ip forwarder..."); - let Some(ip_cfg_path) = gateway_config.storage_paths.ip_forwarder_config() else { + let Some(ip_cfg_path) = gateway_config.storage_paths.ip_packet_router_config() else { return Err(GatewayError::UnspecifiedIpForwarderConfig); }; let id = &gateway_config.gateway.id; let ip_id = make_ip_id(id); - let ip_data_dir = default_ip_forwarder_data_dir(id); - let mut ip_cfg = nym_ip_forwarder::Config::new(&ip_id).with_data_directory(ip_data_dir); - ip_cfg = override_ip_forwarder_config(ip_cfg, Some(opts)); + let ip_data_dir = default_ip_packet_router_data_dir(id); + let mut ip_cfg = nym_ip_packet_router::Config::new(&ip_id).with_data_directory(ip_data_dir); + ip_cfg = override_ip_packet_router_config(ip_cfg, Some(opts)); let key_store = OnDiskKeys::new(ip_cfg.storage_paths.common_paths.keys.clone()); let details_store = @@ -367,7 +367,7 @@ pub(crate) async fn initialise_local_ip_forwarder( } Ok(GatewayIpForwarderDetails { - enabled: gateway_config.ip_forwarder.enabled, + enabled: gateway_config.ip_packet_router.enabled, identity_key: address.identity().to_string(), encryption_key: address.encryption_key().to_string(), address: address.to_string(), diff --git a/gateway/src/commands/init.rs b/gateway/src/commands/init.rs index 286a24f21a..6fda8fa01c 100644 --- a/gateway/src/commands/init.rs +++ b/gateway/src/commands/init.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::commands::helpers::{ - initialise_local_ip_forwarder, initialise_local_network_requester, + initialise_local_ip_packet_router, initialise_local_network_requester, OverrideNetworkRequesterConfig, }; use crate::config::{default_config_directory, default_config_filepath, default_data_directory}; @@ -82,12 +82,12 @@ pub struct Init { statistics_service_url: Option, /// Allows this gateway to run an embedded network requester for minimal network overhead - #[clap(long, conflicts_with = "with_ip_forwarder")] + #[clap(long, conflicts_with = "with_ip_packet_router")] with_network_requester: bool, /// Allows this gateway to run an embedded network requester for minimal network overhead #[clap(long, hide = true, conflicts_with = "with_network_requester")] - with_ip_forwarder: bool, + with_ip_packet_router: bool, // ##### NETWORK REQUESTER FLAGS ##### /// Specifies whether this network requester should run in 'open-proxy' mode @@ -161,7 +161,7 @@ impl From for OverrideConfig { nyxd_urls: init_config.nyxd_urls, only_coconut_credentials: init_config.only_coconut_credentials, with_network_requester: Some(init_config.with_network_requester), - with_ip_forwarder: Some(init_config.with_ip_forwarder), + with_ip_packet_router: Some(init_config.with_ip_packet_router), } } } @@ -243,8 +243,8 @@ pub async fn execute(args: Init) -> anyhow::Result<()> { if config.network_requester.enabled { initialise_local_network_requester(&config, nr_opts, *identity_keys.public_key()) .await?; - } else if config.ip_forwarder.enabled { - initialise_local_ip_forwarder(&config, ip_opts, *identity_keys.public_key()).await?; + } else if config.ip_packet_router.enabled { + initialise_local_ip_packet_router(&config, ip_opts, *identity_keys.public_key()).await?; } eprintln!("Saved identity and mixnet sphinx keypairs"); @@ -293,7 +293,7 @@ mod tests { only_coconut_credentials: None, output: Default::default(), with_network_requester: false, - with_ip_forwarder: false, + with_ip_packet_router: false, open_proxy: None, enable_statistics: None, statistics_recipient: None, diff --git a/gateway/src/commands/mod.rs b/gateway/src/commands/mod.rs index 83cde5302b..41690d4af3 100644 --- a/gateway/src/commands/mod.rs +++ b/gateway/src/commands/mod.rs @@ -12,7 +12,7 @@ pub(crate) mod helpers; pub(crate) mod init; pub(crate) mod node_details; pub(crate) mod run; -pub(crate) mod setup_ip_forwarder; +pub(crate) mod setup_ip_packet_router; pub(crate) mod setup_network_requester; pub(crate) mod sign; mod upgrade_helpers; @@ -35,7 +35,7 @@ pub(crate) enum Commands { /// Add ip forwarder support to this gateway // essentially an option to include ip forwarder without having to setup fresh gateway #[command(hide = true)] - SetupIpForwarder(setup_ip_forwarder::CmdArgs), + SetupIpForwarder(setup_ip_packet_router::CmdArgs), /// Sign text to prove ownership of this mixnode Sign(sign::Sign), @@ -58,7 +58,7 @@ pub(crate) async fn execute(args: Cli) -> Result<(), Box node_details::execute(m).await?, Commands::Run(m) => run::execute(m).await?, Commands::SetupNetworkRequester(m) => setup_network_requester::execute(m).await?, - Commands::SetupIpForwarder(m) => setup_ip_forwarder::execute(m).await?, + Commands::SetupIpForwarder(m) => setup_ip_packet_router::execute(m).await?, Commands::Sign(m) => sign::execute(m)?, Commands::BuildInfo(m) => build_info::execute(m), Commands::Completions(s) => s.generate(&mut crate::Cli::command(), bin_name), diff --git a/gateway/src/commands/run.rs b/gateway/src/commands/run.rs index a0f807a99d..e9c1802118 100644 --- a/gateway/src/commands/run.rs +++ b/gateway/src/commands/run.rs @@ -87,12 +87,12 @@ pub struct Run { statistics_service_url: Option, /// Allows this gateway to run an embedded network requester for minimal network overhead - #[arg(long, conflicts_with = "with_ip_forwarder")] + #[arg(long, conflicts_with = "with_ip_packet_router")] with_network_requester: Option, /// Allows this gateway to run an embedded network requester for minimal network overhead #[arg(long, hide = true, conflicts_with = "with_network_requester")] - with_ip_forwarder: Option, + with_ip_packet_router: Option, // ##### NETWORK REQUESTER FLAGS ##### /// Specifies whether this network requester should run in 'open-proxy' mode @@ -163,7 +163,7 @@ impl From for OverrideConfig { nyxd_urls: run_config.nyxd_urls, only_coconut_credentials: run_config.only_coconut_credentials, with_network_requester: run_config.with_network_requester, - with_ip_forwarder: run_config.with_ip_forwarder, + with_ip_packet_router: run_config.with_ip_packet_router, } } } diff --git a/gateway/src/commands/setup_ip_forwarder.rs b/gateway/src/commands/setup_ip_packet_router.rs similarity index 79% rename from gateway/src/commands/setup_ip_forwarder.rs rename to gateway/src/commands/setup_ip_packet_router.rs index 6b8678f3ab..abe28fc350 100644 --- a/gateway/src/commands/setup_ip_forwarder.rs +++ b/gateway/src/commands/setup_ip_packet_router.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::commands::helpers::{ - initialise_local_ip_forwarder, try_load_current_config, OverrideIpForwarderConfig, + initialise_local_ip_packet_router, try_load_current_config, OverrideIpForwarderConfig, }; use crate::node::helpers::load_public_key; use clap::Args; @@ -43,22 +43,22 @@ pub async fn execute(args: CmdArgs) -> anyhow::Result<()> { // but it might be nice to be able to move files around. if let Some(custom_config_path) = args.custom_config_path { // if you specified anything as the argument, overwrite whatever was already in the config file - config.storage_paths.ip_forwarder_config = Some(custom_config_path); + config.storage_paths.ip_packet_router_config = Some(custom_config_path); } if let Some(override_enabled) = args.enabled { - config.ip_forwarder.enabled = override_enabled; + config.ip_packet_router.enabled = override_enabled; } - if config.storage_paths.ip_forwarder_config.is_none() { - config = config.with_default_ip_forwarder_config_path() + if config.storage_paths.ip_packet_router_config.is_none() { + config = config.with_default_ip_packet_router_config_path() } let identity_public_key = load_public_key( &config.storage_paths.keys.public_identity_key_file, "gateway identity", )?; - let details = initialise_local_ip_forwarder(&config, opts, identity_public_key).await?; + let details = initialise_local_ip_packet_router(&config, opts, identity_public_key).await?; config.try_save()?; args.output.to_stdout(&details); diff --git a/gateway/src/config/mod.rs b/gateway/src/config/mod.rs index 6705d7a737..b2d8cf90e2 100644 --- a/gateway/src/config/mod.rs +++ b/gateway/src/config/mod.rs @@ -102,7 +102,7 @@ pub struct Config { pub network_requester: NetworkRequester, #[serde(default)] - pub ip_forwarder: IpForwarder, + pub ip_packet_router: IpPacketRouter, #[serde(default)] pub logging: LoggingSettings, @@ -132,7 +132,7 @@ impl Config { wireguard: Default::default(), storage_paths: GatewayPaths::new_default(id.as_ref()), network_requester: Default::default(), - ip_forwarder: Default::default(), + ip_packet_router: Default::default(), logging: Default::default(), debug: Default::default(), } @@ -200,15 +200,15 @@ impl Config { self } - pub fn with_enabled_ip_forwarder(mut self, enabled_ip_forwarder: bool) -> Self { - self.ip_forwarder.enabled = enabled_ip_forwarder; + pub fn with_enabled_ip_packet_router(mut self, enabled_ip_packet_router: bool) -> Self { + self.ip_packet_router.enabled = enabled_ip_packet_router; self } - pub fn with_default_ip_forwarder_config_path(mut self) -> Self { + pub fn with_default_ip_packet_router_config_path(mut self) -> Self { self.storage_paths = self .storage_paths - .with_default_ip_forwarder_config(&self.gateway.id); + .with_default_ip_packet_router_config(&self.gateway.id); self } @@ -379,13 +379,13 @@ impl Default for NetworkRequester { #[derive(Debug, Deserialize, PartialEq, Serialize)] #[serde(default)] -pub struct IpForwarder { +pub struct IpPacketRouter { /// Specifies whether ip forwarder service is enabled in this process. pub enabled: bool, } #[allow(clippy::derivable_impls)] -impl Default for IpForwarder { +impl Default for IpPacketRouter { fn default() -> Self { Self { enabled: false } } diff --git a/gateway/src/config/old_config_v1_1_31.rs b/gateway/src/config/old_config_v1_1_31.rs index 122772f5ef..6391b18115 100644 --- a/gateway/src/config/old_config_v1_1_31.rs +++ b/gateway/src/config/old_config_v1_1_31.rs @@ -142,14 +142,14 @@ impl From for Config { clients_storage: value.storage_paths.clients_storage, network_requester_config: value.storage_paths.network_requester_config, // \/ ADDED - ip_forwarder_config: Default::default(), + ip_packet_router_config: Default::default(), // /\ ADDED }, network_requester: NetworkRequester { enabled: value.network_requester.enabled, }, // \/ ADDED - ip_forwarder: Default::default(), + ip_packet_router: Default::default(), // /\ ADDED logging: LoggingSettings { // no fields (yet) diff --git a/gateway/src/config/persistence/paths.rs b/gateway/src/config/persistence/paths.rs index 14e35f4613..7c6f2f7fc2 100644 --- a/gateway/src/config/persistence/paths.rs +++ b/gateway/src/config/persistence/paths.rs @@ -15,8 +15,8 @@ pub const DEFAULT_CLIENTS_STORAGE_FILENAME: &str = "db.sqlite"; pub const DEFAULT_NETWORK_REQUESTER_CONFIG_FILENAME: &str = "network_requester_config.toml"; pub const DEFAULT_NETWORK_REQUESTER_DATA_DIR: &str = "network-requester-data"; -pub const DEFAULT_IP_FORWARDER_CONFIG_FILENAME: &str = "ip_forwarder_config.toml"; -pub const DEFAULT_IP_FORWARDER_DATA_DIR: &str = "ip-forwarder-data"; +pub const DEFAULT_IP_PACKET_ROUTER_CONFIG_FILENAME: &str = "ip_packet_router_config.toml"; +pub const DEFAULT_IP_PACKET_ROUTER_DATA_DIR: &str = "ip-packet-router-data"; // pub const DEFAULT_DESCRIPTION_FILENAME: &str = "description.toml"; @@ -24,8 +24,8 @@ pub fn default_network_requester_data_dir>(id: P) -> PathBuf { default_data_directory(id).join(DEFAULT_NETWORK_REQUESTER_DATA_DIR) } -pub fn default_ip_forwarder_data_dir>(id: P) -> PathBuf { - default_data_directory(id).join(DEFAULT_IP_FORWARDER_DATA_DIR) +pub fn default_ip_packet_router_data_dir>(id: P) -> PathBuf { + default_data_directory(id).join(DEFAULT_IP_PACKET_ROUTER_DATA_DIR) } /// makes sure that an empty path is converted into a `None` as opposed to `Some("")` @@ -59,7 +59,7 @@ pub struct GatewayPaths { // pub cosmos_bip39_mnemonic: PathBuf, /// Path to the configuration of the embedded ip forwarder. #[serde(deserialize_with = "de_maybe_path")] - pub ip_forwarder_config: Option, + pub ip_packet_router_config: Option, } impl GatewayPaths { @@ -69,7 +69,7 @@ impl GatewayPaths { clients_storage: default_data_directory(id).join(DEFAULT_CLIENTS_STORAGE_FILENAME), // node_description: default_config_filepath(id).join(DEFAULT_DESCRIPTION_FILENAME), network_requester_config: None, - ip_forwarder_config: None, + ip_packet_router_config: None, } } @@ -87,15 +87,15 @@ impl GatewayPaths { } #[must_use] - pub fn with_ip_forwarder_config>(mut self, path: P) -> Self { - self.ip_forwarder_config = Some(path.as_ref().into()); + pub fn with_ip_packet_router_config>(mut self, path: P) -> Self { + self.ip_packet_router_config = Some(path.as_ref().into()); self } #[must_use] - pub fn with_default_ip_forwarder_config>(self, id: P) -> Self { - self.with_ip_forwarder_config( - default_config_directory(id).join(DEFAULT_IP_FORWARDER_CONFIG_FILENAME), + pub fn with_default_ip_packet_router_config>(self, id: P) -> Self { + self.with_ip_packet_router_config( + default_config_directory(id).join(DEFAULT_IP_PACKET_ROUTER_CONFIG_FILENAME), ) } @@ -103,8 +103,8 @@ impl GatewayPaths { &self.network_requester_config } - pub fn ip_forwarder_config(&self) -> &Option { - &self.ip_forwarder_config + pub fn ip_packet_router_config(&self) -> &Option { + &self.ip_packet_router_config } pub fn private_identity_key(&self) -> &Path { diff --git a/gateway/src/config/template.rs b/gateway/src/config/template.rs index 24867e10c4..c64b14aa1a 100644 --- a/gateway/src/config/template.rs +++ b/gateway/src/config/template.rs @@ -82,9 +82,9 @@ landing_page_assets_path = '{{ http.landing_page_assets_path }}' # Specifies whether network requester service is enabled in this process. enabled = {{ network_requester.enabled }} -[ip_forwarder] -# Specifies whether ip forwarder service is enabled in this process. -enabled = {{ ip_forwarder.enabled }} +[ip_packet_router] +# Specifies whether ip packet router service is enabled in this process. +enabled = {{ ip_packet_router.enabled }} [storage_paths] diff --git a/gateway/src/error.rs b/gateway/src/error.rs index 681131d8b9..7e193e4f19 100644 --- a/gateway/src/error.rs +++ b/gateway/src/error.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::node::storage::error::StorageError; -use nym_ip_forwarder::error::IpForwarderError; +use nym_ip_packet_router::error::IpForwarderError; use nym_network_requester::error::{ClientCoreError, NetworkRequesterError}; use nym_validator_client::nyxd::error::NyxdError; use nym_validator_client::nyxd::AccountId; diff --git a/gateway/src/node/client_handling/embedded_network_requester/mod.rs b/gateway/src/node/client_handling/embedded_network_requester/mod.rs index 0256592ea6..8ed7e2f978 100644 --- a/gateway/src/node/client_handling/embedded_network_requester/mod.rs +++ b/gateway/src/node/client_handling/embedded_network_requester/mod.rs @@ -30,7 +30,7 @@ impl LocalNetworkRequesterHandle { // TODO: generalize this whole thing to be general. And change the name(s). pub(crate) fn new_ip( - start_data: nym_ip_forwarder::OnStartData, + start_data: nym_ip_packet_router::OnStartData, mix_message_sender: MixMessageSender, ) -> Self { Self { diff --git a/gateway/src/node/helpers.rs b/gateway/src/node/helpers.rs index 54953e133e..50a52cd109 100644 --- a/gateway/src/node/helpers.rs +++ b/gateway/src/node/helpers.rs @@ -96,12 +96,12 @@ pub(crate) fn load_network_requester_config>( }) } -pub(crate) fn load_ip_forwarder_config>( +pub(crate) fn load_ip_packet_router_config>( id: &str, path: P, -) -> Result { +) -> Result { let path = path.as_ref(); - nym_ip_forwarder::Config::read_from_toml_file(path).map_err(|err| { + nym_ip_packet_router::Config::read_from_toml_file(path).map_err(|err| { GatewayError::IpForwarderConfigLoadFailure { id: id.to_string(), path: path.to_path_buf(), diff --git a/gateway/src/node/mod.rs b/gateway/src/node/mod.rs index 0be8be5eaf..85ce12fc62 100644 --- a/gateway/src/node/mod.rs +++ b/gateway/src/node/mod.rs @@ -1,10 +1,10 @@ // Copyright 2020-2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use self::helpers::load_ip_forwarder_config; +use self::helpers::load_ip_packet_router_config; use self::storage::PersistentStorage; use crate::commands::helpers::{ - override_ip_forwarder_config, override_network_requester_config, OverrideIpForwarderConfig, + override_ip_packet_router_config, override_network_requester_config, OverrideIpForwarderConfig, OverrideNetworkRequesterConfig, }; use crate::config::Config; @@ -75,10 +75,10 @@ pub(crate) async fn create_gateway( }; // don't attempt to read config if NR is disabled - let ip_forwarder_config = if config.ip_forwarder.enabled { - if let Some(path) = &config.storage_paths.ip_forwarder_config { - let cfg = load_ip_forwarder_config(&config.gateway.id, path)?; - Some(override_ip_forwarder_config(cfg, ip_config_override)) + let ip_packet_router_config = if config.ip_packet_router.enabled { + if let Some(path) = &config.storage_paths.ip_packet_router_config { + let cfg = load_ip_packet_router_config(&config.gateway.id, path)?; + Some(override_ip_packet_router_config(cfg, ip_config_override)) } else { // if NR is enabled, the config path must be specified return Err(GatewayError::UnspecifiedIpForwarderConfig); @@ -94,7 +94,7 @@ pub(crate) async fn create_gateway( custom_mixnet_path: custom_mixnet.clone(), }); - let ip_opts = ip_forwarder_config.map(|config| LocalIpForwarderOpts { + let ip_opts = ip_packet_router_config.map(|config| LocalIpForwarderOpts { config, custom_mixnet_path: custom_mixnet, }); @@ -111,7 +111,7 @@ pub struct LocalNetworkRequesterOpts { #[derive(Debug, Clone)] pub struct LocalIpForwarderOpts { - config: nym_ip_forwarder::Config, + config: nym_ip_packet_router::Config, custom_mixnet_path: Option, } @@ -121,7 +121,7 @@ pub(crate) struct Gateway { network_requester_opts: Option, - ip_forwarder_opts: Option, + ip_packet_router_opts: Option, /// ed25519 keypair used to assert one's identity. identity_keypair: Arc, @@ -138,7 +138,7 @@ impl Gateway { pub fn new( config: Config, network_requester_opts: Option, - ip_forwarder_opts: Option, + ip_packet_router_opts: Option, storage: St, ) -> Result { Ok(Gateway { @@ -147,7 +147,7 @@ impl Gateway { sphinx_keypair: Arc::new(helpers::load_sphinx_keys(&config)?), config, network_requester_opts, - ip_forwarder_opts, + ip_packet_router_opts, client_registry: Arc::new(DashMap::new()), }) } @@ -156,7 +156,7 @@ impl Gateway { pub async fn new_from_keys_and_storage( config: Config, network_requester_opts: Option, - ip_forwarder_opts: Option, + ip_packet_router_opts: Option, identity_keypair: identity::KeyPair, sphinx_keypair: encryption::KeyPair, storage: St, @@ -164,7 +164,7 @@ impl Gateway { Gateway { config, network_requester_opts, - ip_forwarder_opts, + ip_packet_router_opts, identity_keypair: Arc::new(identity_keypair), sphinx_keypair: Arc::new(sphinx_keypair), storage, @@ -327,7 +327,7 @@ impl Gateway { info!("Starting IP service provider..."); // if network requester is enabled, configuration file must be provided! - let Some(ip_opts) = &self.ip_forwarder_opts else { + let Some(ip_opts) = &self.ip_packet_router_opts else { log::error!("IP service provider is enabled but no configuration file was provided!"); return Err(GatewayError::UnspecifiedIpForwarderConfig); }; @@ -346,8 +346,8 @@ impl Gateway { // TODO: well, wire it up internally to gateway traffic, shutdowns, etc. let (on_start_tx, on_start_rx) = oneshot::channel(); - // let mut nr_builder = nym_ip_forwarder::IpForwarderBuilder::new(nr_opts.config.clone()) - let mut ip_builder = nym_ip_forwarder::IpForwarderBuilder::new(ip_opts.config.clone()) + // let mut nr_builder = nym_ip_packet_router::IpForwarderBuilder::new(nr_opts.config.clone()) + let mut ip_builder = nym_ip_packet_router::IpForwarderBuilder::new(ip_opts.config.clone()) .with_shutdown(shutdown) .with_custom_gateway_transceiver(Box::new(transceiver)) .with_wait_for_gateway(true) @@ -493,7 +493,7 @@ impl Gateway { // NOTE: this is mutually exclusive with the network requester (for now). This is reflected // in the command line arguments as well. - if self.config.ip_forwarder.enabled { + if self.config.ip_packet_router.enabled { let embedded_ip_sp = self .start_ip_service_provider( mix_forwarding_channel.clone(), diff --git a/service-providers/ip-forwarder/Cargo.toml b/service-providers/ip-forwarder/Cargo.toml index bb88978f18..c01c13cfb4 100644 --- a/service-providers/ip-forwarder/Cargo.toml +++ b/service-providers/ip-forwarder/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "nym-ip-forwarder" +name = "nym-ip-packet-router" version = "0.1.0" authors.workspace = true repository.workspace = true