Commit Graph

3403 Commits

Author SHA1 Message Date
Nick Mathewson f70ad60e65 DirMgr: Improve display for DocSource
(Also, implement Display for tor_dirclient::SourceInfo).
2022-05-16 12:42:25 -04:00
Nick Mathewson ef2640acfa DirMgr: make DocSource useful by having it include dirserver info.
Previously DocSource would tell you whether the document was from
a local store or a cache server, but it wouldn't tell you _which_
server it came from.

This change required adding DocSource as an argument to
DirState::add_from_download.
2022-05-16 12:42:25 -04:00
Nick Mathewson 18d7ece7dd Merge branch 'ticket_466' into 'main'
Reject directory circuits early if they are too skewed.

Closes #412, #467, and #466

See merge request tpo/core/arti!501
2022-05-16 15:47:02 +00:00
Nick Mathewson fb432924a3 Merge branch 'main' into 'ticket_466'
# Conflicts:
#   doc/semver_status.md
2022-05-16 15:10:00 +00:00
eta 9d8ce43298 Revert "Merge branch 'backtrace' into 'main'"
This reverts merge request !509
2022-05-16 15:01:02 +00:00
eta d69fc2faf9 Merge branch 'backtrace' into 'main'
Do backtrace string matching test only on Linux

See merge request tpo/core/arti!509
2022-05-16 15:00:43 +00:00
Ian Jackson 777b2c123f Do backtrace string matching test only on Linux
"Fixes" #455 by suppressing the test.
2022-05-16 15:00:43 +00:00
Nick Mathewson 34b49422c7 Merge branch 'typos' into 'main'
Fix typo

See merge request tpo/core/arti!510
2022-05-14 21:41:04 +00:00
Dimitris Apostolou 58dc576887
Fix typo 2022-05-14 20:02:53 +03:00
Nick Mathewson 934de16098 Merge branch 'arti-config-2' into 'main'
Abolish arti-config, replacing with tombstone crate

See merge request tpo/core/arti!508
2022-05-13 12:30:24 +00:00
Nick Mathewson f482a5bdd5 Merge branch 'builder-default-3' into 'main'
impl_standard_builder: Test the Deserialize impl and have it generate ::builder

See merge request tpo/core/arti!507
2022-05-13 12:14:30 +00:00
Ian Jackson 4b86818b30 Document semver changes 2022-05-13 12:47:38 +01:00
Ian Jackson 4e2bd6c798 Abolish arti-config, replacing with tombstone crate 2022-05-13 12:42:30 +01:00
Ian Jackson ef36882807 arti-config abolition: Change references to use tor_config
Generally, change the paths that mention the crate name to go via a
module-level "use".

This involves adding tor-config as a direct dependency for a few
crates.
2022-05-13 12:42:30 +01:00
Ian Jackson b6b5d05e1b tor-config: Provide useful documentation for sources module 2022-05-13 12:42:30 +01:00
Ian Jackson 44d2f5ccfd arti-config abolition: Move functionality to tor-config
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.
2022-05-13 12:42:30 +01:00
Ian Jackson 9a3205aeba arti-config abolition: Add deps to tor-config
These are needed to support the code which is moving.
2022-05-13 12:41:27 +01:00
Ian Jackson cdde87846c arti-config: Move default config file test to arti-client
That's where this definitions is now.  This test ought to have been
moved in
  Move default_config_file() into arti-client
2022-05-13 12:41:27 +01:00
Ian Jackson 4115ce50c0 Merge branch 'mistrust-load' into 'main'
config load: Move mistrust checking to load()

See merge request tpo/core/arti!504
2022-05-13 10:53:56 +00:00
Ian Jackson bdb7cb7a6d Fix comment location 2022-05-13 10:58:29 +01:00
Ian Jackson d7f84b92ab config load: Move mistrust checking to load()
As per
  https://gitlab.torproject.org/tpo/core/arti/-/issues/472
Experimentation convinced me the Mistrust should be within the
ConfigurationSources.
2022-05-13 10:58:29 +01:00
Ian Jackson 58c753429f arti-bench: Disable all fs permissions (fs-mistrust) checks
This is a benchmarking tool, and fs-mistrust doesn't like the
permissions in our CI.  The env var ARTI_FS_DISABLE_PERMISSION_CHECKS
is (of course) specific to arti.  Maybe it should be honoured here,
or this should be done via the config files.

But disabling this is fine for now.
2022-05-13 10:56:56 +01:00
Ian Jackson 8f724ad767 impl_standard_builder: Better comments explaining the parser 2022-05-13 10:46:31 +01:00
Ian Jackson be5bc04c02 impl_standard_builder: Have it generate FooConfig::builder
This deletes many handcoded impls.  It also generates lots of impls
that we previously didn't have.
2022-05-12 18:50:26 +01:00
Ian Jackson 86a3e006d3 impl_standard_builder: Test the Deserialize impl
Test the Deserialize impl of every config struct.

This detects bugs like the one fixed in !502.

The macro now becomes more complex because it needs to take options.
Right now this tt-munching option parser is overkill, but this
leave space for further options in the future.
2022-05-12 18:50:26 +01:00
Nick Mathewson f0eac61838 Merge branch 'network-config-error' into 'main'
Delete tor_dirmgr::Error::BadNetworkConfig

See merge request tpo/core/arti!506
2022-05-12 16:43:26 +00:00
Nick Mathewson 1698a2fea1 Merge branch 'template' into 'main'
Make the example config file into a template and move it to arti

See merge request tpo/core/arti!503
2022-05-12 16:34:00 +00:00
eta 2255778afa Merge branch 'builder-default-bis' into 'main'
impl_standard_builder followup

See merge request tpo/core/arti!505
2022-05-12 15:57:56 +00:00
Ian Jackson d847d49858 Delete tor_dirmgr::Error::BadNetworkConfig
This was anomalous, in that it contains &'static str, rather than a
proper nested error (eg a config::ConfigError, maybe).

But in fact it tursn out it is now not constructed.  The last
construction site was removed a long time ago in
  Use derive_builder for Authority and FallbackDir.
2022-05-12 16:49:06 +01:00
Ian Jackson c1c6f2b376 Rename impl_standard_builder from impl_default_via_builder
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.
2022-05-12 15:59:13 +01:00
Ian Jackson 888d6e0511 config: Replace more handwritten impl Default 2022-05-12 15:59:10 +01:00
Ian Jackson 400266b2c5 config: Move macro calls to next to the struct
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.
2022-05-12 15:58:38 +01:00
Nick Mathewson 2a5ee2c8c9 Merge branch 'ticket_412_467' into 'main'
Teach DirMgr to use slightly untimely directories

Closes #467 and #412

See merge request tpo/core/arti!500
2022-05-12 14:42:51 +00:00
Ian Jackson d407ce519b Add semver note for these changes 2022-05-12 15:24:32 +01:00
Ian Jackson cb42c01dd7 arti-example-config.toml: Add a slightly improved comment 2022-05-12 14:55:39 +01:00
Ian Jackson bb166c14da arti-example-config.toml: Re-un-comment the example settings in test 2022-05-12 14:55:39 +01:00
Ian Jackson f18373a7d6 arti-example-config.toml: Comment out all the example settings
We expect that a user may copy this file and uses it as a starting
point for their own configuration.

When they do that, we don't want them to freeze the default config in
time.  Instead, we can expect them to uncomment settings they wish to
change.  Then when they upgrade arti, *other* settings will get the
new defaults, which I think is right.
2022-05-12 14:55:39 +01:00
Ian Jackson 85a310d7cc arti-example-config: Mark some non-default examples more clearly
Now,
  git-grep '^#[^ ]' crates/arti/src/arti-example-config.toml
has no ouptut.

This prepares us for the next commit.
2022-05-12 14:55:39 +01:00
Ian Jackson 1105e63141 config defaults: Test that empty deser is the same 2022-05-12 14:55:39 +01:00
Ian Jackson 8aab5a3996 ARTI_EXAMPLE_CONFIG: Rename from ARTI_DEFAULTS
The defaults are built into the code.  This is a doc-commented example
file, not the primary specification of what the defaults are.
2022-05-12 14:55:39 +01:00
Ian Jackson c9c8344b73 ARTI_DEFAULTS: Move to arti crate 2022-05-12 14:55:39 +01:00
Ian Jackson afa64bf397 config defaults: No longer apply ARTI_DEFAULTS in load()
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.
2022-05-12 14:55:03 +01:00
Ian Jackson 58f53bae5b config defaults: Test that going via builder explicitly is the same
Add this test even though our construction of the Default and Builder
ought to trivially ensure that it's true.
2022-05-12 14:55:03 +01:00
Nick Mathewson 24c7dea38d Resolve DOCDOC comments in tor-dirmgr. 2022-05-12 09:45:05 -04:00
eta 5990df53fe Merge branch 'arti-config-1' into 'main'
arti-config: Move cmdline to tor-config

See merge request tpo/core/arti!498
2022-05-12 13:07:43 +00:00
eta aaf133de49 Merge branch 'clippy' into 'main'
Improvements prompted by clippy, and disable one lint

See merge request tpo/core/arti!497
2022-05-12 13:07:02 +00:00
eta 7207b17567 Merge branch 'builder-default' into 'main'
Provide and use macro for impl Derive via Builder

See merge request tpo/core/arti!499
2022-05-12 12:52:37 +00:00
Nick Mathewson 0b6633d72a Merge branch 'ht-fix' into 'main'
Add correct serde(default) attrs for humantime_serde::option

See merge request tpo/core/arti!502
2022-05-12 12:39:44 +00:00
Ian Jackson 04b8729d6b Add correct serde(default) attrs for humantime_serde::option
Discovered by a test case in my local tree.  The test case was
macro-generated by an extension of impl_standard_builder (which
macro istself currently awaiting review, arti!499)

Have also sent an MR to update the upstream docs
  https://github.com/jean-airoldie/humantime-serde/pull/8
2022-05-12 11:34:53 +01:00
Ian Jackson 0cc94d449e clippy: Change a binding to (), and allow clippy::let_unit_value
The type of ret.map_err(codec_err_to_chan)? is ().  ISTM that
writing `let () = ` makes it clear that there is nothing there,
but the lint forbids this.

This lint is warn by default and trips here for me on current nightly.

It seems wrong to me.  We should be able to make it clear to the
reader that there is nothing here - note how this differs from the
lines below where Ready contains msg.  A let () binding is a good way
to do that.

I think the lint allow ought to be added everywhere, but that doesn't
seem easy right now - see this issue about maint/add_warning:
   https://gitlab.torproject.org/tpo/core/arti/-/issues/469
2022-05-11 18:52:12 +01:00