summaryrefslogtreecommitdiff
path: root/crates/tor-config/src
Commit message (Collapse)AuthorAgeFilesLines
* config: Simplify ConfigurationTree::merge_from to take &mut self.Nick Mathewson2026-05-272-8/+9
|
* Apply 3 suggestion(s) to 2 file(s)Nick Mathewson2026-05-271-2/+2
| | | Co-authored-by: gabi-250 <[email protected]>
* config: Update doctests to use Deftly, and to passNick Mathewson2026-05-273-16/+24
| | | | | | | | Some of the tests used derive(Builder), which is not current practice for our configuration. Additionally, they didn't implement the requisite ConfigBuilder logic to pass with the other changes in this branch.
* Give resolve_return_results options to control output_tree.Nick Mathewson2026-05-271-13/+48
| | | | | | | I've left the options here as booleans, but moved them into a struct. (IMO, booleans are at their riskiest when they are passed as function arguments, and much less risky when they are used as struct fields.)
* config: Add an `output_tree` to our resolver methods.Nick Mathewson2026-05-271-5/+33
| | | | | | This functionality exposes the part of the configuration tree that was actually used, along with any defaulted values. RPC will want this.
* config: Add a dd(TorConfig) attribute to override apply_defaults().Nick Mathewson2026-05-271-1/+36
|
* config: Add a method to fill in a builder with unset defaultsNick Mathewson2026-05-276-1/+123
| | | | | | | | | | | | | | | 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)`.
* config: Implement Builder for ListBuilders and MapBuilders.Nick Mathewson2026-05-272-0/+15
| | | | This isn't strictly necessary, but it helps for consistency.
* dd(TorConfig): change the order of default vs magicNick Mathewson2026-05-271-21/+28
| | | | | | | | | | | | | | | | | | This affects the automatic builder code made by our derive_deftly macro. It is only relevant (for now) in the case of the `NonZero<>` types and their special handling. Previously, when a builder contained Option<U>, and we wanted to generate a configuration holding T, we would _first_ apply a transformation from Option<U> to Option<T> and _second_ unwrap the result or apply a default. Now, we _first_ convert from Option<U> to U by applying a default, and only _then_ perform any necessary conversion from U and T. This is only relevant in the case where U and T are different. It simplifies writing the defaults for `NonZero` options, and will significantly simplify the logic for setting builder defaults.
* config: Fix documentation of ResolutionResultsNick Mathewson2026-05-271-1/+1
| | | | It previously referred to a function that didn't exist.
* Move metrics config types to tor-config.Wesley Aptekar-Cassels2026-05-262-0/+35
| | | | | | | | | | | | | | 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: Convert some load.rs tests to use dd(TorConfig).Nick Mathewson2026-05-181-18/+11
|
* config: Use derive(TorConfig) for map builder tests.Nick Mathewson2026-05-181-14/+8
|
* config: Implement Default for ConfigurationTree.Nick Mathewson2026-05-181-1/+1
|
* tor-config: remove a needless clone.Nick Mathewson2026-05-181-1/+1
|
* config: Add a merge_from method to ConfigurationTreeNick Mathewson2026-05-182-1/+23
| | | | We'll use this in RPC to implement configuration changing.
* tor-config: Allow inspecting parts of a ConfigurationTree.Nick Mathewson2026-05-122-3/+65
| | | | | | 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.
* tor-config::derive: use cfg(true) and cfg(false)Nick Mathewson2026-05-071-7/+4
| | | | | Rust 1.88 added these, so we no longer have to use `any()` for false and `all()` for true.
* Fix word duplicate typosTobias Stoeckmann2026-03-151-2/+2
|
* tor-config: future-proof #[cfg] attribute.Nick Mathewson2026-02-241-17/+17
|
* tor-config: Add an option to reject configured-out optionsNick Mathewson2026-02-241-6/+55
|
* tor-config: Have macros document more types and fnsNick Mathewson2026-02-242-0/+3
|
* tor-config: Fix cfg() on sub_buildersNick Mathewson2026-02-241-0/+12
| | | | | Previously, it used the sub_builder rule, which doesn't make sense when the value is a stub place-holder to tell us whether to warn.
* Merge branch 'config-migrate-part1' into 'main'gabi-2502026-02-202-4/+16
|\ | | | | | | | | Port several crates to derive_deftly(TorConfig) See merge request tpo/core/arti!3691
| * tor-config: fix and improve ExtendBuilder override.Nick Mathewson2026-02-172-3/+15
| | | | | | | | | | | | | | | | 1. When we are told to `extend_with`, we should obey that directive even if we have a sub_builder etc. 2. Provide an `extend_with_replace` function for the common case where we want to just replace one object with another.
| * tor-config: derive list builders with the visibility of their setters.Nick Mathewson2026-02-171-1/+1
| |
* | 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.
* Merge branch 'feature/cmdline-paths' into 'main'Nick Mathewson2026-02-091-2/+10
|\ | | | | | | | | Allow to set paths in CLI arguments See merge request tpo/core/arti!3556
| * Expand allowable unquoted syntax for configuration arguments in CLI.carti-it2026-02-091-2/+10
| | | | | | | | The set of allowable characters now includes colon, dot, slash, and backslash. This makes it a bit more convenient to pass in paths.
* | 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.
* tor-config: small typo fix in docsSteven Engler2026-01-071-1/+2
|
* tor_config::listen: Warn on explicit port zero.Nick Mathewson2025-12-161-2/+17
|
* tor_config::Listen: Add methods to check for auto and port 0.Nick Mathewson2025-12-161-0/+37
|
* tor_config::Listen: Add "auto" itemsNick Mathewson2025-12-161-7/+55
| | | | These are a nicer syntax than using port "0" explicitly.
* tor_config::Listen: Deprecate localhost_port_legacy.Nick Mathewson2025-12-161-1/+5
| | | | Nothing actually uses it any more, which is good.
* tor_config::Listen: Refactor legacy methods.Nick Mathewson2025-12-161-22/+26
| | | | | Have the part of them that does the "no multiple addresses" work be common, so that we can simplify how they actually behave.
* tor-config: Make derive(Flattenable) use $crate.Nick Mathewson2025-12-091-4/+3
|
* Revert "tor-config: Code to serialize Option<Option<Duration>> via humantime"Nick Mathewson2025-12-093-28/+0
| | | | This reverts commit c7c8eb5a03439ce31319389183e64cb0db539fc9.
* tor-config: new derive_deftly(TorConfig) template.Nick Mathewson2025-12-092-0/+3040
| | | | | | | | 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: New Buildable trait.Nick Mathewson2025-12-091-2/+18
| | | | | | | | This trait will be implemented by every type that our derive_deftly(TorConfig) template generates. It will, among other things, help us figure out the Builder type for a given config type in cases where string-pasting magic is intractable, or where we want to use assert_not_impl to double-check the attributes.
* tor-config: Helper types for setters to take as argumentsNick Mathewson2025-12-092-0/+135
| | | | | 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-093-0/+28
|
* tor_config: Make ListBuilders implement ExtendBuilder.Nick Mathewson2025-12-091-0/+11
|
* tor-config: Give Flattenable template a location.Nick Mathewson2025-12-091-0/+1
| | | | | | If we don't do this, then any attempt to use it from a derive-deftly template will cause a warning about referring to it as $crate::macroname.
* tor-config: Allow Flattenable to apply to types with generics.Nick Mathewson2025-12-091-1/+2
|
* map_builder: Alternative syntax for use by derive(TorConfig)Nick Mathewson2025-12-091-5/+51
| | | | | | | | | | derive_deftly wants to expand types before passing them to macro_rules macros, which is quite reasonable. But map_builder wants its input collection type to be an `ident`, not a `path`. (And macro_rules doesn't accept `path` before a `<`.) To fix this, we're providing an alternative syntax for map_builder, where the inputs are the map type and the builder map type.
* extend_builder: Implement ExtendBuilder for HashMap.Nick Mathewson2025-12-091-1/+17
|