aboutsummaryrefslogtreecommitdiff
path: root/crates/arti-config/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
| | | | Closes #950.
* lints: Run maint/add_warning to actually apply new lintsIan Jackson2023-06-211-0/+2
|
* Disable clippy::unlinlined-format-argsNick Mathewson2023-01-271-0/+1
| | | | | | | | This warning kind of snuck up on us! (See #748) For now, let's disable it. (I've cleaned it up in a couple of examples, since those are meant to be more idiomatic and user-facing.) Closes #748.
* Run add_warnings.Nick Mathewson2022-11-031-0/+1
|
* cargo fmt to remove blank linesIan Jackson2022-10-121-1/+0
| | | | | | | Apparently cargo fmt doesn't like these, which my perl rune didn't delete. This commit is precisely the result of `cargo fmt`.
* Replace all README copies in src/lib.rs with includesIan Jackson2022-10-121-8/+1
| | | | | | | | The feature we want is `#[doc = include_str!("README.md")]`, which is stable since 1.54 and our MSRV is now 1.56. This commit is precisely the result of the following Perl rune: perl -i~ -0777 -pe 's{(^//!(?!.*\@\@).*\n)+}{#![doc = include_str!("../README.md")]\n}m' crates/*/src/lib.rs
* enable doc_auto_cfg feature on every crate when documenting for docs.rstrinity-1686a2022-08-241-0/+1
|
* Run maint/add_warning crates/*/src/{lib,main}.rsIan Jackson2022-06-231-0/+3
| | | | Update all lint blocks
* lints: Make lint blocks consistentIan Jackson2022-05-311-1/+3
| | | | The remaining consequences of running add_warning
* lints: Add let_unit_value allow to all cratesIan Jackson2022-05-311-0/+1
| | | | | From running add_warning, with manual picking of the right hunks/lines.
* lints: Add lint block delimiters to every crateIan Jackson2022-05-311-0/+2
| | | | | | This was the result of: maint/add_warning crates/*/src/{lib,main}.rs and then manually curating the results.
* lints: arti-config: Re-add standard lint listIan Jackson2022-05-311-0/+30
| | | | We are going to make lints the same for every crate.
* Abolish arti-config, replacing with tombstone crateIan Jackson2022-05-131-46/+4
|
* arti-config abolition: Move functionality to tor-configIan Jackson2022-05-131-233/+1
| | | | | | | | | | | | | | | | | This crate no longer has any reason to exist. All its remaining functionality is generic enough to go into tor-config. In this commit, we move the contents of lib.rs into a new file in tor-config. It contains: * Code motion * The minimal "mod" and "use" changes * The minimal doc comment * A new a compat alias for ConfigurationSources. The compat alias is there because various crates currently speak of arti_config::ConfigurationSources and it is most convenient to fix them up after the type is available in tor_config.
* arti-config: Move default config file test to arti-clientIan Jackson2022-05-131-10/+0
| | | | | | That's where this definitions is now. This test ought to have been moved in Move default_config_file() into arti-client
* Fix comment locationIan Jackson2022-05-131-2/+2
|
* config load: Move mistrust checking to load()Ian Jackson2022-05-131-15/+34
| | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/issues/472 Experimentation convinced me the Mistrust should be within the ConfigurationSources.
* ARTI_DEFAULTS: Move to arti crateIan Jackson2022-05-121-3/+0
|
* config defaults: No longer apply ARTI_DEFAULTS in load()Ian Jackson2022-05-121-4/+0
| | | | | | | | This is redundant, because the defaults have to be supplied by the config builders (usually via builder default attributes). That this is actually done and correct is tested by the `default_config()` test case in arti/src/cfg.rs.
* arti-config: Move cmdline to tor-configIan Jackson2022-05-111-2/+1
| | | | | | This does not know anything about arti, only about TOML and Config. Code motion, plus necessary import adjustments.
* Move default_config_file() into arti-clientIan Jackson2022-05-111-6/+1
| | | | This will let other embedders use it.
* ConfigurationSources: Have the generics take Into<owned>Ian Jackson2022-05-111-12/+12
| | | | | | | | | | These generic arguments weren't consistent. It doesn't make sense ot insist on getting a borrowed type and then cloning it. So tidy things up in the direction of taking owned values, which is what ConfigurationSources actually needs. (My personal preference would be &dyn to avoid monomorphisation code bloat but that was controversial last time I proposed it somewhere.)
* ConfigurationSource: Move "usual" logic for constructionIan Jackson2022-05-111-0/+46
|
* default_config_file(): Have it return Result, not OptionIan Jackson2022-05-111-3/+3
| | | | 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.
* Fix grammar and typosSamanta Navarro2022-04-271-1/+1
|
* Run rustfmt to tidy up importsIan Jackson2022-03-211-1/+1
|
* Move ApplicationConfig to arti crateIan Jackson2022-03-211-1/+1
| | | | Code motion and import fixups.
* Move ProxyConfig to arti crateIan Jackson2022-03-211-3/+1
| | | | | | | 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.
* Move logging configuration from arti_config::options to arti::loggingIan Jackson2022-03-211-2/+1
| | | | Code motion and import fixups.
* Move ArtiConfig to new arti::cfg moduleIan Jackson2022-03-211-3/+2
| | | | Code motion and import fixups.
* 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-251-25/+39
|/
* 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
|
* 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-011-2/+3
| | | | | | | | 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
* 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.
* Tracing configuration for logfiles, per-target filtersNick Mathewson2022-01-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* extend lints to include 'clippy::all'Daniel Eades2021-12-281-0/+1
|
* Merge branch 'config-updates-and-tests'Nick Mathewson2021-11-291-1/+2
|\
| * Implement builder patterns for ArtiConfig.Nick Mathewson2021-11-251-1/+2
| | | | | | | | | | | | | | | | 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.
* | add semicolons if nothing returnedDaniel Eades2021-11-251-0/+1
|/
* Resolve a pair of rustdoc warnings.Nick Mathewson2021-11-241-1/+3
|