summaryrefslogtreecommitdiff
path: root/crates/arti/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | Rename impl_standard_builder from impl_default_via_builderIan Jackson2022-05-122-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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: Replace more handwritten impl DefaultIan Jackson2022-05-122-18/+4
| |
* | config: Move macro calls to next to the structIan Jackson2022-05-121-1/+0
|/ | | | | | | 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 'clippy' into 'main'eta2022-05-121-1/+3
|\ | | | | | | | | Improvements prompted by clippy, and disable one lint See merge request tpo/core/arti!497
| * clippy: Use write! rather than push_str, formatIan Jackson2022-05-111-1/+3
| | | | | | | | | | This does involve unwrap, but of course that can't fail unless the formats fail, which would already panic (that's implied by format!).
* | No longer derive Default on three structs which derive BuilderIan Jackson2022-05-111-3/+6
|/
* Move default_config_file() into arti-clientIan Jackson2022-05-111-2/+2
| | | | This will let other embedders use it.
* ConfigurationSource: Move "usual" logic for constructionIan Jackson2022-05-111-26/+6
|
* default_config_file(): Have it return Result, not OptionIan Jackson2022-05-111-8/+10
| | | | Discarding this error is not right.
* ConfigurationSource: Rename new to new_emptyIan Jackson2022-05-111-1/+1
| | | | | This emphasises its nature. We're going to provide a more cooked constructor in a moment.
* Improve documentation around Cargo features; make Runtime require Debugeta2022-05-111-14/+49
| | | | | | | | | | | | | | - arti#445 highlighted the lack of good documentation around Arti's multiple runtime support, as well as it being difficult to determine what runtime was actually in use. - Improve the documentation to solve the first problem. - To solve the second problem, make Runtime require Debug (which is arguably a good idea anyway, since it makes them easier to embed in things), and print out the current runtime's Debug information when arti is invoked with `--version`. - (It also prints out other Cargo features, too!) fixes arti#445
* Merge branch 'use-fs-mistrust'Nick Mathewson2022-05-091-4/+50
|\
| * Add a CLI option to disable FS permission checks.Nick Mathewson2022-05-091-1/+10
| |
| * Remove "Mistrust" from the public API of arti-client.Nick Mathewson2022-05-091-7/+31
| | | | | | | | | | | | | | | | | | | | 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-1/+14
| |
* | Disable safe-logging when logging to console.Nick Mathewson2022-05-061-1/+30
| |
* | arti: add support for safe-logging configurationNick Mathewson2022-05-062-3/+35
| | | | | | | | | | | | Here we add a config option to disable safe logging, and ensure that safe logging is disabled when we are formatting an error message on exit (since we assume it's safe to write sensitive info to stderr.)
* | Apply `sensitive` in some info-level log messages.Nick Mathewson2022-05-061-2/+3
|/ | | | | This specifically applies the `sensitive` wrapper in the places where we're logging target addresses at level "info" or higher.
* config derive attrs: Make builders serde, and validated structs notIan Jackson2022-05-052-21/+12
| | | | | | | | | | | | | | | * 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.)
* Make LogRotation SerializeIan Jackson2022-05-051-1/+1
| | | | We want to be able to serialise as well as deserialise configurations.
* 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-042-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* Merge branch 'download-schedule' into 'main'Nick Mathewson2022-04-261-3/+16
|\ | | | | | | | | DownloadSchedule: Introduce Builder See merge request tpo/core/arti!473
| * DownloadSchudule: Have NetworkConfig contain BuildersIan Jackson2022-04-261-17/+18
| | | | | | | | | | | | | | | | | | | | | | 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-4/+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-262-52/+16
|\| | | | | | | | | | | # Conflicts: # crates/tor-config/Cargo.toml # crates/tor-dirmgr/src/state.rs # doc/semver_status.md
| * Document defaults for all the config listsIan Jackson2022-04-251-1/+3
| | | | | | | | | | | | | | And add an imprecation in define_list_config_builder's doc comment do do so in future for other invocations of the macro. Add add the missing full stops.
| * Rename ThingListBuilder::replace (from set)Ian Jackson2022-04-251-3/+3
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798024
| * Use better syntax for doc comment attributeIan Jackson2022-04-251-3/+1
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798020
| * Introduce PredictedPortsListBuilderIan Jackson2022-04-251-2/+5
| | | | | | | | | | | | This means that `NetworkConfig::initial_predicted_ports` is now like the other list-like things, returning `&mut list_builder` with the same `set()` and `append()` methods.
| * Introduce AuthorityListBuilder in NetworkConfigBuilderIan Jackson2022-04-251-3/+2
| | | | | | | | | | | | | | | | | | 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.
| * Introduce define_list_config_builder macroIan Jackson2022-04-251-46/+9
| | | | | | | | | | | | This replaces two almost-identical sets of structs and impls. More are on the way, as per https://gitlab.torproject.org/tpo/core/arti/-/issues/447
| * logging: Drop a pointless .within() callIan Jackson2022-04-251-2/+1
| | | | | | | | | | | | | | | | | | | | Since "logfiles: Introduce LogfileListConfigBuilder", this code is in LogfileListConfigBuilder::build(), which is called by derive_builder's generated LoggingConfig::build(), and which will add a file context itself due to the `sub_builder` feature. So this is otiose. And, we are about to replace this whole thing with macro_rules-generated code (which won't do this).
* | squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-254-7/+0
|/ | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* arti: ArtiConfig: derive ArtiConfigBuilderIan Jackson2022-04-221-87/+13
| | | | Replace handwritten builder struct, accessors, and builder function.
* logfiles: Introduce LogfileListConfigBuilderIan Jackson2022-04-221-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | In https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/462#note_2797697 we decided not to do this. However, having looked again at the way the FallbackList works, I think there is a lot of value in making these two things (and anything else like them[1]) as similar as possible. [1] At least PreemptiveCircuitConfig.initial_predicted_ports and NetworkConfig.authorities need the same treatment, and perhaps also GuardUsage.restrictions (although there is no GuardRestrictionBuilder). In the irc discussion I imagined `LogfilesConfigBuilder` as opposed to `LogfileConfigBuilder` (differing only in the `s`) which would be bad, but we can use `List` instead. We do *not* need to abstract away the validated version of the config. Providing a type alias helps the derive_builder sub_builder DTRT without needing special overrides. I have split this commit so that we can drop it, if we conclude it's not wanted.
* logfiles: Adjust LoggingConfigBuilder::file and impl DeserializeIan Jackson2022-04-221-1/+54
| | | | | | | | | Change LoggingConfigBuilder to contain Vec<LogfileConfigBuilder>, not Option<Vec<LogfileConfig>>. That makes it sane to Deserialize. Replace LoggingConfigBuilder's file(Vec<>) setter with the methods discussed in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/462#note_2797697
* logfiles Rename LogfileConfig::file to filesIan Jackson2022-04-221-4/+4
| | | | | It's a plural, and that fact is going to be exposed via serde, if it isn't already.
* 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.
* rename *_isolation_group to *_isolationtrinity-1686a2022-03-242-2/+2
|
* Move SystemConfig to arti::cfgIan Jackson2022-03-213-6/+39
| | | | Fixes #314, #418.
* Run rustfmt to tidy up importsIan Jackson2022-03-211-1/+4
|
* ApplicationConfig: abolish accessorIan Jackson2022-03-213-10/+3
|
* Move ApplicationConfig to arti crateIan Jackson2022-03-212-2/+26
| | | | Code motion and import fixups.
* socks: abolish config accessorsIan Jackson2022-03-212-19/+4
| | | | | Making these fields pub(crate) is quite reasonable and does away with the need for accessors.
* Move ProxyConfig to arti crateIan Jackson2022-03-212-2/+51
| | | | | | | We put this in cfg.rs, rather than (say) socks.rs, because it has config relating to both socks.rs and dns.rs. Code motion and import fixups.
* Tidy up filt_from_opt_strIan Jackson2022-03-211-4/+3
| | | | This was clumsy. Now it is brought together it can be simplified.
* Abolish logging filter option accessorsIan Jackson2022-03-211-19/+7
| | | | | | | This de-duplicates the code that was in those accessors, and is now in filt_from_opt_str. Code motion and direct field access.
* Abolish easy accessors for logging configIan Jackson2022-03-211-26/+6
| | | | | | There are no longer needed, because the code that uses this configuration now lives in the same module as the configuration itself.
* Move logging configuration from arti_config::options to arti::loggingIan Jackson2022-03-213-5/+131
| | | | Code motion and import fixups.