Rename crate to nym-task (#3064)

* Rename to nym-task

* Update imports to use nym_task

* Update to nym_task in explicit module prefix

* Touchups and rustfmt

* rustfmt

* crate metadata

* fix nym-connect-android
This commit is contained in:
Jon Häggblad
2023-02-20 21:55:29 +01:00
committed by GitHub
parent ce79d5a3bc
commit 46e2c74a98
91 changed files with 319 additions and 312 deletions
Generated
+25 -25
View File
@@ -710,13 +710,13 @@ dependencies = [
"nym-crypto",
"nym-pemstore",
"nym-sphinx",
"nym-task",
"nym-topology",
"rand 0.7.3",
"serde",
"serde_json",
"sqlx 0.6.2",
"tap",
"task",
"tempfile",
"thiserror",
"time 0.3.17",
@@ -1861,6 +1861,7 @@ dependencies = [
"network-defaults",
"nym-contracts-common",
"nym-mixnet-contract-common",
"nym-task",
"okapi",
"pretty_env_logger",
"rand 0.8.5",
@@ -1873,7 +1874,6 @@ dependencies = [
"schemars",
"serde",
"serde_json",
"task",
"thiserror",
"tokio",
"validator-client",
@@ -2129,9 +2129,9 @@ dependencies = [
"nym-crypto",
"nym-pemstore",
"nym-sphinx",
"nym-task",
"rand 0.7.3",
"serde",
"task",
"thiserror",
"tokio",
"tokio-stream",
@@ -3173,7 +3173,7 @@ dependencies = [
"futures",
"log",
"nym-sphinx",
"task",
"nym-task",
"tokio",
"tokio-util",
]
@@ -3194,10 +3194,10 @@ dependencies = [
"nym-sphinx-framing",
"nym-sphinx-params",
"nym-sphinx-types",
"nym-task",
"nym-version-checker",
"rand 0.8.5",
"serde",
"task",
"thiserror",
"tokio",
"tokio-util",
@@ -3406,6 +3406,7 @@ dependencies = [
"nym-mixnet-contract-common",
"nym-pemstore",
"nym-sphinx",
"nym-task",
"nym-topology",
"nym-version-checker",
"nym-vesting-contract-common",
@@ -3424,7 +3425,6 @@ dependencies = [
"serde_json",
"sqlx 0.6.2",
"tap",
"task",
"thiserror",
"time 0.3.17",
"tokio",
@@ -3546,6 +3546,7 @@ dependencies = [
"nym-crypto",
"nym-pemstore",
"nym-sphinx",
"nym-task",
"nym-topology",
"nym-version-checker",
"pretty_env_logger",
@@ -3553,7 +3554,6 @@ dependencies = [
"serde",
"serde_json",
"tap",
"task",
"thiserror",
"tokio",
"tokio-tungstenite 0.14.0",
@@ -3632,6 +3632,7 @@ dependencies = [
"nym-crypto",
"nym-pemstore",
"nym-sphinx",
"nym-task",
"nym-types",
"nym-version-checker",
"once_cell",
@@ -3642,7 +3643,6 @@ dependencies = [
"sqlx 0.5.13",
"statistics-common",
"subtle-encoding",
"task",
"thiserror",
"tokio",
"tokio-stream",
@@ -3699,6 +3699,7 @@ dependencies = [
"nym-sphinx",
"nym-sphinx-params",
"nym-sphinx-types",
"nym-task",
"nym-topology",
"nym-types",
"nym-version-checker",
@@ -3708,7 +3709,6 @@ dependencies = [
"serde",
"serde_json",
"sysinfo",
"task",
"tokio",
"tokio-util",
"toml",
@@ -3737,6 +3737,7 @@ dependencies = [
"nym-crypto",
"nym-sdk",
"nym-sphinx",
"nym-task",
"nym-version-checker",
"ordered-buffer",
"pretty_env_logger",
@@ -3750,7 +3751,6 @@ dependencies = [
"sqlx 0.6.2",
"statistics-common",
"tap",
"task",
"thiserror",
"tokio",
"tokio-tungstenite 0.17.2",
@@ -3811,10 +3811,10 @@ dependencies = [
"network-defaults",
"nym-crypto",
"nym-sphinx",
"nym-task",
"pretty_env_logger",
"rand 0.7.3",
"tap",
"task",
"thiserror",
"tokio",
"toml",
@@ -3847,6 +3847,7 @@ dependencies = [
"nym-crypto",
"nym-pemstore",
"nym-sphinx",
"nym-task",
"nym-topology",
"nym-version-checker",
"ordered-buffer",
@@ -3859,7 +3860,6 @@ dependencies = [
"service-providers-common",
"socks5-requests",
"tap",
"task",
"thiserror",
"tokio",
"url",
@@ -3993,6 +3993,18 @@ dependencies = [
"sphinx",
]
[[package]]
name = "nym-task"
version = "0.1.0"
dependencies = [
"futures",
"log",
"thiserror",
"tokio",
"wasm-bindgen",
"wasm-bindgen-futures",
]
[[package]]
name = "nym-topology"
version = "0.1.0"
@@ -4640,9 +4652,9 @@ dependencies = [
"client-connections",
"futures",
"log",
"nym-task",
"ordered-buffer",
"socks5-requests",
"task",
"tokio",
"tokio-test",
"tokio-util",
@@ -6151,18 +6163,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]]
name = "task"
version = "0.1.0"
dependencies = [
"futures",
"log",
"thiserror",
"tokio",
"wasm-bindgen",
"wasm-bindgen-futures",
]
[[package]]
name = "tempfile"
version = "3.3.0"
+1 -1
View File
@@ -35,7 +35,7 @@ nym-sphinx = { path = "../../common/nymsphinx" }
nym-pemstore = { path = "../../common/pemstore" }
nym-topology = { path = "../../common/topology" }
validator-client = { path = "../../common/client-libs/validator-client", default-features = false }
task = { path = "../../common/task" }
nym-task = { path = "../../common/task" }
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.tokio-stream]
version = "0.1.11"
@@ -36,10 +36,10 @@ use nym_sphinx::acknowledgements::AckKey;
use nym_sphinx::addressing::clients::Recipient;
use nym_sphinx::addressing::nodes::NodeIdentity;
use nym_sphinx::receiver::ReconstructedMessage;
use nym_task::{TaskClient, TaskManager};
use std::sync::Arc;
use std::time::Duration;
use tap::TapFallible;
use task::{TaskClient, TaskManager};
use url::Url;
#[cfg(not(target_arch = "wasm32"))]
use validator_client::nyxd::CosmWasmClient;
@@ -213,7 +213,7 @@ impl LoopCoverTrafficStream<OsRng> {
tokio::task::yield_now().await;
}
pub fn start_with_shutdown(mut self, mut shutdown: task::TaskClient) {
pub fn start_with_shutdown(mut self, mut shutdown: nym_task::TaskClient) {
// we should set initial delay only when we actually start the stream
let sampled =
sample_poisson_duration(&mut self.rng, self.average_cover_message_sending_delay);
@@ -76,7 +76,7 @@ where
}
}
pub fn start_with_shutdown(mut self, mut shutdown: task::TaskClient) {
pub fn start_with_shutdown(mut self, mut shutdown: nym_task::TaskClient) {
spawn_future(async move {
debug!("Started MixTrafficController with graceful shutdown support");
@@ -65,7 +65,7 @@ impl AcknowledgementListener {
}
}
pub(super) async fn run_with_shutdown(&mut self, mut shutdown: task::TaskClient) {
pub(super) async fn run_with_shutdown(&mut self, mut shutdown: nym_task::TaskClient) {
debug!("Started AcknowledgementListener with graceful shutdown support");
while !shutdown.is_shutdown() {
@@ -216,7 +216,7 @@ impl ActionController {
fn handle_expired_ack_timer(
&mut self,
expired_ack: Expired<FragmentIdentifier>,
task_client: &mut task::TaskClient,
task_client: &mut nym_task::TaskClient,
) {
// I'm honestly not sure how to handle it, because getting it means other things in our
// system are already misbehaving. If we ever see this panic, then I guess we should worry
@@ -260,7 +260,7 @@ impl ActionController {
}
}
pub(super) async fn run_with_shutdown(&mut self, mut shutdown: task::TaskClient) {
pub(super) async fn run_with_shutdown(&mut self, mut shutdown: nym_task::TaskClient) {
debug!("Started ActionController with graceful shutdown support");
while !shutdown.is_shutdown() {
@@ -109,7 +109,7 @@ where
};
}
pub(super) async fn run_with_shutdown(&mut self, mut shutdown: task::TaskClient) {
pub(super) async fn run_with_shutdown(&mut self, mut shutdown: nym_task::TaskClient) {
debug!("Started InputMessageListener with graceful shutdown support");
while !shutdown.is_shutdown() {
@@ -249,7 +249,7 @@ where
}
}
pub(super) fn start_with_shutdown(self, shutdown: task::TaskClient) {
pub(super) fn start_with_shutdown(self, shutdown: nym_task::TaskClient) {
let mut acknowledgement_listener = self.acknowledgement_listener;
let mut input_message_listener = self.input_message_listener;
let mut retransmission_request_listener = self.retransmission_request_listener;
@@ -137,7 +137,7 @@ where
.await
}
pub(super) async fn run_with_shutdown(&mut self, mut shutdown: task::TaskClient) {
pub(super) async fn run_with_shutdown(&mut self, mut shutdown: nym_task::TaskClient) {
debug!("Started RetransmissionRequestListener with graceful shutdown support");
while !shutdown.is_shutdown() {
@@ -37,7 +37,7 @@ impl SentNotificationListener {
.unwrap();
}
pub(super) async fn run_with_shutdown(&mut self, mut shutdown: task::TaskClient) {
pub(super) async fn run_with_shutdown(&mut self, mut shutdown: nym_task::TaskClient) {
debug!("Started SentNotificationListener with graceful shutdown support");
while !shutdown.is_shutdown() {
@@ -270,7 +270,7 @@ impl RealMessagesController<OsRng> {
}
}
pub fn start_with_shutdown(self, shutdown: task::TaskClient) {
pub fn start_with_shutdown(self, shutdown: nym_task::TaskClient) {
let mut out_queue_control = self.out_queue_control;
let ack_control = self.ack_control;
let mut reply_control = self.reply_control;
@@ -460,7 +460,7 @@ where
}
#[cfg(not(target_arch = "wasm32"))]
fn log_status(&self, shutdown: &mut task::TaskClient) {
fn log_status(&self, shutdown: &mut nym_task::TaskClient) {
use crate::error::ClientCoreStatusMessage;
let packets = self.transmission_buffer.total_size();
@@ -501,7 +501,7 @@ where
}
}
pub(super) async fn run_with_shutdown(&mut self, mut shutdown: task::TaskClient) {
pub(super) async fn run_with_shutdown(&mut self, mut shutdown: nym_task::TaskClient) {
debug!("Started OutQueueControl with graceful shutdown support");
#[cfg(not(target_arch = "wasm32"))]
@@ -399,7 +399,7 @@ impl RequestReceiver {
}
}
async fn run_with_shutdown(&mut self, mut shutdown: task::TaskClient) {
async fn run_with_shutdown(&mut self, mut shutdown: nym_task::TaskClient) {
debug!("Started RequestReceiver with graceful shutdown support");
while !shutdown.is_shutdown() {
tokio::select! {
@@ -438,7 +438,7 @@ impl FragmentedMessageReceiver {
}
}
async fn run_with_shutdown(&mut self, mut shutdown: task::TaskClient) {
async fn run_with_shutdown(&mut self, mut shutdown: nym_task::TaskClient) {
debug!("Started FragmentedMessageReceiver with graceful shutdown support");
while !shutdown.is_shutdown() {
tokio::select! {
@@ -488,7 +488,7 @@ impl ReceivedMessagesBufferController {
}
}
pub fn start_with_shutdown(self, shutdown: task::TaskClient) {
pub fn start_with_shutdown(self, shutdown: nym_task::TaskClient) {
let mut fragmented_message_receiver = self.fragmented_message_receiver;
let mut request_receiver = self.request_receiver;
@@ -835,7 +835,7 @@ where
// todo!()
// }
pub(crate) async fn run_with_shutdown(&mut self, mut shutdown: task::TaskClient) {
pub(crate) async fn run_with_shutdown(&mut self, mut shutdown: nym_task::TaskClient) {
debug!("Started ReplyController with graceful shutdown support");
let polling_rate = Duration::from_secs(5);
@@ -37,7 +37,7 @@ where
pub async fn flush_on_shutdown(
mut self,
mem_state: CombinedReplyStorage,
mut shutdown: task::TaskClient,
mut shutdown: nym_task::TaskClient,
) {
use log::{debug, error, info, warn};
@@ -306,7 +306,7 @@ impl TopologyRefresher {
self.topology_accessor.ensure_is_routable().await
}
pub fn start_with_shutdown(mut self, mut shutdown: task::TaskClient) {
pub fn start_with_shutdown(mut self, mut shutdown: nym_task::TaskClient) {
spawn_future(async move {
debug!("Started TopologyRefresher with graceful shutdown support");
+1 -1
View File
@@ -49,7 +49,7 @@ gateway-requests = { path = "../../gateway/gateway-requests" }
network-defaults = { path = "../../common/network-defaults" }
nym-sphinx = { path = "../../common/nymsphinx" }
nym-pemstore = { path = "../../common/pemstore" }
task = { path = "../../common/task" }
nym-task = { path = "../../common/task" }
nym-topology = { path = "../../common/topology" }
validator-client = { path = "../../common/client-libs/validator-client", features = ["nyxd-client"] }
nym-version-checker = { path = "../../common/version-checker" }
+2 -2
View File
@@ -19,7 +19,7 @@ use futures::channel::mpsc;
use gateway_client::bandwidth::BandwidthController;
use log::*;
use nym_sphinx::anonymous_replies::requests::AnonymousSenderTag;
use task::TaskManager;
use nym_task::TaskManager;
use tokio::sync::watch::error::SendError;
use validator_client::nyxd::QueryNyxdClient;
@@ -85,7 +85,7 @@ impl SocketClient {
client_output: ClientOutput,
client_state: ClientState,
self_address: &Recipient,
shutdown: task::TaskClient,
shutdown: nym_task::TaskClient,
) {
info!("Starting websocket listener...");
+2 -2
View File
@@ -357,7 +357,7 @@ impl Handler {
async fn listen_for_requests(
&mut self,
mut msg_receiver: ReconstructedMessagesReceiver,
mut task_client: task::TaskClient,
mut task_client: nym_task::TaskClient,
) {
while !task_client.is_shutdown() {
tokio::select! {
@@ -410,7 +410,7 @@ impl Handler {
pub(crate) async fn handle_connection(
mut self,
socket: TcpStream,
mut task_client: task::TaskClient,
mut task_client: nym_task::TaskClient,
) {
// We don't want a crash in the connection handler to trigger a shutdown of the whole
// process.
+6 -2
View File
@@ -32,7 +32,11 @@ impl Listener {
}
}
pub(crate) async fn run(&mut self, handler: HandlerBuilder, mut task_client: task::TaskClient) {
pub(crate) async fn run(
&mut self,
handler: HandlerBuilder,
mut task_client: nym_task::TaskClient,
) {
let tcp_listener = match tokio::net::TcpListener::bind(self.address).await {
Ok(listener) => listener,
Err(err) => {
@@ -103,7 +107,7 @@ impl Listener {
pub(crate) fn start(
mut self,
handler: HandlerBuilder,
shutdown: task::TaskClient,
shutdown: nym_task::TaskClient,
) -> JoinHandle<()> {
info!("Running websocket on {:?}", self.address.to_string());
+1 -1
View File
@@ -47,7 +47,7 @@ nym-pemstore = { path = "../../common/pemstore" }
proxy-helpers = { path = "../../common/socks5/proxy-helpers" }
service-providers-common = { path = "../../service-providers/common" }
socks5-requests = { path = "../../common/socks5/requests" }
task = { path = "../../common/task" }
nym-task = { path = "../../common/task" }
nym-topology = { path = "../../common/topology" }
validator-client = { path = "../../common/client-libs/validator-client", features = ["nyxd-client"] }
nym-version-checker = { path = "../../common/version-checker" }
+3 -3
View File
@@ -22,8 +22,8 @@ use futures::StreamExt;
use gateway_client::bandwidth::BandwidthController;
use log::*;
use nym_sphinx::addressing::clients::Recipient;
use nym_task::{TaskClient, TaskManager};
use std::error::Error;
use task::{TaskClient, TaskManager};
use validator_client::nyxd::QueryNyxdClient;
pub mod config;
@@ -142,7 +142,7 @@ impl NymClient {
),
shutdown.clone(),
);
task::spawn_with_report_error(
nym_task::spawn_with_report_error(
async move {
sphinx_socks
.serve(
@@ -169,7 +169,7 @@ impl NymClient {
pub async fn run_and_listen(
self,
mut receiver: Socks5ControlMessageReceiver,
sender: task::StatusSender,
sender: nym_task::StatusSender,
) -> Result<(), Box<dyn Error + Send + Sync>> {
// Start the main task
let mut shutdown = self.start().await?;
+1 -1
View File
@@ -10,6 +10,7 @@ use futures::channel::mpsc;
use futures::task::{Context, Poll};
use log::*;
use nym_sphinx::addressing::clients::Recipient;
use nym_task::TaskClient;
use pin_project::pin_project;
use proxy_helpers::connection_controller::{
ConnectionReceiver, ControllerCommand, ControllerSender,
@@ -23,7 +24,6 @@ use socks5_requests::{
use std::io;
use std::net::SocketAddr;
use std::pin::Pin;
use task::TaskClient;
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, ReadBuf};
use tokio::{self, net::TcpStream};
+1 -1
View File
@@ -5,10 +5,10 @@ use log::*;
use client_core::client::received_buffer::ReconstructedMessagesReceiver;
use client_core::client::received_buffer::{ReceivedBufferMessage, ReceivedBufferRequestSender};
use nym_sphinx::receiver::ReconstructedMessage;
use nym_task::TaskClient;
use proxy_helpers::connection_controller::ControllerSender;
use service_providers_common::interface::{ControlResponse, ResponseContent};
use socks5_requests::{Socks5ProviderResponse, Socks5Response, Socks5ResponseContent};
use task::TaskClient;
use crate::error::Socks5ClientError;
+1 -1
View File
@@ -10,10 +10,10 @@ use client_core::client::{
};
use log::*;
use nym_sphinx::addressing::clients::Recipient;
use nym_task::TaskClient;
use proxy_helpers::connection_controller::Controller;
use std::net::SocketAddr;
use tap::TapFallible;
use task::TaskClient;
use tokio::net::TcpListener;
/// A Socks5 server that listens for connections.
+1 -1
View File
@@ -39,7 +39,7 @@ nym-sphinx = { path = "../../common/nymsphinx" }
gateway-client = { path = "../../common/client-libs/gateway-client", default-features = false, features = ["wasm"] }
validator-client = { path = "../../common/client-libs/validator-client", default-features = false }
wasm-utils = { path = "../../common/wasm-utils" }
task = { path = "../../common/task" }
nym-task = { path = "../../common/task" }
# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
+1 -1
View File
@@ -15,9 +15,9 @@ use gateway_client::wasm_mockups::SigningNyxdClient;
use js_sys::Promise;
use nym_sphinx::addressing::clients::Recipient;
use nym_sphinx::anonymous_replies::requests::AnonymousSenderTag;
use nym_task::TaskManager;
use rand::rngs::OsRng;
use std::sync::Arc;
use task::TaskManager;
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::future_to_promise;
use wasm_utils::{console_error, console_log};
+1 -1
View File
@@ -26,7 +26,7 @@ network-defaults = { path = "../../network-defaults" }
nym-sphinx = { path = "../../nymsphinx" }
nym-pemstore = { path = "../../pemstore" }
validator-client = { path = "../validator-client" }
task = { path = "../../task" }
nym-task = { path = "../../task" }
serde = { version = "1.0", features = ["derive"]}
mobile-storage = { path = "../../mobile-storage" }
@@ -19,11 +19,11 @@ use log::*;
use network_defaults::{REMAINING_BANDWIDTH_THRESHOLD, TOKENS_TO_BURN};
use nym_crypto::asymmetric::identity;
use nym_sphinx::forwarding::packet::MixPacket;
use nym_task::TaskClient;
use rand::rngs::OsRng;
use std::convert::TryFrom;
use std::sync::Arc;
use std::time::Duration;
use task::TaskClient;
use tungstenite::protocol::Message;
#[cfg(not(target_arch = "wasm32"))]
@@ -9,7 +9,7 @@ use futures::channel::mpsc;
use log::*;
use nym_sphinx::addressing::nodes::MAX_NODE_ADDRESS_UNPADDED_LEN;
use nym_sphinx::params::packet_sizes::PacketSize;
use task::TaskClient;
use nym_task::TaskClient;
pub type MixnetMessageSender = mpsc::UnboundedSender<Vec<Vec<u8>>>;
pub type MixnetMessageReceiver = mpsc::UnboundedReceiver<Vec<Vec<u8>>>;
@@ -9,8 +9,8 @@ use futures::stream::{SplitSink, SplitStream};
use futures::{SinkExt, StreamExt};
use gateway_requests::registration::handshake::SharedKeys;
use log::*;
use nym_task::TaskClient;
use std::sync::Arc;
use task::TaskClient;
use tungstenite::Message;
#[cfg(not(target_arch = "wasm32"))]
+1 -1
View File
@@ -14,4 +14,4 @@ tokio-util = { version = "0.7.4", features = ["codec"] }
# internal
nym-sphinx = { path = "../../nymsphinx" }
task = { path = "../../task" }
nym-task = { path = "../../task" }
@@ -16,7 +16,7 @@ type MixForwardingReceiver = mpsc::UnboundedReceiver<MixPacket>;
pub struct PacketForwarder {
mixnet_client: Client,
packet_receiver: MixForwardingReceiver,
shutdown: task::TaskClient,
shutdown: nym_task::TaskClient,
}
impl PacketForwarder {
@@ -26,7 +26,7 @@ impl PacketForwarder {
initial_connection_timeout: Duration,
maximum_connection_buffer_size: usize,
use_legacy_version: bool,
shutdown: task::TaskClient,
shutdown: nym_task::TaskClient,
) -> (PacketForwarder, MixForwardingSender) {
let client_config = Config::new(
initial_reconnection_backoff,
+1 -1
View File
@@ -26,6 +26,6 @@ nym-sphinx-forwarding = { path = "../nymsphinx/forwarding" }
nym-sphinx-framing = { path = "../nymsphinx/framing" }
nym-sphinx-params = { path = "../nymsphinx/params" }
nym-sphinx-types = { path = "../nymsphinx/types" }
task = { path = "../task" }
nym-task = { path = "../task" }
validator-client = { path = "../client-libs/validator-client", features = ["nyxd-client"]}
nym-version-checker = { path = "../version-checker" }
+1 -1
View File
@@ -7,11 +7,11 @@ use bytes::{BufMut, BytesMut};
use futures::StreamExt;
use log::*;
use nym_crypto::asymmetric::identity;
use nym_task::TaskClient;
use std::fmt::{Display, Formatter};
use std::net::SocketAddr;
use std::sync::Arc;
use std::{fmt, io, process};
use task::TaskClient;
use tokio::io::AsyncWriteExt;
use tokio::net::{TcpListener, TcpStream};
use tokio_util::codec::{Decoder, Encoder, Framed};
+1 -1
View File
@@ -8,6 +8,7 @@ use futures::StreamExt;
use log::*;
use network_defaults::mainnet::NYM_API;
use nym_crypto::asymmetric::identity;
use nym_task::TaskClient;
use nym_version_checker::parse_version;
use rand::seq::SliceRandom;
use rand::thread_rng;
@@ -15,7 +16,6 @@ use std::net::SocketAddr;
use std::net::ToSocketAddrs;
use std::sync::Arc;
use std::time::Duration;
use task::TaskClient;
use tokio::task::JoinHandle;
use tokio::time::sleep;
use url::Url;
+1 -1
View File
@@ -6,12 +6,12 @@ use crate::verloc::measurement::Measurement;
use crate::verloc::packet::{EchoPacket, ReplyPacket};
use log::*;
use nym_crypto::asymmetric::identity;
use nym_task::TaskClient;
use rand::{thread_rng, Rng};
use std::net::SocketAddr;
use std::sync::Arc;
use std::time::Duration;
use std::{fmt, io};
use task::TaskClient;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpStream;
use tokio::time::sleep;
+1 -1
View File
@@ -19,7 +19,7 @@ log = { workspace = true }
client-connections = { path = "../../client-connections" }
ordered-buffer = { path = "../ordered-buffer" }
socks5-requests = { path = "../requests" }
task = { path = "../../task" }
nym-task = { path = "../../task" }
[dev-dependencies]
tokio-test = "0.4.2"
@@ -5,10 +5,10 @@ use client_connections::{ConnectionCommand, ConnectionCommandSender};
use futures::channel::mpsc;
use futures::StreamExt;
use log::*;
use nym_task::TaskClient;
use ordered_buffer::{OrderedMessage, OrderedMessageBuffer, ReadContiguousData};
use socks5_requests::{ConnectionId, NetworkData, SendRequest};
use std::collections::{HashMap, HashSet};
use task::TaskClient;
/// A generic message produced after reading from a socket/connection. It includes data that was
/// actually read alongside boolean indicating whether the connection got closed so that
@@ -10,12 +10,12 @@ use client_connections::TransmissionLane;
use futures::FutureExt;
use futures::StreamExt;
use log::*;
use nym_task::TaskClient;
use ordered_buffer::OrderedMessageSender;
use socks5_requests::ConnectionId;
use std::fmt::Debug;
use std::time::Duration;
use std::{io, sync::Arc};
use task::TaskClient;
use tokio::select;
use tokio::{net::tcp::OwnedReadHalf, sync::Notify, time::sleep};
@@ -3,10 +3,10 @@
use crate::connection_controller::ConnectionReceiver;
use client_connections::LaneQueueLengths;
use nym_task::TaskClient;
use socks5_requests::ConnectionId;
use std::fmt::Debug;
use std::{sync::Arc, time::Duration};
use task::TaskClient;
use tokio::{net::TcpStream, sync::Notify};
mod inbound;
@@ -6,9 +6,9 @@ use crate::connection_controller::{ConnectionMessage, ConnectionReceiver};
use futures::FutureExt;
use futures::StreamExt;
use log::*;
use nym_task::TaskClient;
use socks5_requests::ConnectionId;
use std::{sync::Arc, time::Duration};
use task::TaskClient;
use tokio::io::AsyncWriteExt;
use tokio::select;
use tokio::{net::tcp::OwnedWriteHalf, sync::Notify, time::sleep, time::Instant};
+7 -5
View File
@@ -1,9 +1,11 @@
[package]
name = "task"
name = "nym-task"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
description = "Task handling"
edition.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
[dependencies]
futures = "0.3"
@@ -13,7 +15,7 @@ tokio = { version = "1.24.1", features = ["macros", "sync"] }
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.tokio]
version = "1.24.1"
features = ["signal", "time"]
features = ["signal", "time", "rt"]
[target."cfg(target_arch = \"wasm32\")".dependencies.wasm-bindgen-futures]
version = "0.4"
+1 -1
View File
@@ -33,5 +33,5 @@ nym-mixnet-contract-common = { path = "../common/cosmwasm-smart-contracts/mixnet
nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common" }
network-defaults = { path = "../common/network-defaults" }
logging = { path = "../common/logging"}
task = { path = "../common/task" }
nym-task = { path = "../common/task" }
validator-client = { path = "../common/client-libs/validator-client", features=["nyxd-client"] }
@@ -1,5 +1,5 @@
use log::info;
use task::TaskClient;
use nym_task::TaskClient;
use crate::country_statistics::country_nodes_distribution::CountryNodesDistribution;
use crate::COUNTRY_DATA_REFRESH_INTERVAL;
@@ -4,7 +4,7 @@
use crate::mix_nodes::location::Location;
use crate::state::ExplorerApiStateContext;
use log::{info, warn};
use task::TaskClient;
use nym_task::TaskClient;
pub(crate) struct GeoLocateTask {
state: ExplorerApiStateContext,
+1 -1
View File
@@ -8,7 +8,7 @@ use dotenv::dotenv;
use log::info;
use logging::setup_logging;
use network_defaults::setup_env;
use task::TaskManager;
use nym_task::TaskManager;
pub(crate) mod cache;
mod client;
+1 -1
View File
@@ -4,7 +4,7 @@
use std::future::Future;
use nym_mixnet_contract_common::GatewayBond;
use task::TaskClient;
use nym_task::TaskClient;
use validator_client::models::MixNodeBondAnnotated;
use validator_client::nyxd::error::NyxdError;
use validator_client::nyxd::{Paging, QueryNyxdClient, ValidatorResponse};
+1 -1
View File
@@ -67,7 +67,7 @@ nym-sphinx = { path = "../common/nymsphinx" }
nym-pemstore = { path = "../common/pemstore" }
statistics-common = { path = "../common/statistics" }
nym-api-requests = { path = "../nym-api/nym-api-requests" }
task = { path = "../common/task" }
nym-task = { path = "../common/task" }
validator-client = { path = "../common/client-libs/validator-client", features = [
"nyxd-client",
] }
@@ -21,7 +21,7 @@ use tokio_tungstenite::tungstenite::protocol::Message;
use crate::node::client_handling::bandwidth::Bandwidth;
use crate::node::client_handling::FREE_TESTNET_BANDWIDTH_VALUE;
use gateway_requests::iv::IV;
use task::TaskClient;
use nym_task::TaskClient;
#[derive(Debug, Error)]
pub(crate) enum RequestHandlingError {
@@ -643,7 +643,7 @@ where
None
}
pub(crate) async fn start_handling(self, shutdown: task::TaskClient)
pub(crate) async fn start_handling(self, shutdown: nym_task::TaskClient)
where
S: AsyncRead + AsyncWrite + Unpin + Send,
{
@@ -6,8 +6,8 @@ use gateway_requests::registration::handshake::SharedKeys;
use gateway_requests::ServerResponse;
use log::{trace, warn};
use nym_sphinx::DestinationAddressBytes;
use nym_task::TaskClient;
use rand::{CryptoRng, Rng};
use task::TaskClient;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio_tungstenite::WebSocketStream;
@@ -43,7 +43,7 @@ impl Listener {
outbound_mix_sender: MixForwardingSender,
storage: St,
active_clients_store: ActiveClientsStore,
mut shutdown: task::TaskClient,
mut shutdown: nym_task::TaskClient,
) where
St: Storage + Clone + 'static,
{
@@ -94,7 +94,7 @@ impl Listener {
outbound_mix_sender: MixForwardingSender,
storage: St,
active_clients_store: ActiveClientsStore,
shutdown: task::TaskClient,
shutdown: nym_task::TaskClient,
) -> JoinHandle<()>
where
St: Storage + Clone + 'static,
@@ -14,9 +14,9 @@ use nym_sphinx::forwarding::packet::MixPacket;
use nym_sphinx::framing::codec::SphinxCodec;
use nym_sphinx::framing::packet::FramedSphinxPacket;
use nym_sphinx::DestinationAddressBytes;
use nym_task::TaskClient;
use std::collections::HashMap;
use std::net::SocketAddr;
use task::TaskClient;
use tokio::net::TcpStream;
use tokio_util::codec::Framed;
@@ -4,9 +4,9 @@
use crate::node::mixnet_handling::receiver::connection_handler::ConnectionHandler;
use crate::node::storage::Storage;
use log::*;
use nym_task::TaskClient;
use std::net::SocketAddr;
use std::process;
use task::TaskClient;
use tokio::task::JoinHandle;
pub(crate) struct Listener {
+1 -1
View File
@@ -18,6 +18,7 @@ use log::*;
use mixnet_client::forwarder::{MixForwardingSender, PacketForwarder};
use network_defaults::NymNetworkDetails;
use nym_crypto::asymmetric::{encryption, identity};
use nym_task::{TaskClient, TaskManager};
use rand::seq::SliceRandom;
use rand::thread_rng;
use statistics_common::collector::StatisticsSender;
@@ -25,7 +26,6 @@ use std::error::Error;
use std::net::SocketAddr;
use std::process;
use std::sync::Arc;
use task::{TaskClient, TaskManager};
use validator_client::Client;
pub(crate) mod client_handling;
+1 -1
View File
@@ -50,7 +50,7 @@ mixnode-common = { path="../common/mixnode-common" }
nonexhaustive-delayqueue = { path="../common/nonexhaustive-delayqueue" }
nym-sphinx = { path="../common/nymsphinx" }
nym-pemstore = { path = "../common/pemstore", version = "0.1.0" }
task = { path = "../common/task" }
nym-task = { path = "../common/task" }
nym-types = { path = "../common/types" }
nym-topology = { path="../common/topology" }
validator-client = { path="../common/client-libs/validator-client" }
+1 -1
View File
@@ -23,13 +23,13 @@ use config::NymConfig;
use log::{error, info, warn};
use mixnode_common::verloc::{self, AtomicVerlocResult, VerlocMeasurer};
use nym_crypto::asymmetric::{encryption, identity};
use nym_task::{TaskClient, TaskManager};
use nym_version_checker::parse_version;
use rand::seq::SliceRandom;
use rand::thread_rng;
use std::net::SocketAddr;
use std::process;
use std::sync::Arc;
use task::{TaskClient, TaskManager};
mod http;
mod listener;
+1 -1
View File
@@ -503,7 +503,7 @@ impl Controller {
#[cfg(test)]
mod tests {
use super::*;
use task::TaskManager;
use nym_task::TaskManager;
#[tokio::test]
async fn node_stats_reported_are_received() {
+1 -1
View File
@@ -134,7 +134,7 @@ mod tests {
use std::sync::{Arc, Mutex};
use std::time::Duration;
use task::TaskManager;
use nym_task::TaskManager;
use nym_sphinx::addressing::nodes::NymNodeRoutingAddress;
use nym_sphinx_params::packet_sizes::PacketSize;
+1 -1
View File
@@ -87,7 +87,7 @@ multisig-contract-common = { path = "../common/cosmwasm-smart-contracts/multisig
nymcoconut = { path = "../common/nymcoconut" }
nym-sphinx = { path = "../common/nymsphinx" }
nym-pemstore = { path = "../common/pemstore" }
task = { path = "../common/task" }
nym-task = { path = "../common/task" }
nym-topology = { path = "../common/topology" }
nym-api-requests = { path = "nym-api-requests" }
validator-client = { path = "../common/client-libs/validator-client", features = [
+1 -1
View File
@@ -5,10 +5,10 @@ use super::CirculatingSupplyCache;
use crate::circulating_supply_api::cache::CirculatingSupplyCacheError;
use crate::support::nyxd::Client;
use nym_contracts_common::truncate_decimal;
use nym_task::TaskClient;
use std::collections::HashSet;
use std::sync::atomic::Ordering;
use std::time::Duration;
use task::TaskClient;
use tokio::time;
use validator_client::nyxd::Coin;
+1 -1
View File
@@ -1,10 +1,10 @@
// Copyright 2022-2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use nym_task::TaskManager;
use okapi::openapi3::OpenApi;
use rocket::Route;
use rocket_okapi::{openapi_get_routes_spec, settings::OpenApiSettings};
use task::TaskManager;
use crate::support::{config::Config, nyxd};
+1 -1
View File
@@ -16,11 +16,11 @@ use crate::support::config::Config;
use anyhow::Result;
use coconut_dkg_common::types::EpochState;
use dkg::bte::keys::KeyPair as DkgKeyPair;
use nym_task::{TaskClient, TaskManager};
use rand::rngs::OsRng;
use rand::RngCore;
use std::path::PathBuf;
use std::time::{Duration, SystemTime};
use task::{TaskClient, TaskManager};
use tokio::time::interval;
pub(crate) fn init_keypair(config: &Config) -> Result<()> {
+1 -1
View File
@@ -24,12 +24,12 @@ use nym_mixnet_contract_common::{
reward_params::Performance, CurrentIntervalResponse, ExecuteMsg, Interval, MixId,
};
use nym_mixnet_contract_common::{IdentityKey, Layer, LayerAssignment, MixNodeDetails};
use nym_task::{TaskClient, TaskManager};
use rand::prelude::SliceRandom;
use rand::rngs::OsRng;
use std::collections::HashMap;
use std::collections::HashSet;
use std::time::Duration;
use task::{TaskClient, TaskManager};
use tokio::time::sleep;
pub(crate) mod error;
+1 -1
View File
@@ -21,10 +21,10 @@ use log::info;
use logging::setup_logging;
use node_status_api::NodeStatusCache;
use nym_contract_cache::cache::NymContractCache;
use nym_task::TaskManager;
use rand::rngs::OsRng;
use std::error::Error;
use support::{http, nyxd};
use task::TaskManager;
mod circulating_supply_api;
mod coconut;
+1 -1
View File
@@ -20,8 +20,8 @@ use credential_storage::PersistentStorage;
use futures::channel::mpsc;
use gateway_client::bandwidth::BandwidthController;
use nym_crypto::asymmetric::{encryption, identity};
use nym_task::TaskManager;
use std::sync::Arc;
use task::TaskManager;
use validator_client::nyxd::SigningNyxdClient;
pub(crate) mod chunker;
@@ -6,8 +6,8 @@ use crate::network_monitor::monitor::receiver::{GatewayClientUpdate, GatewayClie
use log::{debug, info, trace, warn};
use nym_crypto::asymmetric::identity;
use nym_crypto::asymmetric::identity::PUBLIC_KEY_LENGTH;
use nym_task::TaskClient;
use std::time::Duration;
use task::TaskClient;
use tokio::time::{sleep, Instant};
// TODO: should it perhaps be moved to config along other timeout values?
+1 -1
View File
@@ -10,9 +10,9 @@ use crate::network_monitor::test_route::TestRoute;
use crate::storage::NymApiStorage;
use crate::support::config::Config;
use log::{debug, error, info};
use nym_task::TaskClient;
use std::collections::{HashMap, HashSet};
use std::process;
use task::TaskClient;
use tokio::time::{sleep, Duration, Instant};
pub(crate) mod gateway_clients_cache;
@@ -7,7 +7,7 @@ use futures::channel::mpsc;
use futures::StreamExt;
use gateway_client::{AcknowledgementReceiver, MixnetMessageReceiver};
use nym_crypto::asymmetric::identity;
use task::TaskClient;
use nym_task::TaskClient;
pub(crate) type GatewayClientUpdateSender = mpsc::UnboundedSender<GatewayClientUpdate>;
pub(crate) type GatewayClientUpdateReceiver = mpsc::UnboundedReceiver<GatewayClientUpdate>;
@@ -17,6 +17,7 @@ use gateway_client::{AcknowledgementReceiver, GatewayClient, MixnetMessageReceiv
use log::{debug, info, trace, warn};
use nym_crypto::asymmetric::identity::{self, PUBLIC_KEY_LENGTH};
use nym_sphinx::forwarding::packet::MixPacket;
use nym_task::TaskClient;
use pin_project::pin_project;
use std::mem;
use std::num::NonZeroUsize;
@@ -24,7 +25,6 @@ use std::pin::Pin;
use std::sync::Arc;
use std::task::Poll;
use std::time::Duration;
use task::TaskClient;
use gateway_client::bandwidth::BandwidthController;
use validator_client::nyxd::SigningNyxdClient;
@@ -194,7 +194,7 @@ impl PacketSender {
ack_sender,
fresh_gateway_client_data.gateway_response_timeout,
Some(fresh_gateway_client_data.bandwidth_controller.clone()),
task::TaskClient::dummy(),
nym_task::TaskClient::dummy(),
);
gateway_client
+1 -1
View File
@@ -12,8 +12,8 @@ use crate::{
storage::NymApiStorage,
support::caching::CacheNotification,
};
use nym_task::TaskClient;
use std::time::Duration;
use task::TaskClient;
use tokio::sync::watch;
use tokio::time;
+1 -1
View File
@@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
pub(crate) use cache::NodeStatusCache;
use nym_task::TaskManager;
use okapi::openapi3::OpenApi;
use rocket::Route;
use rocket_okapi::{openapi_get_routes_spec, settings::OpenApiSettings};
use std::time::Duration;
use task::TaskManager;
use crate::{
nym_contract_cache::cache::NymContractCache,
@@ -7,8 +7,8 @@ use crate::node_status_api::models::{
use crate::node_status_api::ONE_DAY;
use crate::storage::NymApiStorage;
use log::error;
use nym_task::{TaskClient, TaskManager};
use std::time::Duration;
use task::{TaskClient, TaskManager};
use time::{OffsetDateTime, PrimitiveDateTime, Time};
use tokio::time::{interval, sleep};
+1 -1
View File
@@ -3,8 +3,8 @@ use crate::nyxd::Client;
use crate::support::caching::CacheNotification;
use anyhow::Result;
use nym_mixnet_contract_common::{MixId, MixNodeDetails, RewardedSetNodeStatus};
use nym_task::TaskClient;
use std::{collections::HashMap, sync::atomic::Ordering, time::Duration};
use task::TaskClient;
use tokio::sync::watch;
use tokio::time;
+1 -1
View File
@@ -4,11 +4,11 @@
use crate::nym_contract_cache::cache::NymContractCache;
use crate::support::config::Config;
use crate::support::{self, nyxd};
use nym_task::TaskManager;
use okapi::openapi3::OpenApi;
use rocket::Route;
use rocket_okapi::openapi_get_routes_spec;
use rocket_okapi::settings::OpenApiSettings;
use task::TaskManager;
use self::cache::refresher::NymContractCacheRefresher;
+174 -175
View File
@@ -644,18 +644,18 @@ dependencies = [
"nonexhaustive-delayqueue",
"nym-crypto",
"nym-pemstore",
"nymsphinx",
"nym-sphinx",
"nym-task",
"nym-topology",
"rand 0.7.3",
"serde",
"serde_json",
"sqlx 0.6.2",
"tap",
"task",
"thiserror",
"time 0.3.18",
"tokio",
"tokio-stream",
"topology",
"url",
"validator-client",
"wasm-bindgen",
@@ -1977,10 +1977,10 @@ dependencies = [
"network-defaults",
"nym-crypto",
"nym-pemstore",
"nymsphinx",
"nym-sphinx",
"nym-task",
"rand 0.7.3",
"serde",
"task",
"thiserror",
"tokio",
"tokio-stream",
@@ -2005,7 +2005,7 @@ dependencies = [
"log",
"nym-crypto",
"nym-pemstore",
"nymsphinx",
"nym-sphinx",
"rand 0.7.3",
"serde",
"serde_json",
@@ -3562,6 +3562,7 @@ dependencies = [
"nym-contracts-common",
"nym-crypto",
"nym-socks5-client",
"nym-task",
"pretty_env_logger",
"rand 0.8.5",
"reqwest",
@@ -3570,14 +3571,12 @@ dependencies = [
"serde_json",
"serde_repr",
"tap",
"task",
"tauri",
"tauri-build",
"tempfile",
"tendermint-rpc",
"thiserror",
"tokio",
"topology",
"ts-rs",
"url",
"yaml-rust",
@@ -3609,7 +3608,7 @@ dependencies = [
"hkdf 0.12.3",
"hmac 0.12.1",
"nym-pemstore",
"nymsphinx-types",
"nym-sphinx-types",
"rand 0.7.3",
"subtle-encoding",
"thiserror",
@@ -3663,7 +3662,10 @@ dependencies = [
"network-defaults",
"nym-crypto",
"nym-pemstore",
"nymsphinx",
"nym-sphinx",
"nym-task",
"nym-topology",
"nym-version-checker",
"ordered-buffer",
"pin-project",
"pretty_env_logger",
@@ -3674,13 +3676,169 @@ dependencies = [
"service-providers-common",
"socks5-requests",
"tap",
"task",
"thiserror",
"tokio",
"topology",
"url",
"validator-client",
"version-checker",
]
[[package]]
name = "nym-sphinx"
version = "0.1.0"
dependencies = [
"nym-crypto",
"nym-sphinx-acknowledgements",
"nym-sphinx-addressing",
"nym-sphinx-anonymous-replies",
"nym-sphinx-chunking",
"nym-sphinx-cover",
"nym-sphinx-forwarding",
"nym-sphinx-framing",
"nym-sphinx-params",
"nym-sphinx-types",
"nym-topology",
"rand 0.7.3",
"rand_distr",
"thiserror",
"tokio",
]
[[package]]
name = "nym-sphinx-acknowledgements"
version = "0.1.0"
dependencies = [
"nym-crypto",
"nym-pemstore",
"nym-sphinx-addressing",
"nym-sphinx-params",
"nym-sphinx-types",
"nym-topology",
"rand 0.7.3",
"thiserror",
]
[[package]]
name = "nym-sphinx-addressing"
version = "0.1.0"
dependencies = [
"nym-crypto",
"nym-sphinx-types",
"serde",
"thiserror",
]
[[package]]
name = "nym-sphinx-anonymous-replies"
version = "0.1.0"
dependencies = [
"bs58",
"nym-crypto",
"nym-sphinx-addressing",
"nym-sphinx-params",
"nym-sphinx-types",
"nym-topology",
"rand 0.7.3",
"serde",
"thiserror",
"wasm-bindgen",
]
[[package]]
name = "nym-sphinx-chunking"
version = "0.1.0"
dependencies = [
"log",
"nym-sphinx-addressing",
"nym-sphinx-params",
"nym-sphinx-types",
"rand 0.7.3",
"thiserror",
]
[[package]]
name = "nym-sphinx-cover"
version = "0.1.0"
dependencies = [
"nym-crypto",
"nym-sphinx-acknowledgements",
"nym-sphinx-addressing",
"nym-sphinx-chunking",
"nym-sphinx-forwarding",
"nym-sphinx-params",
"nym-sphinx-types",
"nym-topology",
"rand 0.7.3",
"thiserror",
]
[[package]]
name = "nym-sphinx-forwarding"
version = "0.1.0"
dependencies = [
"nym-sphinx-addressing",
"nym-sphinx-params",
"nym-sphinx-types",
]
[[package]]
name = "nym-sphinx-framing"
version = "0.1.0"
dependencies = [
"bytes",
"nym-sphinx-params",
"nym-sphinx-types",
"thiserror",
"tokio-util",
]
[[package]]
name = "nym-sphinx-params"
version = "0.1.0"
dependencies = [
"nym-crypto",
"nym-sphinx-types",
"thiserror",
]
[[package]]
name = "nym-sphinx-types"
version = "0.1.0"
dependencies = [
"sphinx",
]
[[package]]
name = "nym-task"
version = "0.1.0"
dependencies = [
"futures",
"log",
"thiserror",
"tokio",
"wasm-bindgen",
"wasm-bindgen-futures",
]
[[package]]
name = "nym-topology"
version = "0.1.0"
dependencies = [
"bs58",
"log",
"nym-crypto",
"nym-mixnet-contract-common",
"nym-sphinx-addressing",
"nym-sphinx-types",
"nym-version-checker",
"rand 0.7.3",
"thiserror",
]
[[package]]
name = "nym-version-checker"
version = "0.1.0"
dependencies = [
"semver 0.11.0",
]
[[package]]
@@ -3729,131 +3887,6 @@ dependencies = [
"thiserror",
]
[[package]]
name = "nymsphinx"
version = "0.1.0"
dependencies = [
"nym-crypto",
"nymsphinx-acknowledgements",
"nymsphinx-addressing",
"nymsphinx-anonymous-replies",
"nymsphinx-chunking",
"nymsphinx-cover",
"nymsphinx-forwarding",
"nymsphinx-framing",
"nymsphinx-params",
"nymsphinx-types",
"rand 0.7.3",
"rand_distr",
"thiserror",
"tokio",
"topology",
]
[[package]]
name = "nymsphinx-acknowledgements"
version = "0.1.0"
dependencies = [
"nym-crypto",
"nym-pemstore",
"nymsphinx-addressing",
"nymsphinx-params",
"nymsphinx-types",
"rand 0.7.3",
"thiserror",
"topology",
]
[[package]]
name = "nymsphinx-addressing"
version = "0.1.0"
dependencies = [
"nym-crypto",
"nymsphinx-types",
"serde",
"thiserror",
]
[[package]]
name = "nymsphinx-anonymous-replies"
version = "0.1.0"
dependencies = [
"bs58",
"nym-crypto",
"nymsphinx-addressing",
"nymsphinx-params",
"nymsphinx-types",
"rand 0.7.3",
"serde",
"thiserror",
"topology",
"wasm-bindgen",
]
[[package]]
name = "nymsphinx-chunking"
version = "0.1.0"
dependencies = [
"log",
"nymsphinx-addressing",
"nymsphinx-params",
"nymsphinx-types",
"rand 0.7.3",
"thiserror",
]
[[package]]
name = "nymsphinx-cover"
version = "0.1.0"
dependencies = [
"nym-crypto",
"nymsphinx-acknowledgements",
"nymsphinx-addressing",
"nymsphinx-chunking",
"nymsphinx-forwarding",
"nymsphinx-params",
"nymsphinx-types",
"rand 0.7.3",
"thiserror",
"topology",
]
[[package]]
name = "nymsphinx-forwarding"
version = "0.1.0"
dependencies = [
"nymsphinx-addressing",
"nymsphinx-params",
"nymsphinx-types",
]
[[package]]
name = "nymsphinx-framing"
version = "0.1.0"
dependencies = [
"bytes",
"nymsphinx-params",
"nymsphinx-types",
"thiserror",
"tokio-util",
]
[[package]]
name = "nymsphinx-params"
version = "0.1.0"
dependencies = [
"nym-crypto",
"nymsphinx-types",
"thiserror",
]
[[package]]
name = "nymsphinx-types"
version = "0.1.0"
dependencies = [
"sphinx",
]
[[package]]
name = "objc"
version = "0.2.7"
@@ -4482,9 +4515,9 @@ dependencies = [
"client-connections",
"futures",
"log",
"nym-task",
"ordered-buffer",
"socks5-requests",
"task",
"tokio",
"tokio-util",
]
@@ -5331,7 +5364,7 @@ dependencies = [
"async-trait",
"build-information",
"log",
"nymsphinx-anonymous-replies",
"nym-sphinx-anonymous-replies",
"serde",
"serde_json",
"thiserror",
@@ -5479,7 +5512,7 @@ dependencies = [
name = "socks5-requests"
version = "0.1.0"
dependencies = [
"nymsphinx-addressing",
"nym-sphinx-addressing",
"serde",
"serde_json",
"service-providers-common",
@@ -5981,18 +6014,6 @@ dependencies = [
"xattr",
]
[[package]]
name = "task"
version = "0.1.0"
dependencies = [
"futures",
"log",
"thiserror",
"tokio",
"wasm-bindgen",
"wasm-bindgen-futures",
]
[[package]]
name = "tauri"
version = "2.0.0-alpha.3"
@@ -6527,21 +6548,6 @@ dependencies = [
"toml_datetime",
]
[[package]]
name = "topology"
version = "0.1.0"
dependencies = [
"bs58",
"log",
"nym-crypto",
"nym-mixnet-contract-common",
"nymsphinx-addressing",
"nymsphinx-types",
"rand 0.7.3",
"thiserror",
"version-checker",
]
[[package]]
name = "tower-service"
version = "0.3.2"
@@ -6867,13 +6873,6 @@ dependencies = [
"time 0.3.18",
]
[[package]]
name = "version-checker"
version = "0.1.0"
dependencies = [
"semver 0.11.0",
]
[[package]]
name = "version-compare"
version = "0.1.1"
+1 -1
View File
@@ -53,7 +53,7 @@ config-common = { path = "../../common/config", package = "config" }
nym-crypto = { path = "../../common/crypto" }
logging = { path = "../../common/logging"}
nym-socks5-client = { path = "../../clients/socks5", features = ["mobile"], default-features = false }
task = { path = "../../common/task" }
nym-task = { path = "../../common/task" }
[dev-dependencies]
ts-rs = "6.1.2"
+1 -1
View File
@@ -1,7 +1,7 @@
use std::sync::Arc;
use client_core::error::ClientCoreStatusMessage;
use task::manager::TaskStatus;
use nym_task::manager::TaskStatus;
use tauri::async_runtime::RwLock;
use crate::{
+2 -2
View File
@@ -171,7 +171,7 @@ impl State {
pub async fn start_connecting(
&mut self,
window: &tauri::Window<tauri::Wry>,
) -> Result<(task::StatusReceiver, ExitStatusReceiver)> {
) -> Result<(nym_task::StatusReceiver, ExitStatusReceiver)> {
self.set_state(ConnectionStatusKind::Connecting, window);
let res = self.init_config().await;
@@ -214,7 +214,7 @@ impl State {
&mut self,
config: Config,
keys: KeyManager,
) -> Result<(task::StatusReceiver, ExitStatusReceiver)> {
) -> Result<(nym_task::StatusReceiver, ExitStatusReceiver)> {
let id = self.get_config_id()?;
let (control_tx, msg_rx, exit_status_rx, used_gateway) =
tasks::start_nym_socks5_client(&id, config, keys)?;
+3 -3
View File
@@ -4,9 +4,9 @@ use client_core::{
error::ClientCoreStatusMessage,
};
use futures::{channel::mpsc, StreamExt};
use nym_task::manager::TaskStatus;
use std::sync::Arc;
use tap::TapFallible;
use task::manager::TaskStatus;
use tokio::sync::RwLock;
use config_common::NymConfig;
@@ -40,7 +40,7 @@ pub fn start_nym_socks5_client(
keys: KeyManager,
) -> Result<(
Socks5ControlMessageSender,
task::StatusReceiver,
nym_task::StatusReceiver,
ExitStatusReceiver,
GatewayEndpointConfig,
)> {
@@ -138,7 +138,7 @@ pub fn start_connection_check(state: Arc<RwLock<State>>, window: tauri::Window<t
pub fn start_status_listener(
state: Arc<RwLock<State>>,
window: tauri::Window<tauri::Wry>,
mut msg_receiver: task::StatusReceiver,
mut msg_receiver: nym_task::StatusReceiver,
) {
log::info!("Starting status listener");
+1 -1
View File
@@ -51,7 +51,7 @@ config-common = { path = "../../common/config", package = "config" }
nym-crypto = { path = "../../common/crypto" }
logging = { path = "../../common/logging"}
nym-socks5-client = { path = "../../clients/socks5" }
task = { path = "../../common/task" }
nym-task = { path = "../../common/task" }
[dev-dependencies]
ts-rs = "6.1.2"
+1 -1
View File
@@ -1,7 +1,7 @@
use std::sync::Arc;
use client_core::error::ClientCoreStatusMessage;
use task::manager::TaskStatus;
use nym_task::manager::TaskStatus;
use tauri::async_runtime::RwLock;
use crate::{
+4 -2
View File
@@ -164,7 +164,7 @@ impl State {
pub async fn start_connecting(
&mut self,
window: &tauri::Window<tauri::Wry>,
) -> Result<(task::StatusReceiver, ExitStatusReceiver)> {
) -> Result<(nym_task::StatusReceiver, ExitStatusReceiver)> {
self.set_state(ConnectionStatusKind::Connecting, window);
// Setup configuration by writing to file
@@ -199,7 +199,9 @@ impl State {
}
/// Spawn a new thread running the SOCKS5 client
fn start_nym_socks5_client(&mut self) -> Result<(task::StatusReceiver, ExitStatusReceiver)> {
fn start_nym_socks5_client(
&mut self,
) -> Result<(nym_task::StatusReceiver, ExitStatusReceiver)> {
let id = self.get_config_id()?;
let (control_tx, msg_rx, exit_status_rx, used_gateway) =
tasks::start_nym_socks5_client(&id)?;
+3 -3
View File
@@ -3,9 +3,9 @@ use client_core::{
error::ClientCoreStatusMessage,
};
use futures::{channel::mpsc, StreamExt};
use nym_task::manager::TaskStatus;
use std::sync::Arc;
use tap::TapFallible;
use task::manager::TaskStatus;
use tokio::sync::RwLock;
use config_common::NymConfig;
@@ -36,7 +36,7 @@ pub fn start_nym_socks5_client(
id: &str,
) -> Result<(
Socks5ControlMessageSender,
task::StatusReceiver,
nym_task::StatusReceiver,
ExitStatusReceiver,
GatewayEndpointConfig,
)> {
@@ -136,7 +136,7 @@ pub fn start_connection_check(state: Arc<RwLock<State>>, window: tauri::Window<t
pub fn start_status_listener(
state: Arc<RwLock<State>>,
window: tauri::Window<tauri::Wry>,
mut msg_receiver: task::StatusReceiver,
mut msg_receiver: nym_task::StatusReceiver,
) {
log::info!("Starting status listener");
+1 -1
View File
@@ -13,7 +13,7 @@ gateway-client = { path = "../../../common/client-libs/gateway-client" }
gateway-requests = { path = "../../../gateway/gateway-requests" }
network-defaults = { path = "../../../common/network-defaults" }
nym-sphinx = { path = "../../../common/nymsphinx" }
task = { path = "../../../common/task" }
nym-task = { path = "../../../common/task" }
validator-client = { path = "../../../common/client-libs/validator-client", features = ["nyxd-client"] }
futures = "0.3"
+1 -1
View File
@@ -18,7 +18,7 @@ use nym_sphinx::{
addressing::clients::{ClientIdentity, Recipient},
receiver::ReconstructedMessage,
};
use task::TaskManager;
use nym_task::TaskManager;
use futures::StreamExt;
use validator_client::nyxd::SigningNyxdClient;
@@ -46,6 +46,6 @@ proxy-helpers = { path = "../../common/socks5/proxy-helpers" }
service-providers-common = { path = "../common" }
socks5-requests = { path = "../../common/socks5/requests" }
statistics-common = { path = "../../common/statistics" }
task = { path = "../../common/task" }
nym-task = { path = "../../common/task" }
nym-version-checker = { path = "../../common/version-checker" }
websocket-requests = { path = "../../clients/native/websocket-requests" }
@@ -15,6 +15,7 @@ use futures::channel::mpsc;
use log::warn;
use nym_sphinx::addressing::clients::Recipient;
use nym_sphinx::anonymous_replies::requests::AnonymousSenderTag;
use nym_task::{TaskClient, TaskManager};
use proxy_helpers::connection_controller::{Controller, ControllerCommand, ControllerSender};
use proxy_helpers::proxy_runner::{MixProxyReader, MixProxySender};
use service_providers_common::interface::{
@@ -28,7 +29,6 @@ use socks5_requests::{
use statistics_common::collector::StatisticsSender;
use std::path::PathBuf;
use std::sync::atomic::{AtomicUsize, Ordering};
use task::{TaskClient, TaskManager};
// Since it's an atomic, it's safe to be kept static and shared across threads
static ACTIVE_PROXIES: AtomicUsize = AtomicUsize::new(0);
@@ -188,7 +188,7 @@ impl NRServiceProviderBuilder {
let (mix_input_sender, mix_input_receiver) = tokio::sync::mpsc::channel::<MixnetMessage>(1);
// Used to notify tasks to shutdown. Not all tasks fully supports this (yet).
let shutdown = task::TaskManager::default();
let shutdown = nym_task::TaskManager::default();
// Controller for managing all active connections.
let (mut active_connections_controller, controller_sender) = Controller::new(
@@ -4,12 +4,12 @@
use crate::reply;
use crate::reply::MixnetMessage;
use client_connections::LaneQueueLengths;
use nym_task::TaskClient;
use proxy_helpers::connection_controller::ConnectionReceiver;
use proxy_helpers::proxy_runner::{MixProxySender, ProxyRunner};
use service_providers_common::interface::RequestVersion;
use socks5_requests::{ConnectionId, RemoteAddress, Socks5Request};
use std::io;
use task::TaskClient;
use tokio::net::TcpStream;
/// An outbound TCP connection between the Socks5 service provider, which makes