Loading Cargo.lock +48 −0 Original line number Diff line number Diff line Loading @@ -127,6 +127,7 @@ dependencies = [ "derive_builder", "derive_more", "directories", "educe", "futures", "humantime-serde", "once_cell", Loading @@ -137,6 +138,7 @@ dependencies = [ "thiserror", "tokio", "tokio-util", "tor-basic-utils", "tor-chanmgr", "tor-circmgr", "tor-config", Loading Loading @@ -172,6 +174,7 @@ version = "0.1.0" dependencies = [ "anyhow", "arti-client", "educe", "hyper", "pin-project", "thiserror", Loading Loading @@ -999,12 +1002,37 @@ dependencies = [ "zeroize", ] [[package]] name = "educe" version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f86b50932a01e7ec5c06160492ab660fb19b6bb2a7878030dd6cd68d21df9d4d" dependencies = [ "enum-ordinalize", "proc-macro2", "quote", "syn", ] [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "enum-ordinalize" version = "3.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b166c9e378360dd5a6666a9604bb4f54ae0cac39023ffbac425e917a2a04fef" dependencies = [ "num-bigint", "num-traits", "proc-macro2", "quote", "syn", ] [[package]] name = "env_logger" version = "0.5.13" Loading Loading @@ -3065,6 +3093,13 @@ dependencies = [ "serde", ] [[package]] name = "tor-basic-utils" version = "0.1.0" dependencies = [ "educe", ] [[package]] name = "tor-bytes" version = "0.1.0" Loading @@ -3089,10 +3124,12 @@ dependencies = [ "bitflags", "bytes", "caret", "educe", "hex", "hex-literal", "rand 0.8.5", "thiserror", "tor-basic-utils", "tor-bytes", "tor-cert", "tor-error", Loading Loading @@ -3120,6 +3157,7 @@ version = "0.1.0" dependencies = [ "async-trait", "derive_more", "educe", "float_eq", "futures", "futures-await-test", Loading @@ -3127,6 +3165,7 @@ dependencies = [ "postage", "rand 0.8.5", "thiserror", "tor-basic-utils", "tor-error", "tor-linkspec", "tor-llcrypto", Loading @@ -3152,6 +3191,7 @@ dependencies = [ "async-trait", "bounded-vec-deque", "derive_builder", "educe", "futures", "futures-await-test", "humantime-serde", Loading @@ -3162,6 +3202,7 @@ dependencies = [ "serde", "static_assertions", "thiserror", "tor-basic-utils", "tor-chanmgr", "tor-config", "tor-error", Loading Loading @@ -3237,6 +3278,7 @@ dependencies = [ "derive_builder", "derive_more", "digest 0.10.3", "educe", "event-listener", "float_eq", "fslock", Loading @@ -3257,6 +3299,7 @@ dependencies = [ "tempfile", "thiserror", "time", "tor-basic-utils", "tor-checkable", "tor-circmgr", "tor-config", Loading Loading @@ -3298,6 +3341,7 @@ name = "tor-guardmgr" version = "0.1.0" dependencies = [ "derive_builder", "educe", "futures", "humantime-serde", "itertools", Loading @@ -3306,6 +3350,7 @@ dependencies = [ "retain_mut", "serde", "thiserror", "tor-basic-utils", "tor-config", "tor-error", "tor-linkspec", Loading Loading @@ -3435,6 +3480,7 @@ dependencies = [ "cipher", "coarsetime", "digest 0.10.3", "educe", "futures", "generic-array", "hex", Loading @@ -3447,6 +3493,7 @@ dependencies = [ "thiserror", "tokio", "tokio-util", "tor-basic-utils", "tor-bytes", "tor-cell", "tor-cert", Loading Loading @@ -3479,6 +3526,7 @@ dependencies = [ "async-std", "async-trait", "async_executors", "educe", "futures", "native-tls", "pin-project", Loading Cargo.toml +1 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ # Please keep this list toplogically sorted by dependency relation, so # that every crate appears _before_ any other crate that depends on it. members = [ "crates/tor-basic-utils", "crates/caret", "crates/retry-error", "crates/tor-error", Loading crates/arti-client/Cargo.toml +2 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ error_detail = [ ] experimental-api = [] [dependencies] tor-basic-utils = { path="../tor-basic-utils", version = "0.1.0"} tor-circmgr = { path="../tor-circmgr", version = "0.1.0"} tor-config = { path="../tor-config", version = "0.1.0"} tor-chanmgr = { path="../tor-chanmgr", version = "0.1.0"} Loading @@ -41,6 +42,7 @@ humantime-serde = "1" derive_builder = "0.10" derive_more = "0.99" directories = "4" educe = "0.4.6" futures = "0.3.14" postage = { version = "0.4", default-features = false, features = ["futures-traits"] } tracing = "0.1.18" Loading crates/arti-client/src/client.rs +7 −14 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ use tor_proto::circuit::ClientCirc; use tor_proto::stream::{DataStream, IpVersionPreference, StreamParameters}; use tor_rtcompat::{PreferredRuntime, Runtime, SleepProviderExt}; use educe::Educe; use futures::lock::Mutex as AsyncMutex; use futures::stream::StreamExt; use futures::task::SpawnExt; Loading Loading @@ -84,11 +85,13 @@ pub struct TorClient<R: Runtime> { } /// Preferences for whether a [`TorClient`] should bootstrap on its own or not. #[derive(Debug, Copy, Clone, PartialEq, Eq)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Educe)] #[educe(Default)] #[non_exhaustive] pub enum BootstrapBehavior { /// Bootstrap the client automatically when requests are made that require the client to be /// bootstrapped. #[educe(Default)] OnDemand, /// Make no attempts to automatically bootstrap. [`TorClient::bootstrap`] must be manually /// invoked in order for the [`TorClient`] to become useful. Loading @@ -99,12 +102,6 @@ pub enum BootstrapBehavior { Manual, } impl Default for BootstrapBehavior { fn default() -> Self { BootstrapBehavior::OnDemand } } /// Preferences for how to route a stream over the Tor network. #[derive(Debug, Clone, Default)] pub struct StreamPrefs { Loading @@ -117,9 +114,11 @@ pub struct StreamPrefs { } /// Record of how we are isolating connections #[derive(Debug, Clone)] #[derive(Debug, Clone, Educe)] #[educe(Default)] enum StreamIsolationPreference { /// No additional isolation #[educe(Default)] None, /// Id of the isolation group the connection should be part of Explicit(IsolationToken), Loading @@ -127,12 +126,6 @@ enum StreamIsolationPreference { EveryStream, } impl Default for StreamIsolationPreference { fn default() -> Self { StreamIsolationPreference::None } } impl StreamPrefs { /// Construct a new StreamPrefs. pub fn new() -> Self { Loading crates/arti-client/src/status.rs +5 −9 Original line number Diff line number Diff line Loading @@ -4,7 +4,9 @@ use std::{borrow::Cow, fmt, time::SystemTime}; use derive_more::Display; use educe::Educe; use futures::{Stream, StreamExt}; use tor_basic_utils::skip_fmt; use tor_chanmgr::{ConnBlockage, ConnStatus, ConnStatusEvents}; use tor_dirmgr::DirBootstrapStatus; use tracing::debug; Loading Loading @@ -189,20 +191,14 @@ pub(crate) async fn report_status( // implementation type. We do that because we might want to change the type in // the future, and because some of the functionality exposed by Receiver (like // `borrow()` and the postage::Stream trait) are extraneous to the API we want. #[derive(Clone)] #[derive(Clone, Educe)] #[educe(Debug)] pub struct BootstrapEvents { /// The receiver that implements this stream. #[educe(Debug(method = "skip_fmt"))] pub(crate) inner: postage::watch::Receiver<BootstrapStatus>, } // We can't derive(Debug) since postage::watch::Receiver doesn't implement // Debug. impl std::fmt::Debug for BootstrapEvents { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("BootstrapEvents").finish_non_exhaustive() } } impl Stream for BootstrapEvents { type Item = BootstrapStatus; Loading Loading
Cargo.lock +48 −0 Original line number Diff line number Diff line Loading @@ -127,6 +127,7 @@ dependencies = [ "derive_builder", "derive_more", "directories", "educe", "futures", "humantime-serde", "once_cell", Loading @@ -137,6 +138,7 @@ dependencies = [ "thiserror", "tokio", "tokio-util", "tor-basic-utils", "tor-chanmgr", "tor-circmgr", "tor-config", Loading Loading @@ -172,6 +174,7 @@ version = "0.1.0" dependencies = [ "anyhow", "arti-client", "educe", "hyper", "pin-project", "thiserror", Loading Loading @@ -999,12 +1002,37 @@ dependencies = [ "zeroize", ] [[package]] name = "educe" version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f86b50932a01e7ec5c06160492ab660fb19b6bb2a7878030dd6cd68d21df9d4d" dependencies = [ "enum-ordinalize", "proc-macro2", "quote", "syn", ] [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "enum-ordinalize" version = "3.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b166c9e378360dd5a6666a9604bb4f54ae0cac39023ffbac425e917a2a04fef" dependencies = [ "num-bigint", "num-traits", "proc-macro2", "quote", "syn", ] [[package]] name = "env_logger" version = "0.5.13" Loading Loading @@ -3065,6 +3093,13 @@ dependencies = [ "serde", ] [[package]] name = "tor-basic-utils" version = "0.1.0" dependencies = [ "educe", ] [[package]] name = "tor-bytes" version = "0.1.0" Loading @@ -3089,10 +3124,12 @@ dependencies = [ "bitflags", "bytes", "caret", "educe", "hex", "hex-literal", "rand 0.8.5", "thiserror", "tor-basic-utils", "tor-bytes", "tor-cert", "tor-error", Loading Loading @@ -3120,6 +3157,7 @@ version = "0.1.0" dependencies = [ "async-trait", "derive_more", "educe", "float_eq", "futures", "futures-await-test", Loading @@ -3127,6 +3165,7 @@ dependencies = [ "postage", "rand 0.8.5", "thiserror", "tor-basic-utils", "tor-error", "tor-linkspec", "tor-llcrypto", Loading @@ -3152,6 +3191,7 @@ dependencies = [ "async-trait", "bounded-vec-deque", "derive_builder", "educe", "futures", "futures-await-test", "humantime-serde", Loading @@ -3162,6 +3202,7 @@ dependencies = [ "serde", "static_assertions", "thiserror", "tor-basic-utils", "tor-chanmgr", "tor-config", "tor-error", Loading Loading @@ -3237,6 +3278,7 @@ dependencies = [ "derive_builder", "derive_more", "digest 0.10.3", "educe", "event-listener", "float_eq", "fslock", Loading @@ -3257,6 +3299,7 @@ dependencies = [ "tempfile", "thiserror", "time", "tor-basic-utils", "tor-checkable", "tor-circmgr", "tor-config", Loading Loading @@ -3298,6 +3341,7 @@ name = "tor-guardmgr" version = "0.1.0" dependencies = [ "derive_builder", "educe", "futures", "humantime-serde", "itertools", Loading @@ -3306,6 +3350,7 @@ dependencies = [ "retain_mut", "serde", "thiserror", "tor-basic-utils", "tor-config", "tor-error", "tor-linkspec", Loading Loading @@ -3435,6 +3480,7 @@ dependencies = [ "cipher", "coarsetime", "digest 0.10.3", "educe", "futures", "generic-array", "hex", Loading @@ -3447,6 +3493,7 @@ dependencies = [ "thiserror", "tokio", "tokio-util", "tor-basic-utils", "tor-bytes", "tor-cell", "tor-cert", Loading Loading @@ -3479,6 +3526,7 @@ dependencies = [ "async-std", "async-trait", "async_executors", "educe", "futures", "native-tls", "pin-project", Loading
Cargo.toml +1 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ # Please keep this list toplogically sorted by dependency relation, so # that every crate appears _before_ any other crate that depends on it. members = [ "crates/tor-basic-utils", "crates/caret", "crates/retry-error", "crates/tor-error", Loading
crates/arti-client/Cargo.toml +2 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ error_detail = [ ] experimental-api = [] [dependencies] tor-basic-utils = { path="../tor-basic-utils", version = "0.1.0"} tor-circmgr = { path="../tor-circmgr", version = "0.1.0"} tor-config = { path="../tor-config", version = "0.1.0"} tor-chanmgr = { path="../tor-chanmgr", version = "0.1.0"} Loading @@ -41,6 +42,7 @@ humantime-serde = "1" derive_builder = "0.10" derive_more = "0.99" directories = "4" educe = "0.4.6" futures = "0.3.14" postage = { version = "0.4", default-features = false, features = ["futures-traits"] } tracing = "0.1.18" Loading
crates/arti-client/src/client.rs +7 −14 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ use tor_proto::circuit::ClientCirc; use tor_proto::stream::{DataStream, IpVersionPreference, StreamParameters}; use tor_rtcompat::{PreferredRuntime, Runtime, SleepProviderExt}; use educe::Educe; use futures::lock::Mutex as AsyncMutex; use futures::stream::StreamExt; use futures::task::SpawnExt; Loading Loading @@ -84,11 +85,13 @@ pub struct TorClient<R: Runtime> { } /// Preferences for whether a [`TorClient`] should bootstrap on its own or not. #[derive(Debug, Copy, Clone, PartialEq, Eq)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Educe)] #[educe(Default)] #[non_exhaustive] pub enum BootstrapBehavior { /// Bootstrap the client automatically when requests are made that require the client to be /// bootstrapped. #[educe(Default)] OnDemand, /// Make no attempts to automatically bootstrap. [`TorClient::bootstrap`] must be manually /// invoked in order for the [`TorClient`] to become useful. Loading @@ -99,12 +102,6 @@ pub enum BootstrapBehavior { Manual, } impl Default for BootstrapBehavior { fn default() -> Self { BootstrapBehavior::OnDemand } } /// Preferences for how to route a stream over the Tor network. #[derive(Debug, Clone, Default)] pub struct StreamPrefs { Loading @@ -117,9 +114,11 @@ pub struct StreamPrefs { } /// Record of how we are isolating connections #[derive(Debug, Clone)] #[derive(Debug, Clone, Educe)] #[educe(Default)] enum StreamIsolationPreference { /// No additional isolation #[educe(Default)] None, /// Id of the isolation group the connection should be part of Explicit(IsolationToken), Loading @@ -127,12 +126,6 @@ enum StreamIsolationPreference { EveryStream, } impl Default for StreamIsolationPreference { fn default() -> Self { StreamIsolationPreference::None } } impl StreamPrefs { /// Construct a new StreamPrefs. pub fn new() -> Self { Loading
crates/arti-client/src/status.rs +5 −9 Original line number Diff line number Diff line Loading @@ -4,7 +4,9 @@ use std::{borrow::Cow, fmt, time::SystemTime}; use derive_more::Display; use educe::Educe; use futures::{Stream, StreamExt}; use tor_basic_utils::skip_fmt; use tor_chanmgr::{ConnBlockage, ConnStatus, ConnStatusEvents}; use tor_dirmgr::DirBootstrapStatus; use tracing::debug; Loading Loading @@ -189,20 +191,14 @@ pub(crate) async fn report_status( // implementation type. We do that because we might want to change the type in // the future, and because some of the functionality exposed by Receiver (like // `borrow()` and the postage::Stream trait) are extraneous to the API we want. #[derive(Clone)] #[derive(Clone, Educe)] #[educe(Debug)] pub struct BootstrapEvents { /// The receiver that implements this stream. #[educe(Debug(method = "skip_fmt"))] pub(crate) inner: postage::watch::Receiver<BootstrapStatus>, } // We can't derive(Debug) since postage::watch::Receiver doesn't implement // Debug. impl std::fmt::Debug for BootstrapEvents { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("BootstrapEvents").finish_non_exhaustive() } } impl Stream for BootstrapEvents { type Item = BootstrapStatus; Loading