Commit 9da43189 authored by Nick Mathewson's avatar Nick Mathewson 🦞
Browse files

Turn FallbackList into a real type, and store one in GuardMgr.

The guard manager is responsible for handing out the first hops of
tor circuits, keeping track of their successes and failures, and
remembering their states.  Given that, it makes sense to store this
information here.  It is not yet used; I'll be fixing that in
upcoming commits.

Arguably, this information no longer belongs in the directory
manager: I've added a todo about moving it.

This commit will break compilation on its own in a couple of places;
subsequent commits will fix it up.
parent 6397b563
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -148,6 +148,7 @@ dependencies = [
 "tor-config",
 "tor-dirmgr",
 "tor-error",
 "tor-guardmgr",
 "tor-netdoc",
 "tor-persist",
 "tor-proto",
@@ -3250,6 +3251,7 @@ dependencies = [
 "futures-await-test",
 "humantime-serde",
 "itertools",
 "once_cell",
 "pin-project",
 "rand 0.8.5",
 "retry-error",
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ tor-config = { path = "../tor-config", version = "0.1.0" }
tor-chanmgr = { path = "../tor-chanmgr", version = "0.1.0" }
tor-dirmgr = { path = "../tor-dirmgr", version = "0.1.0" }
tor-error = { path = "../tor-error", version = "0.1.0" }
tor-guardmgr = { path = "../tor-guardmgr", version = "0.1.0" }
tor-netdoc = { path = "../tor-netdoc", version = "0.1.0" }
tor-persist = { path = "../tor-persist", version = "0.1.0" }
tor-proto = { path = "../tor-proto", version = "0.1.0" }
+6 −0
Original line number Diff line number Diff line
@@ -275,6 +275,12 @@ pub struct TorClientConfig {

impl tor_circmgr::CircMgrConfig for TorClientConfig {}

impl AsRef<tor_guardmgr::fallback::FallbackList> for TorClientConfig {
    fn as_ref(&self) -> &tor_guardmgr::fallback::FallbackList {
        self.tor_network.fallback_caches()
    }
}

impl Default for TorClientConfig {
    fn default() -> Self {
        Self::builder()
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ educe = "0.4.6"
futures = "0.3.14"
humantime-serde = "1.1.1"
itertools = "0.10.1"
once_cell = "1"
tracing = "0.1.18"
pin-project = "1"
rand = "0.8"
+2 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@

use tor_basic_utils::define_accessor_trait;
use tor_config::ConfigBuildError;
use tor_guardmgr::fallback::FallbackList;

use derive_builder::Builder;
use serde::Deserialize;
@@ -281,6 +282,7 @@ define_accessor_trait! {
        path_rules: PathConfig,
        circuit_timing: CircuitTiming,
        preemptive_circuits: PreemptiveCircuitConfig,
        fallbacks: FallbackList,
    }
}

Loading