summaryrefslogtreecommitdiff
path: root/crates/tor-config/src
Commit message (Collapse)AuthorAgeFilesLines
* Switch to figment 1.0.18 and extract_lossyNick Mathewson2024-04-222-3/+3
| | | | | | | The new (dubiously named) `Figment::extract_lossy` method can treat decode numbers from strings, and booleans from numbers or strings. This makes the behavior compatible with config-rs, and should (I hope) finally allow us to migrate.
* Rename ConfigParseError => ConfigLoadErrorNick Mathewson2024-04-221-8/+15
| | | | | Figment can give an error under more conditions than just a parsing failure, so we should report it a bit more vaguely.
* Add an action field to Io error in tor-config.Nick Mathewson2024-04-222-15/+24
|
* Convert tor-config to use figment.Nick Mathewson2024-04-226-103/+137
| | | | | There are probably ways to make this a bit more elegant, but at least the tests still pass.
* derive-deftly: Change some docs referencesIan Jackson2024-04-031-4/+4
| | | | Found by "git grep adhoc" and manual inspection.
* 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-032-28/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-136-87/+125
|\ | | | | | | | | Encapsulate usage of config-rs inside tor-config. See merge request tpo/core/arti!2040
| * Grammar fix.gabi-2502024-03-131-1/+1
| |
| * tor-config: Update documentation to not refer to config crate.Nick Mathewson2024-03-133-10/+11
| |
| * config: Remove From impls from config::ConfigErrorNick Mathewson2024-03-134-18/+18
| | | | | | | | These are another case of exposing the config crate.
| * tor-config: Put config::Config inside a wrapper type.Nick Mathewson2024-03-135-23/+33
| | | | | | | | This will let us replace Config with something better.
| * Use ConfigurationSource::Verbatim in our tests.Nick Mathewson2024-03-132-16/+24
| |
| * tor-config: Allow ConfigurationSource to be verbatim text.Nick Mathewson2024-03-131-12/+26
| | | | | | | | | | This will let us test our configuration logic without having to use the `config` crate directly.
| * tor_config: Hide macro-only re-exports.Nick Mathewson2024-03-132-12/+17
| | | | | | | | | | 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-1310-0/+10
|/
* Fix typos in doc commentsTobias Stoeckmann2024-03-061-1/+1
|
* deny clippy::unchecked_duration_subtractiontrinity-1686a2024-02-291-0/+1
|
* educe: Use std's default for two structsIan Jackson2024-02-121-3/+1
| | | | | | Reviewing uses of `#[educe(default)]`, I came across these two places where it was applied to a non-generic struct without any special attributes on fields. std's derive will do just as well here.
* educe: Use std's default for enums where default variant is unitIan Jackson2024-02-122-10/+6
| | | | | | | | | | | | | Since Rust 1.66, std's default works properly for enums, provided that the default variant is a unit. Review all uses of `#[educe(default)]` on enums and replace them with std where possible, which is most of them. In 1.66 and later, std's `#[derive(Default)]` doesn't infer any generic bounds on the derived impl, where it's an enum - since the unit variant can always be constructed. So this change doesn't add any generic bounds and is not API-visible.
* config: Fix output of NoCompileTimeSupport::withinNick Mathewson2024-01-161-1/+1
| | | | | Previously, within() would transform this error variant into Invalid.
* Fix typosDimitris Apostolou2024-01-081-1/+1
|
* tor-config: use black_box in test.Nick Mathewson2023-11-301-3/+1
|
* Merge branch 'generic-listen' into 'main'Nick Mathewson2023-10-161-1/+50
|\ | | | | | | | | arti, tor-config: Allow listening on generic addresses for SOCKS and DNS. See merge request tpo/core/arti!1613
| * Test for Listen DisplayJani Monoses2023-09-261-0/+24
| |
| * Do not writelns in Display, undo localhost_port_legacy changes.Jani Monoses2023-09-251-4/+3
| |
| * arti, tor-config: Allow listening on generic addresses for SOCKS and DNS.Jani Monoses2023-09-221-3/+29
| |
* | tor-config: derive Default for FlattenNick Mathewson2023-10-031-1/+1
|/
* tor-config: flatten: Remove a redundant allowIan Jackson2023-09-201-1/+0
| | | | At some earlier point of development this struct was pub.
* tor-config: flatten: Sort out names for field extractorIan Jackson2023-09-201-12/+12
|
* tor-config: flatten: always use field list from serdeIan Jackson2023-09-202-48/+17
| | | | | | | | 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: Performance of flattenable_extract_fieldsIan Jackson2023-09-201-0/+31
| | | | | Add a performance note, and the manually-verified test case to support it.
* tor-config: flatten: Break out flattenable_extract_fieldsIan Jackson2023-09-202-25/+41
| | | | | | | | | 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.
* tor-config: flatten: Introduce FieldList type aliasIan Jackson2023-09-201-6/+9
| | | | We're going to use this some more, even.
* tor_config: flatten: Abolish FlattenErrorIan Jackson2023-09-201-38/+9
|
* tor_config: flatten tests: Remove the obsolete todoIan Jackson2023-09-201-1/+0
|
* tor_config: Add a note about FlattenErrorIan Jackson2023-09-201-0/+8
| | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1605#note_2945202
* tor_config: Flatten: Explain why the inner ref Flatten for serIan Jackson2023-09-201-0/+5
|
* tor_config: Flatten: Add missing tst annotationIan Jackson2023-09-201-0/+1
|
* tor_config: Provide FlattenIan Jackson2023-09-202-0/+687
| | | | | This is an attempt to deal with the fact that `#[serde(flatten)]` is weirdly broken and doesn't work with `serde_ignored`.
* tor-config: Listen: Clarify localhost_port_legacyIan Jackson2023-09-121-1/+1
| | | | | The previous phrasing was ambiguous and set us up for bugs, see https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1582#note_2942240
* tor-config: Listen: Fix a typoIan Jackson2023-09-121-2/+2
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-239-0/+9
|
* Resolve warnings about ambiguous/redundant doc linksNick Mathewson2023-08-221-1/+1
| | | | | Nightly rustdoc now warns if you have a link that isn't necessary, and if you have a link that might refer to two different things.
* tor-config: Expand NoProjectDirs error messageIan Jackson2023-08-081-1/+1
|
* tor-config: Add ConfigurationSources::try_from_cmdlineIan Jackson2023-08-071-7/+34
| | | | We'll use this in crates/arti in a moment.
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* tor-config: Remove unused ItemOrBool helper.Gabriela Moldovan2023-07-131-63/+0
| | | | | `ItemOrBool` is currently not used anywhere (it was previously used by the keymgr config).
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-109-0/+10
|
* Merge branch 'allow_missing_panics' into 'main'Ian Jackson2023-07-071-1/+0
|\ | | | | | | | | | | | | add_warning: Tolerate clippy::missing_panics_doc Closes #950 See merge request tpo/core/arti!1380