aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-guardmgr/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * GuardMgr: Support for multiple guard setsNick Mathewson2022-06-172-33/+98
| | | | | | | | | | | | | | guard-spec.txt specifies that we have multiple separate samples of guards that we can use depending on whether the filter is restrictive or not. Here we implement the rules for switching between samples.
| * Move set_filter into GuardMgrInner.Nick Mathewson2022-06-172-41/+33
| | | | | | | | | | Convert its argument type to Option<&NetDir> to better match the rest of the API.
| * GuardMgr: Function to tell how permissive a filter is.Nick Mathewson2022-06-171-0/+50
| | | | | | | | | | | | | | | | | | When we're filtering guards, we have to check whether the filter is "restrictive": if it forbids most of the guards (by bandwidth), we keep its guards separated from the main set. If it is super-restrictive, we also warn. This functionality is specified in guard-spec.txt.
| * GuardMgr: Also apply filters to fallback directories.Nick Mathewson2022-06-172-7/+12
| |
| * GuardMgr: remove disallowed addresses from returned FirstHops.Nick Mathewson2022-06-174-2/+54
| | | | | | | | | | | | | | | | Since a guard can have a bunch of addresses, and the guard is permitted if any one of those addresses is permitted, then we might decide to use a guard with some non-permitted addresses. Thus, we need to filter those addresses before returning the view of the guard as a FirstHop.
| * GuardMgr: Remove old testing filter variant.Nick Mathewson2022-06-172-21/+9
| | | | | | | | | | We don't need to restrict based on bits in the key id any longer, since we have a real filter.
| * GuardMgr: Add a new filter type based on reachable addresses.Nick Mathewson2022-06-171-8/+23
| |
| * Guardmgr: Change the GuardFilter API.Nick Mathewson2022-06-172-19/+45
| | | | | | | | | | The guard filter is now a set of restrictions that can be placed on allowable guards.
* | Merge branch 'config-fix2' into 'main'Nick Mathewson2022-06-161-6/+3
|\ \ | |/ |/| | | | | Use impl_standard_builder more and remove manual Default/builder impls See merge request tpo/core/arti!594
| * impl_standard_builder: Use for tor_guardmgr::FallbackDirIan Jackson2022-06-161-6/+3
| |
* | Merge branch 'clippy_20220614' into 'main'Nick Mathewson2022-06-151-2/+2
|\ \ | |/ |/| | | | | Fix several clippy issues, most with nightly See merge request tpo/core/arti!588
| * Fix clippy::significant_drop_in_scrutinee warningsNick Mathewson2022-06-151-2/+2
| | | | | | | | | | | | | | | | | | This is apparently a new warning from clippy nightly, documented in https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_in_scrutinee . I'm not in love with the temporary variables that this warning wants me to introduce, but it does seem like a decent way to avoid some kinds of deadlock.
* | tor-netdir: testnet: Make construct_netdir infallible (rustfmt)Ian Jackson2022-06-132-9/+3
| | | | | | | | | | Run rustfmt. Separate commit to make review of the substantive commit easier.
* | tor-netdir: testnet: Make construct_netdir infallibleIan Jackson2022-06-132-3/+0
|/ | | | | This is a *lot* of unwraps. The function takes no parameters and is used only for testing. It ought to be infallible.
* Merge branch 'use-testing-rng'Nick Mathewson2022-06-072-12/+33
|\
| * Refactor fallback-set tests to work with deterministic PRNG.Nick Mathewson2022-06-021-10/+29
| | | | | | | | | | The trouble was that one of the helper functions they used did not take a PRNG as an argument.
| * Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-022-4/+6
| | | | | | | | | | | | This only affects uses of thread_rng(), and affects them all more or less indiscriminately. One test does not work with ARTI_TEST_PRNG=deterministic; the next commit will fix it.
* | GuardMgr: Use installed netdir provider when we want a netdirNick Mathewson2022-06-071-20/+73
| | | | | | | | | | | | | | | | | | | | | | Some of our existing code optionally takes a netdir from the caller. When it doesn't give us one, use the netdir from the installed NetDirProvider. (Possibly someday we should remove the NetDir arguments entirely. I'm deferring that because there are only two APIs affected, and because making this change would force us to rewrite a pretty large mess of unit tests.)
* | Move responsibility for GuardMgr NetDir updates to GuardMgr.Nick Mathewson2022-06-072-0/+58
| | | | | | | | | | | | | | | | | | | | | | Previously it was the job of a task in CircMgr to do this; but we're going to want to give GuardMgr full access to the latest NetDir for this, and for other code-simplification reasons. With this change I'm deprecating a couple of functions in tor-circmgr. It's no longer necessary for us to have an artificial external way for you to feed new NetDirs to a circmgr. (I could just remove them, but I want practice deprecating.)
* | 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.
* 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
|
* 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).
* Fix grammar and typosSamanta Navarro2022-04-271-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.
* 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-222-0/+1728
| | | | | | | | | | 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-122-9/+85
| | | | | | 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-111-16/+306
| | | | | | | | 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-075-1/+110
| | | | | (This is just a placeholder; I'm going to make the functions smarter in the next commit.)