summaryrefslogtreecommitdiff
path: root/crates/tor-guardmgr/src/fallback.rs
Commit message (Collapse)AuthorAgeFilesLines
* config derive attrs: Make builders serde, and validated structs notIan Jackson2022-05-051-3/+3
| | | | | | | | | | | | | | | * Builders additionally derive: Debug, Serialize, Deserialize. * Validated structs no longer derive: Serialize, Deserialize and all related attributes deleted. * As a consequence, all the `#[serde(deny_unknown_fields)]` are gone. That means that right now unknown fields are totally ignored. This is good for compatibility but poor for useability. Doing something better here is arti#417, in progress. * As a consequence, delete tor_dirmgr::retry::default_parallelism. (The default value was already duplicated into a builder attr.)
* FallbackDir: Use VecBuilder for orportsIan Jackson2022-05-041-8/+9
| | | | | | | And drop the ad-hoc orport() method. This brings FallbackDir's orports field in line with our list builder API. The general semver note in "configuation" seems to cover most of this.
* FallbackDir: Do orport validation after autogenerated buildIan Jackson2022-05-041-5/+11
| | | | This avoids it having to recapitulate defaulting logic.
* FallbackDir: Do not consider defaulted-empty orport list to be validIan Jackson2022-05-041-7/+5
|
* fallback list: Introduce and use FallbackListBuilderIan Jackson2022-04-221-8/+5
| | | | | | | | | Now the network fallbacks configuration wants to Deserialize a Vec<FallbackDirBuilder>, rather than validated Vec<FallbackDir>. Methods on FallbackListBuilder are as per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/462#note_2797697 mutatis mutandi for the fact that this struct has only fallbacks in it.
* fallback list: Move default list into tor-guardmgrIan Jackson2022-04-221-0/+27
| | | | | | | | | | This is where the FallbackList type is. We are going to want to provide a builder too, which ought to impl Default. This means that the default value for the type must be next to the type. In any case, it was anomalous that it wasn't. This commit is pure code motion.
* Rename fallback::status::Status to DirStatus.Nick Mathewson2022-04-041-2/+1
| | | | It's about to be shared between fallbacks and guards.
* Fix some Rustdoc links.Nick Mathewson2022-03-301-1/+1
|
* Refactor FirstHopId into type-differentiated formNick Mathewson2022-03-301-1/+2
| | | | | | | | | | | The FirstHopId type now records an enum that stores whether the hop is a guard or a fallback. This change addresses concerns about remembering to check the type or source of an Id before passing it down to the FallbackState or GuardSet. Making this change required an API change, so that dirmgr can report success/failure status without actually knowing whether it's using a fallback or a guard.
* Rename Guard=>FirstHop, GuardId=>FirstHopIdNick Mathewson2022-03-301-3/+3
| | | | | This is preparation for having separate GuardId and FirstHopId types that distinguish which back-end they index.
* Rename FallbackSet => FallbackState.Nick Mathewson2022-03-301-1/+1
|
* Clean up a rustdoc linkIan Jackson2022-03-301-1/+1
|
* Add status tracking to FallbackDir.Nick Mathewson2022-03-301-0/+3
| | | | | | | | | | | We do this by creating a new FallbackSet type that includes status information, and updating the GuardMgr APIs to record success and failure about it when appropriate. We can use this to mark FallbackDirs retriable (or not). With this change, FallbackDir is now stored internally as a Guard in the GuardMgr crate. That's fine: the FallbackDir type really only matters for configuration.
* GuardMgr: some prep work for returning fallbacks as guards.Nick Mathewson2022-03-301-0/+8
| | | | | | | | | We need to extend our notion of "the origin of a guard" to include "somewhere outside the guard list"; we need the ability to return a FallbackDir as a Guard; and we need to remember a few more pieces of information in each pending request. As before, this commit may break compilation; it will be restored soon.
* Turn FallbackList into a real type, and store one in GuardMgr.Nick Mathewson2022-03-301-0/+4
| | | | | | | | | | | | | | 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.
* Move fallback.rs into guardmgr.Nick Mathewson2022-03-301-0/+86
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.