aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-dirmgr/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * DirMgrConfig: Remove unnecessary accessorsIan Jackson2022-04-263-28/+12
| | | | | | | | | | | | | | These fields are pub. Retain two convenience accessor functions that access sub-fields of network.
| * DirMgrConfig: Rename two fields that contained a _configIan Jackson2022-04-262-10/+10
| | | | | | | | This entire struct is config. This is otiose.
| * DownloadSchedule: Rename field to "attempts"Ian Jackson2022-04-261-8/+8
| | | | | | | | | | | | | | This is actually a number of *attempts* not a number of *retries*. The setter method was already called "attempts". This chnages the deserialisation of the config.
| * DownloadSchedule: Abolish accessors in DownloadScheduleConfigIan Jackson2022-04-263-42/+19
| | | | | | | | We can just make the fields pub(crate).
| * DownloadSchudule: Have NetworkConfig contain BuildersIan Jackson2022-04-262-62/+48
| | | | | | | | | | | | | | | | | | | | | | Use sub_builder. We must do something special for defaults. This involves moving the actual default values for retry_bootstrap and retry_microdescs into config.rs, since they need to access the fields of the un-built version of the structure. (An alternative would be to generate "weak setters" which do not override previous settings, but derive_builder does not offer to generate them and that seems overkill.)
| * DownloadSchedule: Abolish new() methodIan Jackson2022-04-262-31/+50
| | | | | | | | | | | | | | | | | | | | Instead, everyone should use DownloadScheduleBuilder. The new() method would in any case be useless in a moment, since we're going to embed DownloadScheduleBuilder in the NetworkConfig, not DownloadSchedule. The call sites in the tests are all about to change again.
| * DownloadSchedule: tests: Do not try to set parallelism to 0Ian Jackson2022-04-262-13/+11
| | | | | | | | | | | | | | | | The current behaviour is to treat 0 as indicating "use the default", which is quite strange. We are going to get rid of that. The new way will be to reject zero, during DownloadScheduleBuilder::build, Add a test case for that.
| * DownloadSchedule: Provide builderIan Jackson2022-04-261-1/+42
| |
* | Merge branch 'main' into 'msrv_1_56'Nick Mathewson2022-04-264-32/+43
|\| | | | | | | | | | | # Conflicts: # crates/tor-config/Cargo.toml # crates/tor-dirmgr/src/state.rs # doc/semver_status.md
| * 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.
| * Rename ThingListBuilder::replace (from set)Ian Jackson2022-04-252-4/+4
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798024
| * Use better syntax for doc comment attributeIan Jackson2022-04-251-3/+1
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798020
| * Introduce AuthorityListBuilder in NetworkConfigBuilderIan Jackson2022-04-254-31/+39
| | | | | | | | | | | | | | | | | | NetworkConfigBuilder needs to not contain any validated structs, so that its serde does not expose the validated details. AuthorityListBuilder is what ought to go here - and it contains Vec<AuthorityBuilder>, not Vec<Authority>. As a consequence, many places now deal with AuthorityBuilder, rather than Authority.
| * Fix error return type of AuthorityBuilderIan Jackson2022-04-251-0/+2
| |
* | squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-254-4/+0
|/ | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* Merge branch 'experimental-v3ident-public' into 'main'Ian Jackson2022-04-251-0/+5
|\ | | | | | | | | Authority: make v3ident public under experimental-api See merge request tpo/core/arti!463
| * Authority: make v3ident public under experimental-apiChristian Grigis2022-04-221-0/+5
| |
* | fallback list: Introduce and use FallbackListBuilderIan Jackson2022-04-222-14/+11
| | | | | | | | | | | | | | | | | | 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-222-1729/+2
|/ | | | | | | | | | 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.
* Fix typosSamanta Navarro2022-04-201-1/+1
| | | | Typos found with codespell.
* Treat expired/not-yet-valid directory objects as Errors.Nick Mathewson2022-04-053-18/+25
| | | | | | | | | | | | | Doing this will make us treat caches that send us these objects as not-working, and close circuits to them instead of trying over and over. The case where we add a document from the cache requires special handling: it isn't actually a error to find an expired document in our cache (unless the passage of time itself is erroneous, which is a debatable proposition at best). Fixes #431.
* dirmgr: Use a different idiom in retry loopNick Mathewson2022-03-311-3/+2
| | | | | Replace the next delay field immediately rather than taking it and _then_ setting it. This way, it's never in an incorrect state.
* dirmgr: fix bugs in algorithm for retrying downloadsNick Mathewson2022-03-301-13/+22
| | | | | | | | | | The previous algorithm had two flaws: * It would wait even after the final attempt, when there were no more retries to do. * It would fail to wait between attempts if an error occurred. This refactoring fixes both of these issues, and adds some comments.
* Refactor FirstHopId into type-differentiated formNick Mathewson2022-03-301-6/+4
| | | | | | | | | | | 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-4/+4
| | | | | This is preparation for having separate GuardId and FirstHopId types that distinguish which back-end they index.
* Rename ExternalFailure => ExternalActivity.Nick Mathewson2022-03-301-4/+4
|
* Add status tracking to FallbackDir.Nick Mathewson2022-03-302-1/+17
| | | | | | | | | | | 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.
* dirmgr: do not pass fallbacks to the CircMgr.Nick Mathewson2022-03-301-6/+1
| | | | | | | This is the final step in allowing the CircMgr to use the GuardMgr's view of the fallbacks. Compilation is restored and tests pass.
* Turn FallbackList into a real type, and store one in GuardMgr.Nick Mathewson2022-03-301-9/+17
| | | | | | | | | | | | | | 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-302-3/+3
| | | | | | | 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.
* Merge branch 'disallowed_lint' into 'main'eta2022-03-302-2/+0
|\ | | | | | | | | Remove allow(clippy::disallowed_methods) lint flag. See merge request tpo/core/arti!437
| * Remove allow(clippy::disallowed_methods) lint.Nick Mathewson2022-03-302-2/+0
| |
* | Make daemon tasks self-contained; introduce NetDirProvidereta2022-03-302-36/+12
|/ | | | | | | | | | | | | | | The various background daemon tasks that `arti-client` used to spawn are now handled inside their respective crates instead, with functions provided to spawn them that return `TaskHandle`s. This required introducing a new trait, `NetDirProvider`, which steals some functionality from the `DirProvider` trait to enable `tor-circmgr` to depend on it (`tor-circmgr` is a dependency of `tor-dirmgr`, so it can't depend on `DirProvider` directly). While we're at it, we also make some of the tasks wait for events from the `NetDirProvider` instead of sleeping, slightly increasing efficiency.
* Merge branch 'no-system-time' into 'main'eta2022-03-304-21/+27
|\ | | | | | | | | | | | | Don't use SystemTime::now() Closes #306 See merge request tpo/core/arti!365
| * use wallclock where possible in teststrinity-1686a2022-02-263-14/+17
| |
| * remove most usage of SystemTime::nowtrinity-1686a2022-02-252-7/+10
| |
* | DirFilter: Move nil default impls to trait default methodsIan Jackson2022-03-251-10/+7
| | | | | | | | | | | | | | This means you can write a DirFilter and only write code to mess with the bits you want to. Also, it is less code here.
* | Abolish filter::DynFilter in favour of transparent DirFilterIan Jackson2022-03-254-52/+13
| | | | | | | | | | | | | | | | | | | | | | | | There are two reasons why the DynFilter newtype might be needed: 1. To impl Default. But we don't need it to impl Default since we can have an accessor which does the defaulting. 2. To hide the API. But this is usrely an unstable API. Just writing Arc<dyn> gets rid of a lot of unnecessary boilerplate and conversion code.
* | Make DirFilter be Debug + Send + SyncIan Jackson2022-03-251-8/+4
| | | | | | | | | | Abolish the handwritten Debug impl for DynFilter, which is no longer needed.
* | dirmgr: Initial DirFilter code.Nick Mathewson2022-03-244-0/+139
| | | | | | | | | | | | This code sits behind a feature flag, and can be used to modify directories before storing them. This is part of the implementation for #397.
* | Expand some comments based on review from @diziet.Nick Mathewson2022-03-212-0/+10
| |
* | Fix build with Rust 1.53.Nick Mathewson2022-03-211-6/+9
| | | | | | | | Pattern bindings after `@` weren't stabilized then :/
* | dirmgr: Note errors and inform the circmgr about them.Nick Mathewson2022-03-213-7/+115
| | | | | | | | | | | | Some error types indicate that the guard has failed as a dircache. We should treat these errors as signs to close the circuit, and to mark the guard as having failed.
* | circmgr: Change API for using FallbackDirsNick Mathewson2022-03-211-1/+5
| | | | | | | | | | | | It'll soon more convenient to pass in FallbackDirs as a slice of references, rather than just a slice of FallbackDirs: I'm going to be changing how we handle these in tor-dirmgr.
* | dirmgr: Authority: Abolish v3ident accessorIan Jackson2022-03-182-11/+3
| | | | | | | | | | This makes this information crate-private. The crate can reasonably just access it.
* | dirmgr: Authority: Move a method used only for testingIan Jackson2022-03-181-6/+9
| |
* | dirmgr: Authority: Abolish two unused accessorsIan Jackson2022-03-181-9/+1
| |
* | dirmgr: NetworkConfig: Abolish accessorsIan Jackson2022-03-181-16/+8
| | | | | | | | Using accessors for crate-only fields is otiose.
* | dirmgr: NetworkConfig: Rename fallbacks struct fieldIan Jackson2022-03-181-6/+9
| | | | | | | | | | | | Rename this to be named the same as its accessor, and use the rename feature of builder and serde. (The shorter name is nicer in the code IMO.)
* | Merge branch 'md_allocation' into 'main'Nick Mathewson2022-03-171-20/+54
|\ \ | | | | | | | | | | | | | | | | | | Use less space in hashtables for microdescriptors Closes #386 See merge request tpo/core/arti!415