Move fallback.rs into guardmgr.
This is the logical place for it, I think: the GuardMgr's job is to pick the first hop for a circuit depending on remembered status for possible first hops. Making this change will let us streamline the code that interacts with these objects.
This commit is contained in:
parent
5d27710ef1
commit
80b65c3a4d
|
@ -3361,6 +3361,7 @@ dependencies = [
|
|||
"tor-consdiff",
|
||||
"tor-dirclient",
|
||||
"tor-error",
|
||||
"tor-guardmgr",
|
||||
"tor-llcrypto",
|
||||
"tor-netdir",
|
||||
"tor-netdoc",
|
||||
|
|
|
@ -51,7 +51,8 @@
|
|||
#![deny(clippy::unwrap_used)]
|
||||
|
||||
use tor_chanmgr::ChanMgr;
|
||||
use tor_netdir::{fallback::FallbackDir, DirEvent, NetDir, NetDirProvider};
|
||||
use tor_guardmgr::fallback::FallbackDir;
|
||||
use tor_netdir::{DirEvent, NetDir, NetDirProvider};
|
||||
use tor_proto::circuit::{CircParameters, ClientCirc, UniqId};
|
||||
use tor_rtcompat::Runtime;
|
||||
|
||||
|
|
|
@ -1463,7 +1463,7 @@ mod test {
|
|||
|
||||
const FAKE_CIRC_DELAY: Duration = Duration::from_millis(30);
|
||||
|
||||
static DI_EMPTY: [&tor_netdir::fallback::FallbackDir; 0] = [];
|
||||
static DI_EMPTY: [&tor_guardmgr::fallback::FallbackDir; 0] = [];
|
||||
|
||||
fn di() -> DirInfo<'static> {
|
||||
DI_EMPTY[..].into()
|
||||
|
|
|
@ -7,8 +7,9 @@ pub mod dirpath;
|
|||
pub mod exitpath;
|
||||
|
||||
use tor_error::bad_api_usage;
|
||||
use tor_guardmgr::fallback::FallbackDir;
|
||||
use tor_linkspec::{OwnedChanTarget, OwnedCircTarget};
|
||||
use tor_netdir::{fallback::FallbackDir, Relay};
|
||||
use tor_netdir::Relay;
|
||||
|
||||
use std::convert::TryFrom;
|
||||
|
||||
|
|
|
@ -72,8 +72,8 @@ mod test {
|
|||
use crate::path::assert_same_path_when_owned;
|
||||
use crate::test::OptDummyGuardMgr;
|
||||
use std::collections::HashSet;
|
||||
use tor_guardmgr::fallback::FallbackDir;
|
||||
use tor_linkspec::ChanTarget;
|
||||
use tor_netdir::fallback::FallbackDir;
|
||||
use tor_netdir::testnet;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -33,6 +33,7 @@ tor-config = { path = "../tor-config", version = "0.1.0" }
|
|||
tor-consdiff = { path = "../tor-consdiff", version = "0.1.0" }
|
||||
tor-dirclient = { path = "../tor-dirclient", version = "0.1.0" }
|
||||
tor-error = { path = "../tor-error", version = "0.1.0" }
|
||||
tor-guardmgr = { path = "../tor-guardmgr", version = "0.1.0" }
|
||||
tor-netdir = { path = "../tor-netdir", version = "0.1.0" }
|
||||
tor-netdoc = { path = "../tor-netdoc", version = "0.1.0" }
|
||||
tor-llcrypto = { path = "../tor-llcrypto", version = "0.1.0" }
|
||||
|
|
|
@ -12,7 +12,7 @@ use crate::retry::DownloadSchedule;
|
|||
use crate::storage::DynStore;
|
||||
use crate::{Authority, Result};
|
||||
use tor_config::ConfigBuildError;
|
||||
use tor_netdir::fallback::FallbackDir;
|
||||
use tor_guardmgr::fallback::FallbackDir;
|
||||
use tor_netdoc::doc::netstatus;
|
||||
|
||||
use derive_builder::Builder;
|
||||
|
@ -306,8 +306,8 @@ impl DownloadScheduleConfig {
|
|||
|
||||
/// Helpers for initializing the fallback list.
|
||||
mod fallbacks {
|
||||
use tor_guardmgr::fallback::FallbackDir;
|
||||
use tor_llcrypto::pk::{ed25519::Ed25519Identity, rsa::RsaIdentity};
|
||||
use tor_netdir::fallback::FallbackDir;
|
||||
/// Return a list of the default fallback directories shipped with
|
||||
/// arti.
|
||||
pub(crate) fn default_fallbacks() -> Vec<super::FallbackDir> {
|
||||
|
|
|
@ -101,7 +101,7 @@ pub use docid::DocId;
|
|||
pub use err::Error;
|
||||
pub use event::{DirBootstrapEvents, DirBootstrapStatus, DirStatus};
|
||||
pub use storage::DocumentText;
|
||||
pub use tor_netdir::fallback::{FallbackDir, FallbackDirBuilder};
|
||||
pub use tor_guardmgr::fallback::{FallbackDir, FallbackDirBuilder};
|
||||
|
||||
/// A Result as returned by this crate.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
|
|
@ -148,6 +148,7 @@ use tor_persist::{DynStorageHandle, StateMgr};
|
|||
use tor_rtcompat::Runtime;
|
||||
|
||||
mod daemon;
|
||||
pub mod fallback;
|
||||
mod filter;
|
||||
mod guard;
|
||||
mod pending;
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
#![deny(clippy::unwrap_used)]
|
||||
|
||||
mod err;
|
||||
pub mod fallback;
|
||||
pub mod params;
|
||||
#[cfg(test)]
|
||||
mod testing;
|
||||
|
|
|
@ -77,6 +77,14 @@ tor-netdoc:
|
|||
|
||||
api-break: changed the return type of GenericRouterStatus::version()
|
||||
|
||||
tor-netdir:
|
||||
|
||||
api-break: moved FallbackDir to guardmgr.
|
||||
|
||||
tor-guardmgr:
|
||||
|
||||
new-api: moved FallbackDir from netdir.
|
||||
|
||||
tor-proto:
|
||||
new-api: ClientCirc path accessors.
|
||||
|
||||
|
|
Loading…
Reference in New Issue