From 2a7fd71416dc6139c044bc2fe341d996fa43ff36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Tue, 21 Mar 2023 11:07:19 +0000 Subject: [PATCH] explicitly added old version number to 'oldconfig' --- clients/client-core/src/config/mod.rs | 2 +- .../{old_config.rs => old_config_v1_1_13.rs} | 22 +++++++++---------- clients/native/src/client/config/mod.rs | 2 +- .../{old_config.rs => old_config_v1_1_13.rs} | 12 +++++----- clients/native/src/commands/run.rs | 4 ++-- clients/socks5/src/client/config/mod.rs | 2 +- .../{old_config.rs => old_config_v1_1_13.rs} | 12 +++++----- clients/socks5/src/commands/run.rs | 4 ++-- 8 files changed, 30 insertions(+), 30 deletions(-) rename clients/client-core/src/config/{old_config.rs => old_config_v1_1_13.rs} (94%) rename clients/native/src/client/config/{old_config.rs => old_config_v1_1_13.rs} (82%) rename clients/socks5/src/client/config/{old_config.rs => old_config_v1_1_13.rs} (84%) diff --git a/clients/client-core/src/config/mod.rs b/clients/client-core/src/config/mod.rs index 181c5b5fe2..635fadc533 100644 --- a/clients/client-core/src/config/mod.rs +++ b/clients/client-core/src/config/mod.rs @@ -13,7 +13,7 @@ use url::Url; #[cfg(target_arch = "wasm32")] use wasm_bindgen::prelude::*; -pub mod old_config; +pub mod old_config_v1_1_13; pub mod persistence; pub const MISSING_VALUE: &str = "MISSING VALUE"; diff --git a/clients/client-core/src/config/old_config.rs b/clients/client-core/src/config/old_config_v1_1_13.rs similarity index 94% rename from clients/client-core/src/config/old_config.rs rename to clients/client-core/src/config/old_config_v1_1_13.rs index a83de79995..8d85454558 100644 --- a/clients/client-core/src/config/old_config.rs +++ b/clients/client-core/src/config/old_config_v1_1_13.rs @@ -20,18 +20,18 @@ use std::time::Duration; #[derive(Debug, Clone, Deserialize, PartialEq, Serialize)] #[serde(deny_unknown_fields)] -pub struct OldConfig { +pub struct OldConfig_v1_1_13 { pub client: Client, #[serde(default)] logging: Logging, #[serde(default)] - debug: OldDebugConfig, + debug: OldDebugConfig_v_1_1_13, } -impl Default for OldConfig { +impl Default for OldConfig_v1_1_13 { fn default() -> Self { - OldConfig { + OldConfig_v1_1_13 { client: Client::::default(), logging: Default::default(), debug: Default::default(), @@ -41,7 +41,7 @@ impl Default for OldConfig { #[derive(Debug, Clone, Deserialize, PartialEq, Serialize)] #[serde(default, deny_unknown_fields)] -pub struct OldDebugConfig { +pub struct OldDebugConfig_v_1_1_13 { #[serde(with = "humantime_serde")] pub average_packet_delay: Duration, @@ -96,8 +96,8 @@ pub struct OldDebugConfig { pub maximum_reply_key_age: Duration, } -impl From for DebugConfig { - fn from(value: OldDebugConfig) -> Self { +impl From for DebugConfig { + fn from(value: OldDebugConfig_v_1_1_13) -> Self { DebugConfig { traffic: Traffic { average_packet_delay: value.average_packet_delay, @@ -140,9 +140,9 @@ impl From for DebugConfig { } } -impl Default for OldDebugConfig { +impl Default for OldDebugConfig_v_1_1_13 { fn default() -> Self { - OldDebugConfig { + OldDebugConfig_v_1_1_13 { average_packet_delay: DEFAULT_AVERAGE_PACKET_DELAY, average_ack_delay: DEFAULT_AVERAGE_PACKET_DELAY, ack_wait_multiplier: DEFAULT_ACK_WAIT_MULTIPLIER, @@ -169,8 +169,8 @@ impl Default for OldDebugConfig { } } -impl From> for Config { - fn from(value: OldConfig) -> Self { +impl From> for Config { + fn from(value: OldConfig_v1_1_13) -> Self { Config { client: Client { version: value.client.version, diff --git a/clients/native/src/client/config/mod.rs b/clients/native/src/client/config/mod.rs index a2261610eb..0999eb14c8 100644 --- a/clients/native/src/client/config/mod.rs +++ b/clients/native/src/client/config/mod.rs @@ -15,7 +15,7 @@ pub use client_core::config::Config as BaseConfig; pub use client_core::config::MISSING_VALUE; pub use client_core::config::{DebugConfig, GatewayEndpointConfig}; -pub mod old_config; +pub mod old_config_v1_1_13; mod template; #[derive(Debug, Deserialize, PartialEq, Eq, Serialize, Clone, Copy)] diff --git a/clients/native/src/client/config/old_config.rs b/clients/native/src/client/config/old_config_v1_1_13.rs similarity index 82% rename from clients/native/src/client/config/old_config.rs rename to clients/native/src/client/config/old_config_v1_1_13.rs index d83ffeabcb..dff4631f12 100644 --- a/clients/native/src/client/config/old_config.rs +++ b/clients/native/src/client/config/old_config_v1_1_13.rs @@ -2,21 +2,21 @@ // SPDX-License-Identifier: Apache-2.0 use crate::client::config::{Config, Socket}; -use client_core::config::old_config::OldConfig as OldBaseConfig; +use client_core::config::old_config_v1_1_13::OldConfig_v1_1_13 as OldBaseConfig; use nym_config::NymConfig; use serde::{Deserialize, Serialize}; use std::path::PathBuf; #[derive(Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(deny_unknown_fields)] -pub struct OldConfig { +pub struct OldConfig_v1_1_13 { #[serde(flatten)] - base: OldBaseConfig, + base: OldBaseConfig, socket: Socket, } -impl NymConfig for OldConfig { +impl NymConfig for OldConfig_v1_1_13 { fn template() -> &'static str { // not intended to be used unimplemented!() @@ -50,8 +50,8 @@ impl NymConfig for OldConfig { } } -impl From for Config { - fn from(value: OldConfig) -> Self { +impl From for Config { + fn from(value: OldConfig_v1_1_13) -> Self { Config { base: value.base.into(), socket: value.socket, diff --git a/clients/native/src/commands/run.rs b/clients/native/src/commands/run.rs index bf527a5d3d..7c9df23d78 100644 --- a/clients/native/src/commands/run.rs +++ b/clients/native/src/commands/run.rs @@ -10,7 +10,7 @@ use crate::{ error::ClientError, }; -use crate::client::config::old_config::OldConfig; +use crate::client::config::old_config_v1_1_13::OldConfig_v1_1_13; use clap::Args; use log::*; use nym_bin_common::version_checker::is_minor_version_compatible; @@ -106,7 +106,7 @@ fn load_config(id: &str) -> Result> { warn!("Failed to load config for {id} - {err}...\nAttempting to use the old config template..."); // if this failed, try to use the old template - let old_config = match OldConfig::load_from_file(id) { + let old_config = match OldConfig_v1_1_13::load_from_file(id) { Ok(cfg) => { info!("Managed to load config for {id} using old template"); cfg diff --git a/clients/socks5/src/client/config/mod.rs b/clients/socks5/src/client/config/mod.rs index f341a04872..27ccddabc9 100644 --- a/clients/socks5/src/client/config/mod.rs +++ b/clients/socks5/src/client/config/mod.rs @@ -15,7 +15,7 @@ use std::fmt::Debug; use std::path::PathBuf; use std::str::FromStr; -pub mod old_config; +pub mod old_config_v1_1_13; mod template; const DEFAULT_CONNECTION_START_SURBS: u32 = 20; diff --git a/clients/socks5/src/client/config/old_config.rs b/clients/socks5/src/client/config/old_config_v1_1_13.rs similarity index 84% rename from clients/socks5/src/client/config/old_config.rs rename to clients/socks5/src/client/config/old_config_v1_1_13.rs index add6a28d27..f32735429d 100644 --- a/clients/socks5/src/client/config/old_config.rs +++ b/clients/socks5/src/client/config/old_config_v1_1_13.rs @@ -2,16 +2,16 @@ // SPDX-License-Identifier: Apache-2.0 use crate::client::config::{Config, Socks5, Socks5Debug}; -use client_core::config::old_config::OldConfig as OldBaseConfig; +use client_core::config::old_config_v1_1_13::OldConfig_v1_1_13 as OldBaseConfig; use nym_config::NymConfig; use serde::{Deserialize, Serialize}; use std::path::PathBuf; #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(deny_unknown_fields)] -pub struct OldConfig { +pub struct OldConfig_v1_1_13 { #[serde(flatten)] - base: OldBaseConfig, + base: OldBaseConfig, socks5: Socks5, @@ -19,7 +19,7 @@ pub struct OldConfig { socks5_debug: Socks5Debug, } -impl NymConfig for OldConfig { +impl NymConfig for OldConfig_v1_1_13 { fn template() -> &'static str { // not intended to be used unimplemented!() @@ -55,8 +55,8 @@ impl NymConfig for OldConfig { } } -impl From for Config { - fn from(value: OldConfig) -> Self { +impl From for Config { + fn from(value: OldConfig_v1_1_13) -> Self { Config { base: value.base.into(), socks5: value.socks5, diff --git a/clients/socks5/src/commands/run.rs b/clients/socks5/src/commands/run.rs index bd8525497d..874736d99f 100644 --- a/clients/socks5/src/commands/run.rs +++ b/clients/socks5/src/commands/run.rs @@ -7,7 +7,7 @@ use crate::{ error::Socks5ClientError, }; -use crate::client::config::old_config::OldConfig; +use crate::client::config::old_config_v1_1_13::OldConfig_v1_1_13; use clap::Args; use log::*; use nym_bin_common::version_checker::is_minor_version_compatible; @@ -114,7 +114,7 @@ fn load_config(id: &str) -> Result { info!("Managed to load config for {id} using old template"); cfg