explicitly setting up fresh gateway in native socks5 (#3547)
This commit is contained in:
committed by
GitHub
parent
96e8bdfea4
commit
4292a55614
@@ -19,6 +19,7 @@ use nym_client_core::client::base_client::{
|
||||
use nym_client_core::client::key_manager::persistence::KeyStore;
|
||||
use nym_client_core::client::replies::reply_storage::ReplyStorageBackend;
|
||||
use nym_client_core::config::DebugConfig;
|
||||
use nym_client_core::init::GatewaySetup;
|
||||
use nym_credential_storage::storage::Storage as CredentialStorage;
|
||||
use nym_sphinx::addressing::clients::Recipient;
|
||||
use nym_sphinx::params::PacketType;
|
||||
@@ -53,6 +54,8 @@ pub struct NymClient<S> {
|
||||
config: Config,
|
||||
|
||||
storage: S,
|
||||
|
||||
setup_method: GatewaySetup,
|
||||
}
|
||||
|
||||
impl<S> NymClient<S>
|
||||
@@ -65,7 +68,16 @@ where
|
||||
<S::KeyStore as KeyStore>::StorageError: Send + Sync,
|
||||
{
|
||||
pub fn new(config: Config, storage: S) -> Self {
|
||||
NymClient { config, storage }
|
||||
NymClient {
|
||||
config,
|
||||
storage,
|
||||
setup_method: GatewaySetup::MustLoad,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_gateway_setup(mut self, setup: GatewaySetup) -> Self {
|
||||
self.setup_method = setup;
|
||||
self
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
@@ -198,7 +210,8 @@ where
|
||||
};
|
||||
|
||||
let base_builder =
|
||||
BaseClientBuilder::new(&self.config.base, self.storage, dkg_query_client);
|
||||
BaseClientBuilder::new(&self.config.base, self.storage, dkg_query_client)
|
||||
.with_gateway_setup(self.setup_method);
|
||||
|
||||
let packet_type = self.config.base.debug.traffic.packet_type;
|
||||
let mut started_client = base_builder.start_base().await?;
|
||||
|
||||
@@ -8,6 +8,7 @@ use anyhow::{anyhow, Result};
|
||||
use lazy_static::lazy_static;
|
||||
use log::{info, warn};
|
||||
use nym_bin_common::logging::setup_logging;
|
||||
use nym_client_core::init::GatewaySetup;
|
||||
use nym_config_common::defaults::setup_env;
|
||||
use nym_socks5_client_core::NymClient as Socks5NymClient;
|
||||
use safer_ffi::char_p::char_p_boxed;
|
||||
@@ -207,7 +208,8 @@ where
|
||||
|
||||
let config = load_or_generate_base_config(storage_dir, client_id, service_provider).await?;
|
||||
let storage = MobileClientStorage::new(&config);
|
||||
let socks5_client = Socks5NymClient::new(config.core, storage);
|
||||
let socks5_client = Socks5NymClient::new(config.core, storage)
|
||||
.with_gateway_setup(GatewaySetup::New { by_latency: false });
|
||||
|
||||
eprintln!("starting the socks5 client");
|
||||
let mut started_client = socks5_client.start().await?;
|
||||
|
||||
Reference in New Issue
Block a user