diff --git a/socks5-c/Cargo.lock b/socks5-c/Cargo.lock index 7823da6191..74dcebb7d4 100644 --- a/socks5-c/Cargo.lock +++ b/socks5-c/Cargo.lock @@ -53,15 +53,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "aho-corasick" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - [[package]] name = "aho-corasick" version = "1.0.1" @@ -352,16 +343,6 @@ dependencies = [ "sha2 0.9.9", ] -[[package]] -name = "bstr" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09" -dependencies = [ - "memchr", - "serde", -] - [[package]] name = "bumpalo" version = "3.12.2" @@ -608,9 +589,9 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.0.0" +version = "1.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b36e527620a2a3e00e46b6e731ab6c9b68d11069c986f7d7be8eba79ef081a4" +checksum = "1c9f7f0e51bfc7295f7b2664fe8513c966428642aa765dad8a74acdab5e0c773" dependencies = [ "syn 1.0.109", ] @@ -1384,19 +1365,6 @@ dependencies = [ "url", ] -[[package]] -name = "globset" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" -dependencies = [ - "aho-corasick 0.7.20", - "bstr", - "fnv", - "log", - "regex", -] - [[package]] name = "gloo-timers" version = "0.2.6" @@ -1944,12 +1912,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - [[package]] name = "linux-raw-sys" version = "0.3.7" @@ -2094,15 +2056,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] - [[package]] name = "nym-api-requests" version = "0.1.0" @@ -3317,7 +3270,7 @@ version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" dependencies = [ - "aho-corasick 1.0.1", + "aho-corasick", "memchr", "regex-syntax", ] @@ -3357,7 +3310,6 @@ dependencies = [ "serde_urlencoded", "tokio", "tokio-native-tls", - "tokio-socks", "tower-service", "url", "wasm-bindgen", @@ -3403,41 +3355,6 @@ dependencies = [ "opaque-debug 0.3.0", ] -[[package]] -name = "rust-embed" -version = "6.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b68543d5527e158213414a92832d2aab11a84d2571a5eb021ebe22c43aab066" -dependencies = [ - "rust-embed-impl", - "rust-embed-utils", - "walkdir", -] - -[[package]] -name = "rust-embed-impl" -version = "6.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4e0f0ced47ded9a68374ac145edd65a6c1fa13a96447b873660b2a568a0fd7" -dependencies = [ - "proc-macro2", - "quote", - "rust-embed-utils", - "syn 1.0.109", - "walkdir", -] - -[[package]] -name = "rust-embed-utils" -version = "7.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512b0ab6853f7e14e3c8754acb43d6f748bb9ced66aa5915a6553ac8213f7731" -dependencies = [ - "globset", - "sha2 0.10.6", - "walkdir", -] - [[package]] name = "rustc_version" version = "0.4.0" @@ -3840,34 +3757,13 @@ name = "socks5-c" version = "0.1.0" dependencies = [ "anyhow", - "bip39", - "dirs", - "eyre", - "futures", - "itertools", - "nym-api-requests", - "nym-bin-common", "nym-client-core", "nym-config", - "nym-contracts-common", "nym-credential-storage", "nym-crypto", "nym-socks5-client-core", - "nym-task", "openssl", - "rand 0.8.5", - "reqwest", - "rust-embed", - "serde", - "serde_json", - "serde_repr", - "tap", - "tendermint-rpc", - "thiserror", - "time", "tokio", - "url", - "yaml-rust", ] [[package]] @@ -4352,8 +4248,6 @@ checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" dependencies = [ "itoa", "js-sys", - "libc", - "num_threads", "serde", "time-core", "time-macros", @@ -4450,18 +4344,6 @@ dependencies = [ "webpki 0.22.0", ] -[[package]] -name = "tokio-socks" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51165dfa029d2a65969413a6cc96f354b86b464498702f174a4efa13608fd8c0" -dependencies = [ - "either", - "futures-util", - "thiserror", - "tokio", -] - [[package]] name = "tokio-stream" version = "0.1.14" @@ -5074,15 +4956,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "zeroize" version = "1.6.0" diff --git a/socks5-c/Cargo.toml b/socks5-c/Cargo.toml index 701f949d1b..8d1718cd71 100644 --- a/socks5-c/Cargo.toml +++ b/socks5-c/Cargo.toml @@ -5,40 +5,17 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[dependencies] -anyhow = "1.0" -bip39 = { version = "2.0.0", features = ["zeroize"] } -dirs = "4.0" -eyre = "0.6.5" -futures = "0.3" -itertools = "0.10.5" -rand = "0.8" -reqwest = { version = "0.11", features = ["json", "socks"] } -rust-embed = { version = "6.4.2", features = ["include-exclude"] } -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -serde_repr = "0.1" -tap = "1.0.1" -# tauri = { git = "https://github.com/tauri-apps/tauri", branch = "next", features = ["clipboard-write-text", "native-tls-vendored", "notification-all", "shell-open"] } -tendermint-rpc = "0.23.0" -thiserror = "1.0" -time = { version = "0.3.17", features = ["local-offset"] } -tokio = { version = "1.24.1", features = ["sync", "time"] } -url = "2.2" -yaml-rust = "0.4" - -nym-client-core = { path = "../common/client-core", default-features = false } -nym-api-requests = { path = "../nym-api/nym-api-requests" } -nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common"} -nym-config-common = { path = "../common/config", package = "nym-config" } -nym-credential-storage = { path = "../common/credential-storage" } -nym-crypto = { path = "../common/crypto" } -nym-bin-common = { path = "../common/bin-common"} -nym-socks5-client-core = { path = "../common/socks5-client-core", default-features = false } -nym-task = { path = "../common/task" } -openssl = { version = "0.10", features = ["vendored"] } - - [lib] name = "socks5_c" crate-type = ["staticlib"] + +[dependencies] +anyhow = "1.0" +nym-client-core = { path = "../common/client-core", default-features = false } +nym-config-common = { path = "../common/config", package = "nym-config" } +nym-credential-storage = { path = "../common/credential-storage" } +nym-crypto = { path = "../common/crypto" } +nym-socks5-client-core = { path = "../common/socks5-client-core", default-features = false } +openssl = { version = "0.10", features = ["vendored"] } +tokio = { version = "1.24.1", features = ["sync", "time"] } + diff --git a/socks5-c/src/lib.rs b/socks5-c/src/lib.rs index a69d3670a7..903e4f6775 100644 --- a/socks5-c/src/lib.rs +++ b/socks5-c/src/lib.rs @@ -1,5 +1,12 @@ +use anyhow::Result; +use nym_client_core::{client::key_manager::KeyManager, config::Config as BaseConfig}; +use nym_credential_storage::ephemeral_storage::EphemeralStorage; +use nym_crypto::asymmetric::identity; +use nym_socks5_client_core::config::Config as Socks5Config; use nym_socks5_client_core::NymClient as Socks5NymClient; -use std::ffi::*; +//use std::ffi::*; + +static SOCKS5_CONFIG_ID: &str = "nym-connect"; #[no_mangle] pub extern "C" fn run_client() { @@ -16,22 +23,6 @@ pub extern "C" fn run_client() { .unwrap(); } -use anyhow::Result; -use futures::channel::mpsc; -use nym_client_core::config::{ClientCoreConfigTrait, GatewayEndpointConfig}; -use nym_client_core::{client::key_manager::KeyManager, config::Config as BaseConfig}; -use nym_config_common::NymConfig; -use nym_credential_storage::ephemeral_storage::EphemeralStorage; -use nym_crypto::asymmetric::identity; -use nym_socks5_client_core::config::{Config as Socks5Config, Socks5}; -use nym_socks5_client_core::Socks5ControlMessageSender; -use std::path::PathBuf; -use std::sync::Arc; -use tap::TapFallible; -use tokio::sync::RwLock; - -static SOCKS5_CONFIG_ID: &str = "nym-connect"; - #[derive(Debug)] pub struct Config { pub socks5: Socks5Config, @@ -44,26 +35,6 @@ impl Config { } } - #[allow(unused)] - pub fn new_with_port>(id: S, provider_mix_address: S, port: u16) -> Self { - Config { - socks5: Socks5Config::new(id, provider_mix_address).with_port(port), - } - } - - pub fn get_config(&self) -> &Socks5Config { - &self.socks5 - } - - pub fn get_socks5(&self) -> &Socks5 { - self.socks5.get_socks5() - } - - #[allow(unused)] - pub fn get_socks5_mut(&mut self) -> &mut Socks5 { - self.socks5.get_socks5_mut() - } - pub fn get_base(&self) -> &BaseConfig { self.socks5.get_base() } @@ -87,7 +58,7 @@ pub async fn init_socks5_config( let nym_api_endpoints = config.get_base().get_nym_api_endpoints(); - let chosen_gateway_id = identity::PublicKey::from_base58_string(chosen_gateway_id)?; + let _chosen_gateway_id = identity::PublicKey::from_base58_string(chosen_gateway_id)?; let mut key_manager = nym_client_core::init::new_client_keys(); @@ -95,14 +66,15 @@ pub async fn init_socks5_config( let gateway = nym_client_core::init::register_with_gateway::( &mut key_manager, nym_api_endpoints, - Some(chosen_gateway_id), + //Some(chosen_gateway_id), + None, false, ) .await?; config.get_base_mut().set_gateway_endpoint(gateway); - let address = *key_manager.identity_keypair().public_key(); + let _address = *key_manager.identity_keypair().public_key(); Ok((config, key_manager)) }