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-consdiff",
|
||||||
"tor-dirclient",
|
"tor-dirclient",
|
||||||
"tor-error",
|
"tor-error",
|
||||||
|
"tor-guardmgr",
|
||||||
"tor-llcrypto",
|
"tor-llcrypto",
|
||||||
"tor-netdir",
|
"tor-netdir",
|
||||||
"tor-netdoc",
|
"tor-netdoc",
|
||||||
|
|
|
@ -51,7 +51,8 @@
|
||||||
#![deny(clippy::unwrap_used)]
|
#![deny(clippy::unwrap_used)]
|
||||||
|
|
||||||
use tor_chanmgr::ChanMgr;
|
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_proto::circuit::{CircParameters, ClientCirc, UniqId};
|
||||||
use tor_rtcompat::Runtime;
|
use tor_rtcompat::Runtime;
|
||||||
|
|
||||||
|
|
|
@ -1463,7 +1463,7 @@ mod test {
|
||||||
|
|
||||||
const FAKE_CIRC_DELAY: Duration = Duration::from_millis(30);
|
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> {
|
fn di() -> DirInfo<'static> {
|
||||||
DI_EMPTY[..].into()
|
DI_EMPTY[..].into()
|
||||||
|
|
|
@ -7,8 +7,9 @@ pub mod dirpath;
|
||||||
pub mod exitpath;
|
pub mod exitpath;
|
||||||
|
|
||||||
use tor_error::bad_api_usage;
|
use tor_error::bad_api_usage;
|
||||||
|
use tor_guardmgr::fallback::FallbackDir;
|
||||||
use tor_linkspec::{OwnedChanTarget, OwnedCircTarget};
|
use tor_linkspec::{OwnedChanTarget, OwnedCircTarget};
|
||||||
use tor_netdir::{fallback::FallbackDir, Relay};
|
use tor_netdir::Relay;
|
||||||
|
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,8 @@ mod test {
|
||||||
use crate::path::assert_same_path_when_owned;
|
use crate::path::assert_same_path_when_owned;
|
||||||
use crate::test::OptDummyGuardMgr;
|
use crate::test::OptDummyGuardMgr;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
use tor_guardmgr::fallback::FallbackDir;
|
||||||
use tor_linkspec::ChanTarget;
|
use tor_linkspec::ChanTarget;
|
||||||
use tor_netdir::fallback::FallbackDir;
|
|
||||||
use tor_netdir::testnet;
|
use tor_netdir::testnet;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -33,6 +33,7 @@ tor-config = { path = "../tor-config", version = "0.1.0" }
|
||||||
tor-consdiff = { path = "../tor-consdiff", version = "0.1.0" }
|
tor-consdiff = { path = "../tor-consdiff", version = "0.1.0" }
|
||||||
tor-dirclient = { path = "../tor-dirclient", version = "0.1.0" }
|
tor-dirclient = { path = "../tor-dirclient", version = "0.1.0" }
|
||||||
tor-error = { path = "../tor-error", 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-netdir = { path = "../tor-netdir", version = "0.1.0" }
|
||||||
tor-netdoc = { path = "../tor-netdoc", version = "0.1.0" }
|
tor-netdoc = { path = "../tor-netdoc", version = "0.1.0" }
|
||||||
tor-llcrypto = { path = "../tor-llcrypto", 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::storage::DynStore;
|
||||||
use crate::{Authority, Result};
|
use crate::{Authority, Result};
|
||||||
use tor_config::ConfigBuildError;
|
use tor_config::ConfigBuildError;
|
||||||
use tor_netdir::fallback::FallbackDir;
|
use tor_guardmgr::fallback::FallbackDir;
|
||||||
use tor_netdoc::doc::netstatus;
|
use tor_netdoc::doc::netstatus;
|
||||||
|
|
||||||
use derive_builder::Builder;
|
use derive_builder::Builder;
|
||||||
|
@ -306,8 +306,8 @@ impl DownloadScheduleConfig {
|
||||||
|
|
||||||
/// Helpers for initializing the fallback list.
|
/// Helpers for initializing the fallback list.
|
||||||
mod fallbacks {
|
mod fallbacks {
|
||||||
|
use tor_guardmgr::fallback::FallbackDir;
|
||||||
use tor_llcrypto::pk::{ed25519::Ed25519Identity, rsa::RsaIdentity};
|
use tor_llcrypto::pk::{ed25519::Ed25519Identity, rsa::RsaIdentity};
|
||||||
use tor_netdir::fallback::FallbackDir;
|
|
||||||
/// Return a list of the default fallback directories shipped with
|
/// Return a list of the default fallback directories shipped with
|
||||||
/// arti.
|
/// arti.
|
||||||
pub(crate) fn default_fallbacks() -> Vec<super::FallbackDir> {
|
pub(crate) fn default_fallbacks() -> Vec<super::FallbackDir> {
|
||||||
|
|
|
@ -101,7 +101,7 @@ pub use docid::DocId;
|
||||||
pub use err::Error;
|
pub use err::Error;
|
||||||
pub use event::{DirBootstrapEvents, DirBootstrapStatus, DirStatus};
|
pub use event::{DirBootstrapEvents, DirBootstrapStatus, DirStatus};
|
||||||
pub use storage::DocumentText;
|
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.
|
/// A Result as returned by this crate.
|
||||||
pub type Result<T> = std::result::Result<T, Error>;
|
pub type Result<T> = std::result::Result<T, Error>;
|
||||||
|
|
|
@ -148,6 +148,7 @@ use tor_persist::{DynStorageHandle, StateMgr};
|
||||||
use tor_rtcompat::Runtime;
|
use tor_rtcompat::Runtime;
|
||||||
|
|
||||||
mod daemon;
|
mod daemon;
|
||||||
|
pub mod fallback;
|
||||||
mod filter;
|
mod filter;
|
||||||
mod guard;
|
mod guard;
|
||||||
mod pending;
|
mod pending;
|
||||||
|
|
|
@ -56,7 +56,6 @@
|
||||||
#![deny(clippy::unwrap_used)]
|
#![deny(clippy::unwrap_used)]
|
||||||
|
|
||||||
mod err;
|
mod err;
|
||||||
pub mod fallback;
|
|
||||||
pub mod params;
|
pub mod params;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod testing;
|
mod testing;
|
||||||
|
|
|
@ -77,6 +77,14 @@ tor-netdoc:
|
||||||
|
|
||||||
api-break: changed the return type of GenericRouterStatus::version()
|
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:
|
tor-proto:
|
||||||
new-api: ClientCirc path accessors.
|
new-api: ClientCirc path accessors.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue