summaryrefslogtreecommitdiff
path: root/crates/tor-guardmgr/src/fallback
Commit message (Collapse)AuthorAgeFilesLines
* Add more information to failed-to-select fallback errors.Nick Mathewson2022-07-071-3/+9
| | | | Also re-order the filters to be a little more logical.
* clippy: Consolidate many lints in maint/add_warningIan Jackson2022-06-241-0/+8
| | | | | | Found these by disabling the nightly dbg macro special case. Now, we have a mechanism for globally adding suppressions to tests, we can use that instead.
* GuardMgr: Also apply filters to fallback directories.Nick Mathewson2022-06-171-5/+7
|
* Refactor fallback-set tests to work with deterministic PRNG.Nick Mathewson2022-06-021-10/+29
| | | | | The trouble was that one of the helper functions they used did not take a PRNG as an argument.
* Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-021-3/+4
| | | | | | This only affects uses of thread_rng(), and affects them all more or less indiscriminately. One test does not work with ARTI_TEST_PRNG=deterministic; the next commit will fix it.
* config derive attrs: Make builders serde, and validated structs notIan Jackson2022-05-051-3/+1
| | | | | | | | | | | | | | | * 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-5/+5
| | | | | | | 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.
* Change builder list APIIan Jackson2022-05-041-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | The new API is (roughly) as discussed in https://gitlab.torproject.org/tpo/core/arti/-/issues/451 This is quite a large commit and it is not convenient to split it up. It contains the following changes: * Redo the list builder and accessor macros implemnetation, including docs and tests. * Change uses of define_list_config_builder. In each case: - Move the docs about the default value to the containing field. - Remove the other docs (which were just recapitulations, and are now not needed since the ListBuilder is no longer public). - Rewmove or replace `pub` in the define_list_builder_helper call, so that the builder is no longer public. - Change the main macro call site to use define_list_builder_helper. - Add a call to define_list_builder_accessors. * Make the module `list_builder` pub so that we have somewhere to put the overview documentation. * Consequential changes: - Change `outer.inner().replace(X)` to `outer.set_inner(X)` - Consequential changes to imports (`use` statements).
* list_builder: Use $crate namespaced importsIan Jackson2022-04-251-1/+1
| | | | | | | I don't think we need to bother with things in the prelude, but doing it for serde and ConfigBuildError seems nice. Noticed while writing a test case.
* Document defaults for all the config listsIan Jackson2022-04-251-1/+4
| | | | | | | And add an imprecation in define_list_config_builder's doc comment do do so in future for other invocations of the macro. Add add the missing full stops.
* Use better syntax for doc comment attributeIan Jackson2022-04-251-7/+5
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798020
* Introduce define_list_config_builder macroIan Jackson2022-04-251-48/+13
| | | | | | This replaces two almost-identical sets of structs and impls. More are on the way, as per https://gitlab.torproject.org/tpo/core/arti/-/issues/447
* fallback list: Introduce and use FallbackListBuilderIan Jackson2022-04-221-1/+53
| | | | | | | | | 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.
* Fold FallbackStatus into Entry.Nick Mathewson2022-04-111-44/+31
| | | | This simplifies the code a lot.
* Initial functions to determine and expose a clock skew estimate.Nick Mathewson2022-04-071-0/+7
| | | | | (This is just a placeholder; I'm going to make the functions smarter in the next commit.)
* GuardMgr: record clock skew information.Nick Mathewson2022-04-071-20/+49
| | | | (It is not yet actually used.)
* Allow DirStatus objects to have different timeout floorsNick Mathewson2022-04-041-2/+7
| | | | This will help when we give Guards a DirStatus as well.
* Rename fallback::status::Status to DirStatus.Nick Mathewson2022-04-042-105/+3
| | | | 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-11/+36
| | | | | | | | | | | 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-12/+12
| | | | | This is preparation for having separate GuardId and FirstHopId types that distinguish which back-end they index.
* FallbackState: Use itertools::merge_join_by.Nick Mathewson2022-03-301-100/+8
| | | | | This replaces a hand-coded replacement that was probably a little less efficient.
* Fold fallback::Status::reset() into its (only) caller.Nick Mathewson2022-03-301-7/+2
|
* Rename FallbackState::lookup_mut => get_mut.Nick Mathewson2022-03-301-12/+12
|
* Rename FallbackSet => FallbackState.Nick Mathewson2022-03-301-12/+12
|
* guardmgr::fallback::set: basic unit tests.Nick Mathewson2022-03-301-10/+190
|
* Replace the fallback directories when they change in the config.Nick Mathewson2022-03-301-0/+114
| | | | | | The code here uses a new iterator type, since I couldn't find one of these on crates.io. I tried writing the code without it, but it was harder to follow and test.
* Add status tracking to FallbackDir.Nick Mathewson2022-03-302-3/+214
| | | | | | | | | | | 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.
* Turn FallbackList into a real type, and store one in GuardMgr.Nick Mathewson2022-03-301-0/+55
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.