aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-config/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* Add new tor-conig-shared crate.Wesley Aptekar-Cassels2026-08-101-4/+0
| | | | | This contains configuration types that are shared between arti and arti-rely.
* arti: Move OpentelemetryConfig to tor-config.Wesley Aptekar-Cassels2026-08-101-0/+2
| | | | | | This will allow this code to be shared between arti and arti-relay. See: #2470
* add_warning: add reference to arti#2556Jim Newsome2026-07-151-1/+1
|
* Removed unnecessary lintpryty262026-07-151-1/+1
| | | | Removed unnecessary lint
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+2
| | | | | | | | | | | | 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.
* config: Simplify ConfigurationTree::merge_from to take &mut self.Nick Mathewson2026-05-271-6/+7
|
* config: Add a method to fill in a builder with unset defaultsNick Mathewson2026-05-271-1/+1
| | | | | | | | | | | | | | | This new method modifies a builder by replacing any unset values that have a default with that default. We're using this method so that we can re-serialize a builder into a `ConfigurationTree` with all of its default values included. In all cases, `b.apply_defaults()?; b.build()` should produce the same output as `b.build()`. The interesting parts of this commit are in tor_config::load and tor_config::derive. The rest of this commit just adds `apply_defaults` to other builders that _aren't_ made with `derive_deftly(TorConfig)`.
* Move metrics config types to tor-config.Wesley Aptekar-Cassels2026-05-261-0/+2
| | | | | | | | | | | | | | This will allow these types to be shared by arti and arti-relay. This does change these types from being behind the experimental-api flag. I think this is okay, as tor-config is not a stable crate anyways, but it's worth keeping in mind. There is also an argument to be made for having two separate types, one in arti and one in arti-relay, as we do for LoggingConfig. I think that using a single type has benefits, and we should strive to eventually merge the LoggingConfigs, for instance, and perhaps other types, but it doesn't seem critical in either direction at the moment.
* config: Implement Default for ConfigurationTree.Nick Mathewson2026-05-181-1/+1
|
* config: Add a merge_from method to ConfigurationTreeNick Mathewson2026-05-181-0/+22
| | | | We'll use this in RPC to implement configuration changing.
* tor-config: Allow inspecting parts of a ConfigurationTree.Nick Mathewson2026-05-121-3/+56
| | | | | | This will be used by RPC. Probably. It might actually be a better to re-serialize the configuration after parsing it, so that our inspection functions can see default values.
* Document resolve_option_general behaviormoumenalaoui2026-02-181-10/+39
|
* Allow clippy::collapsible_if to triggerGabriela Moldovan2026-02-161-0/+1
| | | | | | | | | `clippy::collapsible_if` started triggering after bumping the MSRV to 1.88. Since this triggers from a lot of places, and since there even are a couple of instances where we explicitly allow `clippy::collapsible_ifs`, I've opened #2342 for deciding what to do about it.
* tor-config: remove `resolve_alternative_specs` functionSteven Engler2026-02-011-81/+0
|
* arti: remove `resolve_listen_port!` macroSteven Engler2026-01-291-3/+5
| | | | | | I'm undecided whether we want to keep `resolve_alternative_specs` around, but it seems possible/likely that we'll want it in the future, so I think we can keep it.
* maint/add_warning: Run script to add new warningGabriela Moldovan2026-01-271-0/+1
| | | | This adds the lint to all our crates.
* Revert "tor-config: Code to serialize Option<Option<Duration>> via humantime"Nick Mathewson2025-12-091-1/+0
| | | | This reverts commit c7c8eb5a03439ce31319389183e64cb0db539fc9.
* tor-config: new derive_deftly(TorConfig) template.Nick Mathewson2025-12-091-0/+1
| | | | | | | | This template is meant to replace most of our use of derive_builder for configuration objects. Where possible and reasonable, it delegates to existing macros, and automatically infers what special patterns we use for individual types. In other cases, it uses compile-time errors to inform the caller about pattern violations.
* tor-config: Helper types for setters to take as argumentsNick Mathewson2025-12-091-0/+1
| | | | | The derive-deftly TorConfig template will use these as appropriate for the inputs to setter functions, based on field types.
* tor-config: Code to serialize Option<Option<Duration>> via humantimeNick Mathewson2025-12-091-0/+1
|
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-2/+2
| | | | Run maint/add_warning
* Remove "doc_auto_cfg" incantation from all crates.Nick Mathewson2025-09-291-1/+1
| | | | This feature has been removed from nightly, in favor of doc_cfg.
* clippy: fix `clippy::implicit_clone` errorsSteven Engler2025-08-111-1/+1
| | | | | | | | | | | | | | | | | ```text error: implicitly cloning a `String` by calling `to_string` on its dereferenced type --> crates/tor-config/src/lib.rs:109:32 | 109 | V::String(_, s) => s.to_string(), | ^^^^^^^^^^^^^ help: consider using: `s.clone()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone note: the lint level is defined here --> crates/tor-config/src/lib.rs:20:9 | 20 | #![deny(clippy::implicit_clone)] | ^^^^^^^^^^^^^^^^^^^^^^ ```
* Temporarily suppress mismatched_lifetime_syntaxes.Gabriela Moldovan2025-07-071-0/+1
| | | | See #2060.
* clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* Define macros to create a map-builder type.Nick Mathewson2024-12-191-0/+1
| | | | | | | | | | | | We're about to need this to define some of the configuration for RPC listeners. The provided map-builder type is much less voluminous in terms of APIs added than the list-builder type: It just uses Deref* and sub_builder. I think this simplicity may be a win. I'll need to rethink how this type handles defaults in order to implement connect points properly; I've left XXXXs for that issue.
* tor-config: Add "extend" functionality for config builders.Nick Mathewson2024-12-191-0/+2
| | | | We'll use this to implement defaults for maps in our configuration.
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* tor-config: removed re-export of `CfgPath`Steven Engler2024-11-041-1/+0
| | | | | Also updated other packages to get `CfgPath` directly from `tor-config-path' instead of 'tor-config'.
* tor-config-path: moved `tor_config::path` to hereSteven Engler2024-10-291-2/+1
| | | | This is a direct move of the `path` module from tor-config.
* tor-config: Expose assert_config_error test helper.Gabriela Moldovan2024-10-081-0/+2
| | | | | | This moves the `assert_config_error` helper from the restricted discovery config tests to a `testing` module in `tor-config` (I am about to reuse it for the C Tor keystore config tests too).
* tor-config: move Listen to its own module.Nick Mathewson2024-09-251-0/+2
|
* tor-config: Move FileWatcher to tor-config.Gabriela Moldovan2024-08-211-0/+1
| | | | | | | | | For the most part, this is just code motion. The only change here is that `prepare` is no longer a method on `FileWatcher`. This decouples `FileWatcher` from `ConfigurationSources`, enabling us to use it to watch files and directories that aren't configuration.
* arti-client: Move BuilderExt to tor-config.Gabriela Moldovan2024-08-051-0/+1
| | | | | `BuilderExt` will soon be used in tor-hsservice too (for configuring the mistrust settings of the client "restricted mode" authorization keys).
* Change deftly syntax to post 0.12.1 versionIan Jackson2024-06-171-1/+1
| | | | | | | | | | | * Change `pub` to `export` * Change the `=` in define to `:` * Change `pub_template_semver_check` to `template_export_semver_check` Right now, 0.12.1 supports both syntaxes. I have verified this branch also compiles with https://gitlab.torproject.org/Diziet/rust-derive-deftly/-/merge_requests/402 ee171ffaf56d7dcb7d75584054921153fe19b222
* Update to derive-deftly 0.12.1Ian Jackson2024-06-171-1/+1
| | | | | | * Bump in Cargo.toml * Deal with `${Xmeta as ...}` incompatible change, by always specifying an `as`, and changing `as tokens`.
* tor-config: Re-export serde_value.Gabriela Moldovan2024-06-031-0/+1
| | | | | We are about to need this in other crates (for generating the tests for the `NotAutoValue` implementations).
* Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | This commit is automatically generated.
* Convert tor-config to use figment.Nick Mathewson2024-04-221-6/+12
| | | | | There are probably ways to make this a bit more elegant, but at least the tests still pass.
* derive-deftly: Call pub_template_semver_checkIan Jackson2024-04-031-0/+2
| | | | | | | This is a new feature in d-d 0.10.0. Our currrent semver policy doesn't care about this, but let's not encode that property in the tree and leave ourselves a booby-trap.
* Switch to derive-deftlyIan Jackson2024-04-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the combination of a number of separate commits, many of which were generated by seddery, and then rebased and squashed. Cargo.toml perl -i~ -pe 's{^derive-adhoc}{derive-deftly = "0.10"}' crates/*/Cargo.toml (not regenerated during rebase) update Cargo.lock `cargo fetch` without --locked (regenerated during rebase) seddery git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{^use derive_adhoc}{use derive_deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bdefine_derive_adhoc\b}{define_derive_deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bAdhoc\b}{Deftly}g if m{derive}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\#\[derive_adhoc\b}{#[derive_deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{use derive_adhoc}{use derive_deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc\b}{derive_deftly_adhoc} if m{use.*deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc!}{derive_deftly_adhoc!}' (not regenerated during rebase) Manually add `#[derive_deftly_adhoc]` where needed. seddery git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\#\[adhoc\b}{#[deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc_template}{derive_deftly_template}' (not regenerated during rebase) Manually fix up an import Manually update some builder attrs Manually fix up tor_rtmock::time_core This was missed in my seddery, due to me rebasing the branch and not redoing the seddery.
* Merge branch 'encapsulate_config_rs' into 'main'Nick Mathewson2024-03-131-9/+30
|\ | | | | | | | | Encapsulate usage of config-rs inside tor-config. See merge request tpo/core/arti!2040
| * tor-config: Update documentation to not refer to config crate.Nick Mathewson2024-03-131-1/+1
| |
| * config: Remove From impls from config::ConfigErrorNick Mathewson2024-03-131-1/+1
| | | | | | | | These are another case of exposing the config crate.
| * tor-config: Put config::Config inside a wrapper type.Nick Mathewson2024-03-131-0/+16
| | | | | | | | This will let us replace Config with something better.
| * tor_config: Hide macro-only re-exports.Nick Mathewson2024-03-131-8/+13
| | | | | | | | | | Our macros use these exports, but we don't need everybody else to be able to see them.
* | Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|/
* deny clippy::unchecked_duration_subtractiontrinity-1686a2024-02-291-0/+1
|
* tor-config: flatten: always use field list from serdeIan Jackson2023-09-201-1/+1
| | | | | | | | This is a better trickery! Now we don't need to derive the list of field names at all. The test case becomes much simpler too, and no longer needs to compare field lists since we have only the serde field list.
* tor-config: flatten: Break out flattenable_extract_fieldsIan Jackson2023-09-201-1/+1
| | | | | | | | | This involves returning the field list in the `FlattenableTesterSuccess`. This leaves the names a little off; we'll update those at the end. Export this - it's going to replace the hidden pub test function.