Expand description
§tor-dirmgr
Code to fetch, store, and update Tor directory information.
§Overview
This crate is part of Arti, a project to implement Tor in Rust.
In its current design, Tor requires a set of up-to-date authenticated directory documents in order to build multi-hop anonymized circuits through the network.
This directory manager crate is responsible for figuring out which directory information we lack, downloading what we’re missing, and keeping a cache of it on disk.
§Compile-time features
-
mmap(default) – Use memory mapping to reduce the memory load for reading large directory objects from disk. -
routerdesc– (Incomplete) support for downloading and storing router descriptors. -
compression(default) – Build support for downloading compressed documents. Requires a C compiler. -
bridge-client: Provide APIs used to fetch and use bridge information. -
full– Enable all features above.
§Non-additive features
static– Try to link with a static copy of sqlite3.
§Experimental and unstable features
Note that the APIs enabled by these features are NOT covered by semantic versioning1 guarantees: we might break them or remove them between patch versions.
-
experimental-api: Add additional non-stable APIs to our public interfaces. -
dirfilter: enable an experimental mechanism to modify incoming directory information before it is used. -
experimental: Enable all the above experimental features.
License: MIT OR Apache-2.0
Remember, semantic versioning is what makes various
cargofeatures work reliably. To be explicit: if you wantcargo updateto only make safe changes, then you cannot enable these features. ↩
Re-exports§
pub(crate) use crate::docid::CacheUsage;🔒pub(crate) use crate::docid::ClientRequest;🔒pub(crate) use crate::docid::DocQuery;🔒pub(crate) use crate::err::BootstrapAction;🔒pub(crate) use crate::storage::DynStore;🔒pub(crate) use crate::storage::Store;🔒pub(crate) use bootstrap::AttemptId;🔒pub(crate) use event::DirProgress;🔒pub(crate) use crate::state::DirState;🔒pub(crate) use crate::state::NetDirChange;🔒pub use config::DirMgrConfig;pub use docid::DocId;pub use err::Error;pub use event::DirBlockage;pub use event::DirBootstrapEvents;pub use event::DirBootstrapStatus;pub use storage::DocumentText;pub use as_plugin::DirPlugin;pub(crate) use postage::watch;🔒pub(crate) use scopeguard::ScopeGuard;🔒pub(crate) use tor_circmgr::CircMgr;🔒pub(crate) use tor_dirclient::SourceInfo;🔒pub(crate) use tor_dircommon::config::DirTolerance;🔒pub(crate) use info_report;🔒pub(crate) use into_internal;🔒pub(crate) use warn_report;🔒pub(crate) use tor_netdir::params::NetParameters;🔒pub(crate) use DirEvent;🔒pub(crate) use MdReceiver;🔒pub(crate) use NetDir;🔒pub(crate) use NetDirProvider;🔒pub(crate) use async_trait::async_trait;🔒pub(crate) use futures::stream::BoxStream;🔒pub(crate) use oneshot_fused_workaround as oneshot;🔒pub(crate) use tor_netdoc::doc::netstatus::ProtoStatuses;🔒pub(crate) use TaskHandle;🔒pub(crate) use TaskSchedule;🔒pub(crate) use Runtime;🔒pub(crate) use SpawnExt;🔒pub(crate) use debug;🔒pub(crate) use info;🔒pub(crate) use instrument;🔒pub(crate) use instrument;🔒pub(crate) use trace;🔒pub(crate) use warn;🔒pub(crate) use web_time_compat::SystemTimeExt;🔒pub(crate) use std::marker::PhantomData;🔒pub(crate) use AtomicBool;🔒pub(crate) use Ordering;🔒pub(crate) use Arc;🔒pub(crate) use Mutex;🔒pub(crate) use std::time::Duration;🔒pub(crate) use collections::HashMap;🔒pub(crate) use sync::Weak;🔒pub(crate) use fmt::Debug;🔒pub(crate) use fmt::Debug;🔒pub(crate) use time::SystemTime;🔒pub(crate) use strum;🔒
Modules§
- as_
plugin 🔒 - TEMPORARY, EXPERIMENTAL implementation of a
Store-backedDirBackendPlugin. - bootstrap 🔒
- Functions to download or load directory objects, using the
state machines in the
statesmodule. - bridgedesc
BridgeDescMgr- downloads and caches bridges’ router descriptors- config
- Types for managing directory configuration.
- docid 🔒
- Declare a general purpose “document ID type” for tracking which documents we want and which we have.
- docmeta 🔒
- Types to describe information about other downloaded directory documents, without necessarily having the full document.
- err 🔒
- Declare an error type for the tor-dirmgr crate.
- event 🔒
- Code for notifying other modules about changes in the directory.
- filter
- A filtering mechanism for directory objects.
- shared_
ref 🔒 - Utility module to safely refer to a mutable Arc.
- state 🔒
- Implementation for the primary directory state machine.
- storage 🔒
- Methods for storing and loading directory information from disk.
Structs§
- DirMgr
- A directory manager to download, fetch, and cache a Tor directory.
- DirMgr
Store - Storage manager used by
DirMgrandBridgeDescMgr - Fallback
Dir - A directory whose location ships with Tor (or arti), and which we can use for bootstrapping when we don’t know anything else about the network.
- Fallback
DirBuilder - A builder to create an instance of
FallbackDir.
Enums§
- DocSource
- The possible origins of a document.
- Readiness 🔒
- A degree of readiness for a given directory state object.
- Timeliness
- How “timely” must a network directory be?
Traits§
- DirProvider
- Trait for DirMgr implementations
Functions§
- default_
consensus_ 🔒cutoff - Given a time
now, and an amount of tolerated clock skewtolerance, return the age of the oldest consensus that we should request at that time. - supported_
client_ protocols - Return a list of the protocols supported by this crate when running as a client.
- upgrade_
weak_ 🔒ref - Try to upgrade a weak reference to a DirMgr, and give an error on failure.
Type Aliases§
- Result
- A Result as returned by this crate.