aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-dirmgr/src/config.rs
Commit message (Collapse)AuthorAgeFilesLines
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* tor-dircommon: Implement proposal 330Clara Engler2025-09-161-4/+6
| | | | | | | This commit implements proposal 330 in the context of `tor-dircommon`, by replacing the single `Authority` structure used in a list context by a single structure called `AuthorityContacts` which contains all v3idents, upload, download, and vote endpoints in one central place.
* Move `FallbackDir` into `tor-dircommon`Clara Engler2025-09-111-1/+1
|
* tor-dircommon: Use amplify and getters for configClara Engler2025-09-091-2/+2
|
* tor-dircommon: Make config non_exhaustiveClara Engler2025-09-091-4/+1
|
* Move `DirTolerance` into `tor-dircommon`Clara Engler2025-09-091-66/+2
| | | | | This commit moves the `DirTolerance` structure from `tor-dirmgr` into `tor-dircommon`.
* Move `DownloadSchedule` into `tor-dircommon`Clara Engler2025-09-081-115/+1
| | | | | This commit moves the `DowenloadSchedule` related types from `tor-dirmgr` into `tor-dircommon`.
* Move `NetworkStatus` to `tor-dircommon`Clara Engler2025-09-081-74/+3
| | | | | | This commit moves `NetworkStatus` from `tor-dirmgr::config` to `tor-dircommon::config` in order to start the work on a common place for configuration options shared by both directory implementations.
* tor-dircommon: Initial commitClara Engler2025-09-021-1/+1
| | | | | | | | | | | | | | This commit initializes the `tor-dircommon` crate: A crate serving the purpose to form an umbrella for the lowest common denominator primitives found across crates implementing (parts of) the directory specification. For now, the only such primitive is the found within the `authority` module, which has been refactored from `tor-dirmgr` into this crate, alongside additional getter functions due to the lack of `pub(crate)` in this context. In the future, we may move further primitives away from `tor-dirmgr` into `tor-dircommon`.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-2/+2
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* tor-dirmgr: don't support changing `DirMgrConfig::cache_trust`Steven Engler2024-11-051-0/+1
| | | | | `DirMgrConfig::update_from_config` uses the old value and not the new value, so it should be reported using `Reconfigure::cannot_change`.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* Fix typos in doc commentsTobias Stoeckmann2024-03-061-1/+1
|
* dirmgr: Make the `dir_mgr_config` method publicEmil Engler2024-01-091-2/+2
| | | | | | | | | | | This commit makes the `dir_mgr_config` method of the `TorClientConfig` struct public. It might be questionable whether we should make this function public or switch to a `TryInto` trait in general, which also seems like an even Rustier solution Rustier solution. Fixes #1175
* tor-dirmgr: Rename DirMgrConfig.cache_path to cache_dirIan Jackson2023-12-041-5/+5
| | | | | | This variable contains precisely the value of cache_dir from arti_client::config::StorageConfig and it should therefore have the same name.
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* test lint blocks: Do some semi-manuallyIan Jackson2022-12-121-0/+8
| | | | | | | This is the hunks from running the rune in maint/adhoc-add-lint-blocks but which require some subsequent manual fixup: usually, deleting now-superfluous outer allows, but in some cases manually putting back lints that the adhoc script deleted.
* dirmgr: Spelling fixes and normali[sz]ationsNick Mathewson2022-12-061-2/+2
|
* Rename DirSkewTolerance to DirToleranceNick Mathewson2022-07-221-5/+11
| | | | | | This name is more accurate because we aren't only dealing with clock skew here: we're also trying to tolerate the case where the authorities fail to reach consensus for a while.
* impl_standard_builder: Use for tor_dirmgr::DownloadScheduleConfigIan Jackson2022-06-161-14/+1
|
* impl_standard_builder: Use for tor_dirmgr::NetworkConfigIan Jackson2022-06-161-19/+2
|
* impl_standard_builder: Use for tor_dirmgr::DirSkewToleranceIan Jackson2022-06-161-13/+2
|
* Add some missing `serde(default)` to uses of humantime_serde::optionIan Jackson2022-06-161-2/+2
| | | | | Without this, if the substructure is provided, these fields are mandatory within it.
* tor-dirmgr: Fix DirSkewToleranceIan Jackson2022-05-301-2/+2
| | | | | | This was upposed to be one day, I presume! Also complete a truncated sentence in the docs.
* tor-dirmgr: update status reporting to consider skew toleranceNick Mathewson2022-05-111-1/+12
| | | | | | In our status reporting code, we consider an expired-but-still-usable directory still bootstrapped, but not 100% bootstrapped.
* Add DirSkewTolerance section to DirMgr configuration.Nick Mathewson2022-05-111-0/+59
| | | | | | | | | | | | | | | | | | | | This new section describes how much variance we accept when it comes to expired and not-yet-valid directory documents. (Currently, the only ones where this matters for are consensus documents and authority certificates.) A document that is invalid by no more than these tolerances is not _live_, but it can still be used. These tolerances serve two purposes: * First, they allow clients to run with a little more clock skew than they would tolerate otherwise. * Second, they allow clients to survive the situation where the authorities are unable to reach a consensus for a day or two. Compare with Tor's REASONABLY_LIVE_TIME and NETWORKSTATUS_ALLOW_SKEW constants; also compare with proposal 212. Closes #412.
* Update tor-dirmgr to use fs-mistrust.Nick Mathewson2022-05-091-4/+11
|
* config derive attrs: Make builders serde, and validated structs notIan Jackson2022-05-051-8/+5
| | | | | | | | | | | | | | | * 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-6/+8
| | | | | | | 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-11/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* Rename NetworkConfig.fallback_cachesIan Jackson2022-05-041-8/+8
| | | | | | | | | Previously this field was differently named to its serde and to its accessors. We are about to introduce a macro_rules macro which will provide list accessors and we don't want that macro to have a field renaming feature. So stop renaming the field.
* DirMgrConfig: Remove unnecessary accessorsIan Jackson2022-04-261-19/+3
| | | | | | | 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-261-9/+9
| | | | This entire struct is config. This is otiose.
* DownloadSchedule: Abolish accessors in DownloadScheduleConfigIan Jackson2022-04-261-35/+12
| | | | We can just make the fields pub(crate).
* DownloadSchudule: Have NetworkConfig contain BuildersIan Jackson2022-04-261-62/+27
| | | | | | | | | | | 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-261-7/+47
| | | | | | | | | | 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-261-2/+2
| | | | | | | | 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.
* Rename ThingListBuilder::replace (from set)Ian Jackson2022-04-251-2/+2
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798024
* Introduce AuthorityListBuilder in NetworkConfigBuilderIan Jackson2022-04-251-11/+11
| | | | | | | | | 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.
* fallback list: Introduce and use FallbackListBuilderIan Jackson2022-04-221-13/+10
| | | | | | | | | 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-28/+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.
* 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-301-2/+2
| | | | | | | 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.
* Abolish filter::DynFilter in favour of transparent DirFilterIan Jackson2022-03-251-1/+1
| | | | | | | | | | | | 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.
* dirmgr: Initial DirFilter code.Nick Mathewson2022-03-241-0/+16
| | | | | | 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.
* 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.)