summaryrefslogtreecommitdiff
path: root/crates/tor-guardmgr
Commit message (Collapse)AuthorAgeFilesLines
* Regenerate version bump from previous commit.arti-v0.4.0Nick Mathewson2022-05-271-8/+8
| | | | | | | This commit was made by reverting the previous commit, then re-running the script I used to generate it. In theory there should be no semantic changes: only changes due to improved formatting from cargo edit.
* Semantic version changes for Arti 0.4.0 releaseNick Mathewson2022-05-271-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | I followed the following procedure to make these changes: * I used maint/changed_crates to find out which crates had changed since 0.3.0. * I used grep and maint/list_crates to sort those crates in topological (dependency) order. * I looked through semver_status to find which crates were listed as having semver-relevant changes (new APIs and breaking changes). * I scanned through the git logs of the crates with no semver-relevant changes listed to confirm that, indeed, they had no changes. For those crates, I incremented their patch-level version _without_ changing the version that other crates depend on. * I scanned through the git logs of the crates with no semver-relevant changes listed to confirm that, indeed, they had no obvious breaking changes. * I treated all crates that depend on `arti` and/or `arti-client` as having breaking changes. * I identified crates that depend on crates that have changed, even if they have not changed themselves, and identified them as having a non-breaking change. * For all of the crates, I used `cargo set-version -p $CRATE --bump $STATUS` (where `STATUS` is `patch` or `minor`) to update the versions, and the depended-upon versions.
* Allow use of RetainMut, since we do not require Rust 1.61 yet.Nick Mathewson2022-05-241-0/+2
|
* impl_standard_builder: Test the Deserialize implIan Jackson2022-05-121-1/+1
| | | | | | | | | | 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.
* Rename impl_standard_builder from impl_default_via_builderIan Jackson2022-05-121-2/+2
| | | | | | | | | | | | 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.
* No longer derive Default on three structs which derive BuilderIan Jackson2022-05-111-1/+4
|
* Bump the version of every* crate to 0.3.0Nick Mathewson2022-05-061-16/+16
| | | | * Except for safelog and fs-mistrust, which are new.
* Update README.md files (automated).Nick Mathewson2022-05-061-2/+2
|
* Switch to derive_builder_arti_forkIan Jackson2022-05-061-1/+1
| | | | | | | | | For reference, the git source for this crate (and the others in its workspace) currently lives in my personal github account (ijackson). If this fork turns out to be long-lived and gains features and/or users, it would be good to move it to a gitlab somewhere. I have granted Nick crate ownership on the crates.io system.
* config derive attrs: Make builders serde, and validated structs notIan Jackson2022-05-053-7/+5
| | | | | | | | | | | | | | | * 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.)
* Merge branch 'socket-addr-list-builder' into 'main'Ian Jackson2022-05-042-23/+28
|\ | | | | | | | | FallbackDir: orports: Introduce and use VecBuilder See merge request tpo/core/arti!474
| * FallbackDir: Use VecBuilder for orportsIan Jackson2022-05-042-13/+14
| | | | | | | | | | | | | | 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.
| * FallbackDir: Do orport validation after autogenerated buildIan Jackson2022-05-041-5/+11
| | | | | | | | This avoids it having to recapitulate defaulting logic.
| * FallbackDir: Do not consider defaulted-empty orport list to be validIan Jackson2022-05-041-7/+5
| |
* | GuardUsage: restrictions: Use list builderIan Jackson2022-05-042-38/+54
|/ | | | | | | | | | | | | | Although these do not appear in the config, it does have a builder. It seems sensible to get rid of this ad-hoc list manipulation site, and replace it with our standard list builder API. define_list_builder_helper requires that the builder element type be Deserialize. Currently GuardUsageRestriction is a transparent, public enum, so we aren't really exposing anything. We could introduce GuardUsageRestrictionBuilder now, but since it's not in the config and thereofore only in the public API of the lower crates, we can definitely put that off.
* Change builder list APIIan Jackson2022-05-041-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 'derive-builder-git-fixup' into 'main'eta2022-04-271-1/+1
|\ | | | | | | | | derive_builder: Use git dep everywhere, rather than cargo patch See merge request tpo/core/arti!477
| * derive_builder: Use git dep everywhere, rather than cargo patchIan Jackson2022-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `[patch]` approach causes the tree not to build when used as a dependency, unless the `[patch]` is replicated into the depending project. Instead, replace our `derive_builer =` dependencies with a reference to a specific git commit: perl -i~ -pe 'next unless m/^derive_builder/; s#"(0\.11\.2)"#{ version = "$1", git = "https://github.com/ijackson/rust-derive-builder", rev = "ba0c1a5311bd9f93ddf5f5b8ec2a5f6f03b22fbe" }#' crates/*/Cargo.toml Note that the commitid has changed. This is because derive_builder is in fact a workspace of 4 crates. 3 of them are of interest to arti itself (the 4th exists only for testing). So the same "add git revision" treatment had to be done to the `derive_builder` and `derive_builder_macro` crates. Each dependency edge involves a new commit in the derive_builder workspace, since we can't create a git commit containing its own commitid. (We want to use commits, rather than a branch, so that what we are depending on is actually properly defined, and not subject to the whims of my personal github namespace.) There are no actual code changes in derive_builder.
* | Fix grammar and typosSamanta Navarro2022-04-272-3/+3
| |
* | Upgrade to Postage 0.5.0Nick Mathewson2022-04-261-1/+1
|/
* Merge branch 'main' into 'msrv_1_56'Nick Mathewson2022-04-261-48/+14
|\ | | | | | | | | | | # Conflicts: # crates/tor-config/Cargo.toml # crates/tor-dirmgr/src/state.rs # doc/semver_status.md
| * list_builder: Use $crate namespaced importsIan Jackson2022-04-251-1/+1
| | | | | | | | | | | | | | I don't think we need to bother with things in the prelude, but doing it for serde and ConfigBuildError seems nice. Noticed while writing a test case.
| * Document defaults for all the config listsIan Jackson2022-04-251-1/+4
| | | | | | | | | | | | | | 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.
| * Use better syntax for doc comment attributeIan Jackson2022-04-251-7/+5
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798020
| * Introduce define_list_config_builder macroIan Jackson2022-04-251-48/+13
| | | | | | | | | | | | 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
* | squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-251-1/+0
| | | | | | | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* | Bump every crate's edition to 2021.Nick Mathewson2022-04-251-1/+1
| | | | | | | | | | | | | | | | | | | | This is an automated change made with a perl one-liner and verified with grep -L and grep -l. Some warnings are introduced with this change; they will be removed in subsequent commits. See arti#208 for older discussion on this issue.
* | Add 'rust-version = "1.56"' to every Cargo.toml file.Nick Mathewson2022-04-251-0/+1
|/ | | | | | | This change was made automatically with a perl one-liner, and confirmed with `grep -L`. The `rust-version` field itself was introduced in 1.56.0.
* fix typo in doctrinity-1686a2022-04-251-1/+1
|
* fallback list: Introduce and use FallbackListBuilderIan Jackson2022-04-222-9/+58
| | | | | | | | | 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.
* fallback list: Move default list into tor-guardmgrIan Jackson2022-04-223-0/+1729
| | | | | | | | | | This is where the FallbackList type is. We are going to want to provide a builder too, which ought to impl Default. This means that the default value for the type must be next to the type. In any case, it was anomalous that it wasn't. This commit is pure code motion.
* arti-client: Report clock skew when it is noteworthyNick Mathewson2022-04-121-0/+5
| | | | | (Also, blame clock skew when it is an explanation of why we cannot finish a connection.)
* circmgr: re-export clock skew estimates.Nick Mathewson2022-04-122-0/+4
|
* GuardMgr: publish skew estimates.Nick Mathewson2022-04-123-9/+86
| | | | | | Instead of just having a function that recalculates the latest clock skew, instead recalculate the clock skew when it may have changed, and notify other processes via a postage::watch.
* guardmgr: fix a unit test panic.Nick Mathewson2022-04-111-1/+5
| | | | | | | Apparently on OSX you are not allowed to construct an Instant that is a long time before the time when the test is running. Also, fix the length of a year in this test.
* Fold FallbackStatus into Entry.Nick Mathewson2022-04-111-44/+31
| | | | This simplifies the code a lot.
* Add a couple of TODO items to clock-skew estimator.Nick Mathewson2022-04-111-0/+7
|
* Implement a better clock skew estimator.Nick Mathewson2022-04-112-16/+308
| | | | | | | | This time, our estimator discards outliers, takes the mean of what's left, and uses the standard deviation to try to figure out how seriously to take our report of skew/not-skew. These estimates are still not actually used.
* Initial functions to determine and expose a clock skew estimate.Nick Mathewson2022-04-076-1/+111
| | | | | (This is just a placeholder; I'm going to make the functions smarter in the next commit.)
* Reformat tor-guardmgr/Cargo.tomlNick Mathewson2022-04-071-12/+12
|
* GuardMgr: record clock skew information.Nick Mathewson2022-04-076-22/+106
| | | | (It is not yet actually used.)
* Create and use API to report guard/fallback skew.Nick Mathewson2022-04-072-3/+17
| | | | (The information is not yet recorded.)
* Merge branch 'main' into 'separate_dir_status'Nick Mathewson2022-04-061-0/+24
|\ | | | | | | # Conflicts: # doc/semver_status.md
| * guardmgr: implement HasRetryTime.Nick Mathewson2022-04-041-0/+24
| |
* | Fix a rustdoc linkNick Mathewson2022-04-051-5/+5
| |
* | GuardMgr: Tests for copy_status_from.Nick Mathewson2022-04-052-0/+65
| |
* | GuardMgr: Tests for note_external_{success,failure}.Nick Mathewson2022-04-051-0/+57
| |
* | Rewrite and fix Guard::copy_status_from.Nick Mathewson2022-04-053-21/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The old version of this function was error-prone, and in fact had errors: it was too easy to forget to add non-persistent fields, and that's exactly what we forgot in a few cases (`microdescriptor_missing`, `circ_history`, and `suspicious_behavior_warned`). The new version of this function consumes both of the incoming Guards, and constructs every field explicitly so that we can't forget to list any. Closes #429.
* | GuardMgr: Track directory status and circuit status separately.Nick Mathewson2022-04-054-69/+235
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we treated successfully building a circuit to a guard as a "success", and any failure, including a directory cache failure, as a failure. With this change, guards now have separate success/failure and retry status for circuit usage and directory usage. This change is needed for guard-as-directory retry to have reasonable behavior. Otherwise, when a guard succeeds at building a circuit, that clears the directory-is-failing status and makes us retry the guards to quickly.
* | Allow DirStatus objects to have different timeout floorsNick Mathewson2022-04-042-21/+24
| | | | | | | | This will help when we give Guards a DirStatus as well.