Skip to main content

Module client

Module client 

Source
Expand description

A general interface for Tor client usage.

To construct a client, run the TorClient::create_bootstrapped method. Once the client is bootstrapped, you can make anonymous connections (β€œstreams”) over the Tor network using TorClient::connect.

Re-exportsΒ§

use derive_deftly::Deftly; πŸ”’
use crate::address::IntoTorAddr; πŸ”’
use crate::address::ResolveInstructions; πŸ”’
use crate::address::StreamInstructions; πŸ”’
use crate::config::ClientAddrConfig; πŸ”’
use crate::config::StreamTimeoutConfig; πŸ”’
use crate::config::TorClientConfig; πŸ”’
use crate::status::BootstrapStatus; πŸ”’
use safelog::Sensitive; πŸ”’
use safelog::sensitive; πŸ”’
use tor_async_utils::DropNotifyWatchSender; πŸ”’
use tor_async_utils::PostageWatchSenderExt; πŸ”’
use tor_chanmgr::ChanMgrConfig; πŸ”’
use tor_circmgr::ClientDataTunnel; πŸ”’
use tor_circmgr::isolation::Isolation; πŸ”’
use tor_circmgr::isolation::StreamIsolation; πŸ”’
use tor_circmgr::IsolationToken; πŸ”’
use tor_circmgr::TargetPort; πŸ”’
use tor_circmgr::isolation::StreamIsolationBuilder; πŸ”’
use tor_config::BoolOrAuto; πŸ”’
use tor_config::MutCfg; πŸ”’
use tor_dirmgr::bridgedesc::BridgeDescMgr; πŸ”’
use tor_dirmgr::DirMgrStore; πŸ”’
use tor_dirmgr::Timeliness; πŸ”’
use tor_error::Bug; πŸ”’
use tor_error::error_report; πŸ”’
use tor_error::internal; πŸ”’
use tor_guardmgr::GuardMgr; πŸ”’
use tor_guardmgr::RetireCircuits; πŸ”’
use tor_keymgr::Keystore; πŸ”’
use tor_memquota::MemoryQuotaTracker; πŸ”’
use tor_netdir::NetDirProvider; πŸ”’
use tor_netdir::params::NetParameters; πŸ”’
use tor_persist::StateMgr; πŸ”’
use tor_proto::client::stream::DataStream; πŸ”’
use tor_proto::client::stream::IpVersionPreference; πŸ”’
use tor_proto::client::stream::StreamParameters; πŸ”’
use tor_rtcompat::PreferredRuntime; πŸ”’
use tor_rtcompat::Runtime; πŸ”’
use tor_rtcompat::SleepProviderExt; πŸ”’
use tor_hsclient::HsClientConnector; πŸ”’
use tor_hsclient::HsClientDescEncKeypairSpecifier; πŸ”’
use tor_hsclient::HsClientSecretKeysBuilder; πŸ”’
use tor_hscrypto::pk::HsClientDescEncKey; πŸ”’
use tor_hscrypto::pk::HsClientDescEncKeypair; πŸ”’
use tor_hscrypto::pk::HsClientDescEncSecretKey; πŸ”’
use tor_keymgr::CTorClientKeystore; πŸ”’
use tor_netdir::DirEvent; πŸ”’
use tor_keymgr::CTorServiceKeystore; πŸ”’
use tor_persist::state_dir::StateDirectory; πŸ”’
use tor_hsservice::HsIdKeypairSpecifier; πŸ”’
use tor_hscrypto::pk::HsId; πŸ”’
use tor_hscrypto::pk::HsIdKeypair; πŸ”’
use tor_keymgr::KeystoreSelector; πŸ”’
use tor_keymgr::ArtiNativeKeystore; πŸ”’
use tor_keymgr::KeyMgr; πŸ”’
use tor_keymgr::KeyMgrBuilder; πŸ”’
use tor_keymgr::config::ArtiKeystoreKind; πŸ”’
use tor_keymgr::ArtiEphemeralKeystore; πŸ”’
use futures::StreamExt as _; πŸ”’
use futures::lock::Mutex as AsyncMutex; πŸ”’
use std::net::IpAddr; πŸ”’
use std::result::Result as StdResult; πŸ”’
use std::sync::Arc; πŸ”’
use std::sync::Mutex; πŸ”’
use tor_rtcompat::SpawnExt; πŸ”’
use crate::err::ErrorDetail; πŸ”’
use crate::TorClientBuilder; πŸ”’
use crate::status; πŸ”’
use crate::util; πŸ”’
use tor_geoip::CountryCode; πŸ”’
use tor_rtcompat::scheduler::TaskHandle; πŸ”’
use tracing::debug; πŸ”’
use tracing::info; πŸ”’
use tracing::instrument; πŸ”’
use tracing::instrument; πŸ”’
use tracing::warn; πŸ”’
use tor_persist::FsStateMgr as UsingStateMgr; πŸ”’
use tor_rpcbase::templates::*; πŸ”’

StructsΒ§

BootstrapSetting πŸ”’
A representation of whether a TorClient is allowed to bootstrap, and whether it has begun to do so.
ClientShared πŸ”’
Shared pieces of a TorClient, used to implement client functionality.
InertTorClient
A Tor client that is not runnable.
NotConstructedInner πŸ”’
Information stored by a never-bootstrapped TorClient, used to eventually construct a RunningInner and bootstrap.
RunningInner πŸ”’
Data structures for a β€œrunning” client.
StreamPrefs
Preferences for how to route a stream over the Tor network.
TorClient
An active client session on the Tor network.

EnumsΒ§

BootstrapBehavior
Preferences for whether a TorClient should bootstrap on its own or not.
DormantMode
What level of sleep to put a Tor client into.
Inner πŸ”’
A typestate object holding the parts of the client state that we may or may not have depending on whether we are running.
StreamIsolationPreference πŸ”’
Record of how we are isolating connections

FunctionsΒ§

tasks_monitor_dormant πŸ”’
Monitor dormant_mode and enable/disable periodic tasks as applicable
wrap_err πŸ”’
Alias for TorError::from(Error)