aboutsummaryrefslogtreecommitdiff
path: root/crates/arti-config/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'clippy-allow-arc-clone' into 'main'Nick Mathewson2022-03-011-1/+0
|\ | | | | | | | | Disable clippy::clone_on_ref_ptr See merge request tpo/core/arti!352
| * Disable clippy::clone_on_ref_ptrIan Jackson2022-02-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lint is IMO inherently ill-conceived. I have looked for the reasons why this might be thought to be a good idea and there were basically two (and they are sort of contradictory): I. "Calling ‘.clone()` on an Rc, Arc, or Weak can obscure the fact that only the pointer is being cloned, not the underlying data." This is the wording from https://rust-lang.github.io/rust-clippy/v0.0.212/#clone_on_ref_ptr It is a bit terse; we are left to infer why it is a bad idea to obscure this fact. It seems to me that if it is bad to obscure some fact, that must be because the fact is a hazard. But why would it be a hazard to not copy the underlying data ? In other languages, faliing to copy the underlying data is a serious correctness hazard. There is a whose class of bugs where things were not copied, and then mutated and/or reused in multiple places in ways that were not what the programmer intended. In my experience, this is a very common bug when writing Python and Javascript. I'm told it's common in golang too. But in Rust this bug is much much harder to write. The data inside an Arc is immutable. To have this bug you'd have use interior mutability - ie mess around with Mutex or RefCell. That provides a good barrier to these kind of accidents. II. "The reason for writing Rc::clone and Arc::clone [is] to make it clear that only the pointer is being cloned, as opposed to the underlying data. The former is always fast, while the latter can be very expensive depending on what is being cloned." This is the reasoning found here https://github.com/rust-lang/rust-clippy/issues/2048 This is saying that *not* using Arc::clone is hazardous. Specifically, that a deep clone is a performance hazard. But for this argument, the lint is precisely backwards. It's linting the "good" case and asking for it to be written in a more explicit way; while the supposedly bad case can be written conveniently. Also, many objects (in our codebase, and in all the libraries we use) that are Clone are in fact simply handles. They contain Arc(s) (or similar) and are cheap to clone. Indeed, that is the usual case. It does not make sense to distinguish in the syntax we use to clone such a handle, whether the handle is a transparent Arc, or an opaque struct containing one or more other handles. Forcing Arc::clone to be written as such makes for code churn when a type is changed from Arc<Something> to Something: Clone, or vice versa.
* | Add warnings about configuration stability.Nick Mathewson2022-02-281-0/+8
| |
* | Upgrade to newer version of config crate.Nick Mathewson2022-02-252-31/+55
|/
* Change deny(clippy::all) to warn(clippy::all).Nick Mathewson2022-02-141-1/+1
| | | | Closes #338.
* Fix a doc link.Nick Mathewson2022-02-041-1/+2
|
* Merge branch 'ticket270' into 'main'Nick Mathewson2022-02-033-4/+76
|\ | | | | | | | | | | | | Watch configuration files and reload them when they change Closes #270 See merge request tpo/core/arti!280
| * Document that `notify` behavior is strange with symlinksNick Mathewson2022-02-032-0/+10
| | | | | | | | | | | | | | | | | | | | (More specifically, `notify` behaves differently on different platforms. On some, it can watch specific directory objects on the filesystem, and so it only notices when _those_ directories change. If you change a symlink so that the canonical configuration file location is now in some other directory, `notify` won't notice. But on other platforms, notify just does "stat()" in a loop. On those, it _will_ notice if the configuration file changes.)
| * arti-config: add blank lines between functions.Nick Mathewson2022-02-021-0/+6
| |
| * arti-config: Small type and comment refactoring from review.Nick Mathewson2022-02-021-2/+0
| |
| * Make configuration-watching configurable and off-by-default.Nick Mathewson2022-02-013-2/+57
| | | | | | | | | | | | | | | | I'm slightly concerned about whether this is behavior people would expect to have on-by-default, so let's make this off-by-default for now. Maybe the `application` and `system` sections should merge?
| * Reload configuration when our configuration files change.Nick Mathewson2022-02-011-1/+4
| | | | | | | | Closes #270
* | Fix typosDimitris Apostolou2022-02-021-1/+1
|/
* arti_config: Refactor configuration sources into a structNick Mathewson2022-02-011-26/+73
| | | | | | | | | | | | | | | | | | | This is by no means our final API, but should represent an improvement. Here instead of having to specify a list of files and their is-this-optional status, along with a list of command-line options, we have a single structure that encapsulates all of that information. Two advantages here: - Callers no longer have to remember what the boolean means. - We can "reload" more easily, by keeping the source object around. This change also implements the correct behavior for our default configuration file in `arti::main`: if the file is absent and the user doesn't list a config file, that's no problem. But if the user lists _that very same config file, we should insist that it be present.
* Make max_file_limit configurableNeel Chauhan2022-01-282-1/+24
|
* Tracing configuration for logfiles, per-target filtersNick Mathewson2022-01-103-23/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we could only configure one global tracing filter that applied to stdout and journald. There was no support for log files, either. This patch fixes both issues, by substantially revising the configuration format: There are now separate filters for each log file, for journald, and for the console log. Because we want to allow multiple logfiles, they have to go into an array in the configuration. The configuration logic has grown a bit complicated in its types, since the tracing_subscriber crate would prefer to have the complete structure of tracing Layers known statically. That's fine when you know how many you have, and which kinds there will be, but for the runtime-configuration case we need to mess around with `Box<dyn Layer ...>`. I also had to switch from tracing_subscriber's EnvFilter to its Targets filter. It seems "EnvFilter" can only be applied as a Layer in itself, and won't work as a Filter on an individual Layer. Closes #166. Closes #170.
* Expose and rename stream timeout config.Nick Mathewson2022-01-101-6/+6
| | | | | | | | | | | Previously we kept this in an ambiguously named type, `ClientTimeoutConfig`. But everything we do right now is client related! So `StreamTimeoutConfig` is a better name. Also, we'd previously neglected to expose the builder for this type from `TorClientConfigBuilder`. Now we do. Closes #281.
* extend lints to include 'clippy::all'Daniel Eades2021-12-281-0/+1
|
* Rename timeout_rules to stream_timeouts.Nick Mathewson2021-12-072-14/+18
| | | | | | | (There are other timeout rules, after all.) Also, rename stream_timeout to connect_timeout, to make it more clear when it applies.
* Merge branch 'revised_preemptive_config' into 'main'eta2021-12-072-28/+41
|\ | | | | | | | | Usability: renaming and documentation in preemptive circuit config See merge request tpo/core/arti!176
| * Clarify names and docs for predictive circuits.Nick Mathewson2021-12-072-13/+26
| | | | | | | | | | Also, use humantime_serde, rather than a number of seconds, to indicate configuration time.
| * Rename circuits_preemptive to preemptive_circuitsNick Mathewson2021-12-072-15/+15
| | | | | | | | | | | | This obeys a few conventions: * adjective before noun * config objects end with "config"
* | Merge branch 'bug252' into 'main'eta2021-12-072-2/+33
|\ \ | |/ |/| | | | | | | | | Make DNS fields in arti-client/src/client.rs configurable Closes #252 See merge request tpo/core/arti!171
| * Rename ClientDNSConfig -> ClientTimeoutConfigNeel Chauhan2021-12-072-11/+14
| |
| * Make DNS fields in arti-client/src/client.rs configurableNeel Chauhan2021-12-032-2/+30
| |
* | Merge branch 'preemptive-config' into 'main'eta2021-12-072-0/+41
|\ \ | | | | | | | | | | | | | | | | | | Allow configurability on preemptive circuits Closes #245 See merge request tpo/core/arti!164
| * | Allow configurability on preemptive circuitsNeel Chauhan2021-12-072-0/+41
| |/
* / Resolve roughly half of the XXXXs.Nick Mathewson2021-12-061-1/+3
|/ | | | | | | | We want to only use TODO in the codebase for non-blockers, and open tickets for anything that is a bigger blocker than a TODO. These XXXXs seem like definite non-blockers to me. Part of arti#231.
* Idle hacking to get 90% coverage in arti-configNick Mathewson2021-12-021-0/+18
| | | | | This is just a matter of writing a few tests for some very easy functions.
* Change sane_defaults() and with_directories()Nick Mathewson2021-11-291-1/+1
| | | | | | | | The sane_defaults() call is now the same as you get from a default builder: by convention, we just call that method Default::default(). The with_directories() constructor makes more sense as a constructor for the TorClientConfigBuilder than for TorClientConfig.
* Merge branch 'config-updates-and-tests'Nick Mathewson2021-11-292-16/+270
|\
| * Document StorageConfig defaults better.Nick Mathewson2021-11-291-8/+11
| | | | | | | | (Also fix a couple of typos)
| * Add basic tests for high-level buildersNick Mathewson2021-11-251-0/+57
| | | | | | | | | | Make sure that we can change elements, and we can reconstruct builders that give us the same thing.
| * Implement builder patterns for ArtiConfig.Nick Mathewson2021-11-252-6/+181
| | | | | | | | | | | | | | | | This commit implements the "metabuilder" pattern and the "builder reconstruction" pattern for the ArtiConfig type. I'm not 100% that this will be necessary, but it will certainly help with testing.
| * Impl and test Default for high-level configsNick Mathewson2021-11-251-3/+22
| |
* | add semicolons if nothing returnedDaniel Eades2021-11-251-0/+1
| |
* | deglob some enums, use concise iteration syntaxDaniel Eades2021-11-251-1/+1
|/
* Resolve a pair of rustdoc warnings.Nick Mathewson2021-11-241-1/+3
|
* Implement meta-builder pattern for TorClientConfigNick Mathewson2021-11-221-10/+27
| | | | | This should be ergonomic than having to construct every section of the configuration separately.
* Make every Config type implement Eq.Nick Mathewson2021-11-211-3/+3
| | | | | Doing this is necessary for reconfiguration support, and will help a lot with testing, too.
* For every* config type, make defaults consistent.Nick Mathewson2021-11-211-0/+17
| | | | | | | | | | This patch makes sure that for every* config type we have, the defaults you get from a Builder match those you get from Serde, and that both match the value that you get from arti_defaults.toml. Later down the line I'll be adding some tests to keep these in sync. * StorageConfig still has no defaults of its own, since we aren't so sure we want other applications to use Arti's directories by default.
* Rename .gitignore APP_FOO to ARTI_FOO.Nick Mathewson2021-11-212-5/+5
| | | | | | | | Since these shell-variables are hardwired to use org.torproject.Arti as the program name, it isn't appropriate to call them "app-specific". If we someday reinstate APP_FOO, it should be based on a user-provided application name.
* Give every ConfigBuilder a From<Config> implementation.Nick Mathewson2021-11-211-0/+18
| | | | This will make it more convenient to reconfigure things.
* Ensure that every section-level config type has a builder() function.Nick Mathewson2021-11-211-2/+17
|
* Make arti-client config object match arti config better.Nick Mathewson2021-11-211-34/+8
| | | | | | | | Now every section that the two configuration objects share has the same type and name. This should help us in documenting our configuration in a way that doesn't confuse people. There is still lots of API work to go.
* Lower StorageConfig to arti-client crateNick Mathewson2021-11-212-37/+3
|
* Use named fields for the elements of ConfigBuildErrorNick Mathewson2021-11-181-2/+8
|
* Rename RetryConfig to DownloadSchedule, fold in parallelism.Nick Mathewson2021-11-181-6/+4
|
* Move the socks_port option into a new proxy section.Nick Mathewson2021-11-183-8/+25
| | | | Now there are no options that aren't in a toml section.
* Rename the "network" configuration section to "tor_network".Nick Mathewson2021-11-181-2/+2
| | | | | This is more accurate, since it describes the details of the tor network that we're connecting to.