summaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | | arti-example-config.toml: Re-un-comment the example settings in testIan Jackson2022-05-122-4/+26
| | | | |
| | * | | arti-example-config.toml: Comment out all the example settingsIan Jackson2022-05-121-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | arti-example-config: Mark some non-default examples more clearlyIan Jackson2022-05-121-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now, git-grep '^#[^ ]' crates/arti/src/arti-example-config.toml has no ouptut. This prepares us for the next commit.
| | * | | config defaults: Test that empty deser is the sameIan Jackson2022-05-121-0/+4
| | | | |
| | * | | ARTI_EXAMPLE_CONFIG: Rename from ARTI_DEFAULTSIan Jackson2022-05-123-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | The defaults are built into the code. This is a doc-commented example file, not the primary specification of what the defaults are.
| | * | | ARTI_DEFAULTS: Move to arti crateIan Jackson2022-05-125-10/+4
| | | | |
| | * | | config defaults: No longer apply ARTI_DEFAULTS in load()Ian Jackson2022-05-122-5/+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.
| | * | | config defaults: Test that going via builder explicitly is the sameIan Jackson2022-05-121-0/+4
| | |/ / | | | | | | | | | | | | | | | | Add this test even though our construction of the Default and Builder ought to trivially ensure that it's true.
| * | | Merge branch 'builder-default-bis' into 'main'eta2022-05-126-62/+26
| |\ \ \ | | | | | | | | | | | | | | | | | | | | impl_standard_builder followup See merge request tpo/core/arti!505
| | * | | Rename impl_standard_builder from impl_default_via_builderIan Jackson2022-05-126-21/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-123-44/+8
| | | | |
| | * | | config: Move macro calls to next to the structIan Jackson2022-05-122-9/+4
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | 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 'ticket_412_467' into 'main'Nick Mathewson2022-05-129-71/+290
| |\ \ \ | | |/ / | |/| | | | | | | | | | | | | | | | | | Teach DirMgr to use slightly untimely directories Closes #467 and #412 See merge request tpo/core/arti!500
| | * | Resolve DOCDOC comments in tor-dirmgr.Nick Mathewson2022-05-122-5/+7
| | | |
| * | | Merge branch 'arti-config-1' into 'main'eta2022-05-124-2/+6
| |\ \ \ | | | | | | | | | | | | | | | | | | | | arti-config: Move cmdline to tor-config See merge request tpo/core/arti!498
| | * | | arti-config: Move cmdline to tor-configIan Jackson2022-05-114-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This does not know anything about arti, only about TOML and Config. Code motion, plus necessary import adjustments.
| * | | | Merge branch 'clippy' into 'main'eta2022-05-126-7/+15
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Improvements prompted by clippy, and disable one lint See merge request tpo/core/arti!497
| | * | | | clippy: Change a binding to (), and allow clippy::let_unit_valueIan Jackson2022-05-112-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * | | | clippy: Use write! rather than push_str, formatIan Jackson2022-05-113-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This does involve unwrap, but of course that can't fail unless the formats fail, which would already panic (that's implied by format!).
| | * | | | clippy: Drop an unused lifetimeIan Jackson2022-05-111-1/+1
| | |/ / /
| * | | | Merge branch 'builder-default' into 'main'eta2022-05-124-31/+40
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Provide and use macro for impl Derive via Builder See merge request tpo/core/arti!499
| | * | | | No longer derive Default on three structs which derive BuilderIan Jackson2022-05-112-4/+10
| | | | | |
| | * | | | Define and use impl_default_via_builderIan Jackson2022-05-112-27/+30
| | |/ / /
| * / / / Add correct serde(default) attrs for humantime_serde::optionIan Jackson2022-05-122-7/+7
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | Move default_config_file() into arti-clientIan Jackson2022-05-113-9/+9
| | | | | | | | | | | | | | | | 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-113-26/+53
| | | |
| * | | default_config_file(): Have it return Result, not OptionIan Jackson2022-05-112-11/+13
| | | | | | | | | | | | | | | | Discarding this error is not right.
| * | | tor-config: Export CfgPathErrorIan Jackson2022-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | It is not clear to me how this `pub enum` survived the "inaccessible pub" lint.
| * | | ConfigurationSource: Rename new to new_emptyIan Jackson2022-05-114-4/+4
| | | | | | | | | | | | | | | | | | | | 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-117-16/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* | | | dirmgr: use set_skew_limit.Nick Mathewson2022-05-111-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this API we can now stop consensus download attempts early if any consensus that the directory cache gave us would be necessarily too far in the future or in the past. This saves wasted bandwidth for clients with skewed clocks. Closes #466.
* | | | dirclient: add the ability to reject circuits that are too skewed.Nick Mathewson2022-05-113-1/+75
| | | | | | | | | | | | | | | | This will help implement #466.
* | | | Add a channel accessor to ClientCirc.Nick Mathewson2022-05-111-1/+20
| |/ / |/| | | | | | | | | | | I need this so that I can expose the skew time for the directory that a circuit will use, when I only have the circuit.
* | | Note a TODO in exitpath construction.Nick Mathewson2022-05-111-0/+6
| | |
* | | Adjust if-modified-since field on the basis of tolerated skewNick Mathewson2022-05-112-29/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we're happy with a directory from 3 days ago, we should say "if-modified-since 3 days ago". This patch is larger than I'd like, since I had to add &DirMgrConfig as an argument to the functions that make a consensus request. Closes #467.
* | | tor-dirmgr: update status reporting to consider skew toleranceNick Mathewson2022-05-113-24/+84
| | | | | | | | | | | | | | | | | | In our status reporting code, we consider an expired-but-still-usable directory still bootstrapped, but not 100% bootstrapped.
* | | Make reset_time() for incomplete directories more generous.Nick Mathewson2022-05-111-10/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we want to be willing to use older consensuses, we don't necessarily want to reset a download just because the consensus is expired. This new behavior isn't ideal either; I've added a TODO that relates to #433. Related of #412
* | | Add DirSkewTolerance section to DirMgr configuration.Nick Mathewson2022-05-114-5/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new section describes how much variance we accept when it comes to expired and not-yet-valid directory documents. (Currently, the only ones where this matters for are consensus documents and authority certificates.) A document that is invalid by no more than these tolerances is not _live_, but it can still be used. These tolerances serve two purposes: * First, they allow clients to run with a little more clock skew than they would tolerate otherwise. * Second, they allow clients to survive the situation where the authorities are unable to reach a consensus for a day or two. Compare with Tor's REASONABLY_LIVE_TIME and NETWORKSTATUS_ALLOW_SKEW constants; also compare with proposal 212. Closes #412.
* | | tor-netdoc: Add a Lifetime::valid_at method.Nick Mathewson2022-05-111-0/+4
|/ /
* | Merge branch 'dirmgr-purification-2' into 'main'eta2022-05-108-1021/+1244
|\ \ | | | | | | | | | | | | Refactor the tor-dirmgr bootstrapping code more gracefully See merge request tpo/core/arti!488
| * | tor-dirmgr: move apply_netdir_changes() to be a DirMgr methodeta2022-05-102-79/+80
| | |
| * | tor-dirmgr: small fixups for the bootstrapping refactoreta2022-05-103-16/+10
| | | | | | | | | | | | | | | | | | | | | - Some FIXMEs got removed or amended. - AddMicrodescs now yields a mutable reference, so we can use .drain() and reuse the allocation. - Some panics were downgraded to debug_asserts.
| * | tor-dirmgr/bootstrap.rs: error on older netdirs, add log lineeta2022-05-102-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | - We don't want to inadvertently replace our netdir with one that's actually older, so detect and error on this condition. - Also, print a debug line when we get a new netdir without enough guards. - (An unrelated TODO was also added.)
| * | tor-dirmgr/state.rs: take an object to get a netdir, not a netdireta2022-05-102-12/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Taking a previous netdir directly and keeping it around before we need it is a bit of a waste of memory, and also doesn't mesh well with how SharedMutArc works. - To remedy this, introduce a new trait `PreviousNetDir` and have the state machines take that instead. (I was a bit tempted to just pass in the SharedMutArc directly. Maybe I should've done that.)
| * | tor-dirmgr/state.rs: remove GetConsensusState::bodge_neweta2022-05-102-43/+36
| | | | | | | | | | | | - (Also fixes up some dirfilter stuff, whoops.)
| * | tor-dirmgr/state.rs: remove WriteNetDir, use filters directlyeta2022-05-101-97/+79
| | | | | | | | | | | | | | | - The only purpose of WriteNetDir was to provide a filter, which isn't necessary any more. Refactor to provide the filter directly.
| * | tor-dirmgr/state.rs: use the NetDirChange API instead of WriteNetDireta2022-05-103-260/+179
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - GetMicrodescsState now uses the NetDirChange API to propagate netdir changes, instead of modifying the netdir directly. - PendingNetDir was refactored in order to support this use case. - As a result, the netdir-related methods in WriteNetDir can be removed, leaving only the DirFilter for now. - add_from_cache() no longer takes a store, because nothing uses it. - (bodge: apply_netdir_changes() was put in a few places missed previously)
| * | tor-dirmgr/state.rs: add new NetDirChange API, consume iteta2022-05-102-3/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The new DirState::get_netdir_change() API lets the state machine export a NetDirChange: a request to either replace the current netdir, or add microdescs to it. - bootstrap.rs now consumes this new API, even though nothing implements it yet. - This will let us implement GetMicrodescsState without having to directly mutate the netdir. The calling code also handles checking the netdir against the circmgr for sufficiency, and updating the consensus metadata in the store, meaning the revised GetMicrodescsState will not have to perform these tasks.
| * | tor-dirmgr/state.rs: feed through additional parameters, use themeta2022-05-103-242/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The additional parameters passed to GetConsensusState are now passed through all the states, and used as well. - WriteNetDir doesn't have a now() or config() method any more, since the states now get this from the runtime or the config parameters. - This required modifying the tests to make a mocked runtime and custom config directly, instead of using DirRcv for this purpose. - Additionally, because we don't have to upgrade a weak reference for DirState::dl_config(), that function no longer wraps its return value in Result. - (A bunch of the FIXMEs from the previous commit that introduced the additional parameters have now been rectified as a result.)