summaryrefslogtreecommitdiff
path: root/crates/arti-client/src/config.rs
Commit message (Collapse)AuthorAgeFilesLines
* Rename download_tolerance to directory_toleranceNick Mathewson2022-07-221-3/+8
| | | | Closes #503.
* Rename DirSkewTolerance to DirToleranceNick Mathewson2022-07-221-2/+2
| | | | | | 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.
* arti-client: Remove code related to overriding fs-mistrust.Nick Mathewson2022-07-191-2/+2
| | | | | | | | This logic can now be adjusted via the config object so that it does its own overriding by looking at the environment as appropriate. Removing these methods helps simplify the code a bit. Enabled by #483.
* Move responsibility for disable-fs-mistrust envvar.Nick Mathewson2022-07-191-5/+12
| | | | | | | The variable is now handled when building the configuration, and no longer needs to be special-cased. Closes #483.
* Split TorClientConfig out of ArtiConfig, and Resolvable traitIan Jackson2022-05-241-0/+4
| | | | | | | | | | | | This gets rid of `#[serde(flatten)]` which prevents serde_ignored (and other kinds of introspection) from working properly. The price is now that the toplevel has to deal with two configuration objects. The Resolvable trait is overkill right now, but is going to do More Things in a moment. In particular, we need the impl on tuples, so that the whole config can be processed in one go.
* Apply fs-mistrust to logfile directories.Nick Mathewson2022-05-241-0/+20
|
* Make fs-mistrust configurable from the top level.Nick Mathewson2022-05-241-15/+39
| | | | | | This change requires a little refactoring of TorClientBuilder: now, instead of enabling or disabling mistrust, it enables or disables the decision to _override_ the mistrust in the config.
* fs-mistrust: make Mistrust have a corresponding Builder type.Nick Mathewson2022-05-241-3/+3
| | | | | This is an approximately minimal revision to get Builder in place; subsequent commits will clean up the API.
* Merge branch 'arti-config-2' into 'main'Nick Mathewson2022-05-131-0/+9
|\ | | | | | | | | Abolish arti-config, replacing with tombstone crate See merge request tpo/core/arti!508
| * arti-config: Move default config file test to arti-clientIan Jackson2022-05-131-0/+9
| | | | | | | | | | | | That's where this definitions is now. This test ought to have been moved in Move default_config_file() into arti-client
* | impl_standard_builder: Have it generate FooConfig::builderIan Jackson2022-05-121-24/+0
|/ | | | | This deletes many handcoded impls. It also generates lots of impls that we previously didn't have.
* Merge branch 'builder-default-bis' into 'main'eta2022-05-121-9/+5
|\ | | | | | | | | impl_standard_builder followup See merge request tpo/core/arti!505
| * Rename impl_standard_builder from impl_default_via_builderIan Jackson2022-05-121-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | I have Plans for this macro. In particular: * I have a wip branch which tests that the Builder can be deserialised from an empty config (ie, that config reading of a config with a blank section for this item works). * I think we should autogenerate $Config::builder(), and promote that, rather than $ConfigBuilder::default(). This macro could do that.
| * config: Move macro calls to next to the structIan Jackson2022-05-121-8/+4
| | | | | | | | | | | | | | This macro is kind of derive-y. Also it has a test in it, and failing to call it could allow bugs to exist, as well as missing bits of API. Putting it next to the structs makes it easy to see that it's actually been called.
* | Merge branch 'ticket_412_467' into 'main'Nick Mathewson2022-05-121-3/+9
|\ \ | |/ |/| | | | | | | | | Teach DirMgr to use slightly untimely directories Closes #467 and #412 See merge request tpo/core/arti!500
| * Add DirSkewTolerance section to DirMgr configuration.Nick Mathewson2022-05-111-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'builder-default' into 'main'eta2022-05-121-27/+5
|\ \ | | | | | | | | | | | | Provide and use macro for impl Derive via Builder See merge request tpo/core/arti!499
| * | Define and use impl_default_via_builderIan Jackson2022-05-111-27/+5
| | |
* | | Add correct serde(default) attrs for humantime_serde::optionIan Jackson2022-05-121-3/+3
|/ / | | | | | | | | | | | | | | | | Discovered by a test case in my local tree. The test case was macro-generated by an extension of impl_standard_builder (which macro istself currently awaiting review, arti!499) Have also sent an MR to update the upstream docs https://github.com/jean-airoldie/humantime-serde/pull/8
* / Move default_config_file() into arti-clientIan Jackson2022-05-111-1/+6
|/ | | | This will let other embedders use it.
* Merge branch 'use-fs-mistrust'Nick Mathewson2022-05-091-5/+19
|\
| * Remove "Mistrust" from the public API of arti-client.Nick Mathewson2022-05-091-1/+4
| | | | | | | | | | | | | | | | | | | | I'm doing this per discussion, so that we can have it be part of the TorConfig later on, and not break stuff as we change the Mistrust API to have a builder. This change, unfortunately, results in a little more internal complexity and duplicated code in arti and arti-client. I've marked those points with TODOs.
| * arti: use fs-mistrust to validate configuration file locations.Nick Mathewson2022-05-091-0/+12
| |
| * arti-client: Configure and use fs-mistrust.Nick Mathewson2022-05-091-5/+4
| | | | | | | | | | | | This is derived from the environment, not the configuration file: We might not want to trust the configuration file until we've decided whether we like its permissions.
* | NetParams: Document its role as a validated config parameterIan Jackson2022-05-091-3/+0
|/
* config derive attrs: Make builders serde, and validated structs notIan Jackson2022-05-051-17/+8
| | | | | | | | | | | | | | | * 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-3/+4
| | | | | | | 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-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* CfgPath: Overhaul APIIan Jackson2022-05-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | Document that this can contain either a string for expansion, or a literal PathBuf not for expansion. Rename the `from_path` method to `new_literal`: a very important difference is whether it gets expanded - less important than the Rust type. Also, now it takes `Into<PathBuf>`, which avoids a needless clone. (We don't change the API in `arti-client` because `&tempfile::Tempdir()` doesn't implement `Into<PathBuf>`, so `arti-client` has to have some new `as_ref` calls.) Provide accessors `as_unexpanded_str` and `as_literal_path`. The deserialisation already makes this part of the stable API,l so not pvoding accessors seems just obstructive. They are useful for tests, too. Add tests for the new entrypoints, and for deserialisation of both variants from TOML (via config, or directly) and JSON.
* Merge branch 'download-schedule' into 'main'Nick Mathewson2022-04-261-5/+9
|\ | | | | | | | | DownloadSchedule: Introduce Builder See merge request tpo/core/arti!473
| * DirMgrConfig: Rename two fields that contained a _configIan Jackson2022-04-261-2/+2
| | | | | | | | This entire struct is config. This is otiose.
| * DownloadSchudule: Have NetworkConfig contain BuildersIan Jackson2022-04-261-17/+8
| | | | | | | | | | | | | | | | | | | | | | 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-3/+16
| | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'main' into 'msrv_1_56'Nick Mathewson2022-04-261-6/+3
|\| | | | | | | | | | | # Conflicts: # crates/tor-config/Cargo.toml # crates/tor-dirmgr/src/state.rs # doc/semver_status.md
| * 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-6/+3
| | | | | | | | | | | | | | | | | | 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.
* | squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-251-1/+0
|/ | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* arti-client: TorClientConfig: derive TorClientConfigBuilderIan Jackson2022-04-221-171/+41
| | | | Replace handwritten builder struct, accessors, and builder function.
* fallback list: Introduce and use FallbackListBuilderIan Jackson2022-04-221-3/+3
| | | | | | | | | 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.
* Turn FallbackList into a real type, and store one in GuardMgr.Nick Mathewson2022-03-301-0/+6
| | | | | | | | | | | | | | 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.
* dirmgr: Initial DirFilter code.Nick Mathewson2022-03-241-0/+1
| | | | | | 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.
* Move SystemConfig to arti::cfgIan Jackson2022-03-211-48/+0
| | | | Fixes #314, #418.
* Merge branch 'config-partials-transparent' into 'main'Ian Jackson2022-03-171-27/+30
|\ | | | | | | | | Absolish builders for CircMgrConfig and DirMgrConfig See merge request tpo/core/arti!417
| * DirMgrConfig: abolish builder; make it transparent and exhaustiveIan Jackson2022-03-161-13/+16
| | | | | | | | See rationale in the comment.
| * Make CircMgrConfig transparent (and make it a trait)Ian Jackson2022-03-161-14/+9
| | | | | | | | See commentary for the rationale.
| * Change type of TorClientConfig::override_net_paramsIan Jackson2022-03-161-3/+7
| | | | | | | | | | | | | | Now we use NetParams. That implies making its constructor public, which I think it fine. This is related to #413 but is far from completing that ticket.
| * Actually honour preemptive circuits configurationIan Jackson2022-03-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | This handwritten conversion function omitted a field. There was nothing to spot this mistake. IMO this shows why these particular types ought not to use builders, but instead, should cause API breaks when things change. Adding this line here to explicitly fix the bug, although we are about to abolish this function completely almost right away.
* | derive_builder: Switch to upstream 0.11Ian Jackson2022-03-161-3/+3
|/ | | | | | | | | This has the different syntax for builder field attributes than what I originally proposed in my MR, and which therefore is in the pinned branch. My upstream MR for the field attributes feature was morged: https://github.com/colin-kiegel/rust-derive-builder/issues/239
* Use new upstream humantime_serde_option featureIan Jackson2022-03-141-4/+3
| | | | Replace all uses of our copy of this code.
* rustfmtIan Jackson2022-03-111-2/+1
|