Commit Graph

3819 Commits

Author SHA1 Message Date
Ian Jackson 33ef338fe2 chanmgr: inner (map): Reorganise to prepare for having more state
The main copy of the (global) configuration for the client's channels
is going to have to live here, inside this mutex.  So this really
needs to become a struct with names fields.
2022-06-21 19:19:22 +01:00
Ian Jackson 09b40d7d81 channel padding timer: Support reconfiguration
Nothing calls this yet.
2022-06-21 19:19:22 +01:00
Ian Jackson e5f3215b95 channel padding timer: Allow creation without providing parameters yet
It turns out that we are going to want this.
2022-06-21 19:19:22 +01:00
Ian Jackson f9414a29b2 channel padding: Test creation in disabled state
We're about to split the main new() function off so write a separate
test for new_disabled().
2022-06-21 19:19:22 +01:00
Ian Jackson 7135b7c4c7 channel padding: Make Parameters a pub struct with builder
chanmgr is going to want to make one of these from a NetDir.
2022-06-21 19:19:22 +01:00
Ian Jackson db4ea619f5 tor-chanmgr: tests: Have unwrap_open return a (mut) reference
This avoids confusing bugs where you try to modify the result and
nothing happens!
2022-06-21 19:19:22 +01:00
Nick Mathewson 08d9bbf33b Do not include error source() in display() format.
According to doc/Errors.md, and in keeping with current best
practices, we should not include display an error's `source()` as
part of that error's display method.  Instead, we should let the
caller decide to call source() and display that error in turn.

Part of #323.
2022-06-21 14:14:14 -04:00
Nick Mathewson 9b7849a293 Refactor DirStatus data structures.
AttemptId is now linked to DirStatus in StatusEntry.

DirBootstrapStatus now has an inner enum to make invalid status
unrepresentable.
2022-06-21 10:26:53 -04:00
Nick Mathewson d95f597323 Run cargo update in preparation for release on Friday 2022-06-21 08:54:12 -04:00
eta 073b64b155 Merge branch 'main' into 'main'
Updated the warning message providing additional information about the type of the proxy port.

See merge request tpo/core/arti!596
2022-06-21 12:47:46 +00:00
0x4ndy 3175d96236 Updated the warning message providing additional information about the type of the proxy port. 2022-06-21 12:47:46 +00:00
Ian Jackson a3d8a425c4 Merge branch 'ring_out_the_old' into 'main'
Enforce no-ring-in-arti/full (and make it true)

See merge request tpo/core/arti!592
2022-06-17 13:42:38 +00:00
Nick Mathewson 9ae57e8bc4 Merge branch 'reachable_addrs_v2' into 'main'
Implement support for reachable_addrs

Closes #491 and #93

See merge request tpo/core/arti!583
2022-06-17 13:16:16 +00:00
Nick Mathewson f4c9b9cc1e Rename guardset-selection function.
Also, improve its documentation.
2022-06-17 08:47:57 -04:00
Nick Mathewson 03568cd4a5 Rename pick_guard, pick_guard_ext.
Now the primary exposed function is `pick_guard` again.

This commit is just function renaming.
2022-06-17 08:47:57 -04:00
Nick Mathewson 1be44891c9 Refactor and document issues with modify_hop.
At the site of modify_hop, we now have a comment explaining the
internal-error issue.

To make the internal error less likely, we lower the modify_hop call
in lib.rs into GuardSet, where it can make sure it's looking at the
same filter as was used to select the guard.

The function name "pick_guard_ext" is not permanent; I'm going to
rename it in the next commit.
2022-06-17 08:47:57 -04:00
Nick Mathewson 96dfa97473 API-fix for extend_sample_as_needed.
Previously, the API said "you need to call this in a loop till it
returns false".  We did that in one place, but not another.

With the introduction of filters, forgetting to loop here becomes a
bug: so instead, change the behavior of extend_sample_as_needed so
it handles looping itself.
2022-06-17 08:47:57 -04:00
Nick Mathewson a92dfa0b2a Remove some outdated comments.
These all say, in one form or another, "there is no guard filtering;
there is only one selection".  That's now false.
2022-06-17 08:47:57 -04:00
Nick Mathewson 89f9e1decb Tweak parameters in guardmgr tests to improve testnet behavior.
The fake network we construct for these tests is small in ways that
can sometimes cause weird behavior with guard filters.  We fix this
by adjusting the parameters of the guard selection algorithm
accordingly in the tests.

With these new parameters, #491 no longer occurs.

This commit also adds comments to explain why the parameters are set
as they are.

Closes #491.
2022-06-17 08:47:57 -04:00
Nick Mathewson 34e8e208cc CircMgr: Enable reachable_addrs filter. 2022-06-17 08:47:57 -04:00
Nick Mathewson 1c5f540dc8 Add a configuration option for reachable_addrs
(This doesn't do anything yet.)
2022-06-17 08:47:57 -04:00
Nick Mathewson fb672dc688 NetDoc: Make AddrPortPattern implement serde traits
I'm using serde_with here to just re-use the Display and FromStr
implementations, since those are what has proven easier to type in
the past.
2022-06-17 08:47:57 -04:00
Nick Mathewson 48a86506be GuardMgr: Support for multiple guard sets
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.
2022-06-17 08:47:57 -04:00
Nick Mathewson e098a5a303 Move set_filter into GuardMgrInner.
Convert its argument type to Option<&NetDir> to better match the
rest of the API.
2022-06-17 08:47:57 -04:00
Nick Mathewson a720f4f667 GuardMgr: Function to tell how permissive a filter is.
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.
2022-06-17 08:47:57 -04:00
Nick Mathewson 19fa946fc7 Make AddrPortPattern and friends implement Eq and PartialEq 2022-06-17 08:46:16 -04:00
Nick Mathewson e3c2a86195 GuardMgr: Also apply filters to fallback directories. 2022-06-17 08:46:16 -04:00
Nick Mathewson a189aaf1fb GuardMgr: remove disallowed addresses from returned FirstHops.
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.
2022-06-17 08:46:16 -04:00
Nick Mathewson 23218fe037 GuardMgr: Remove old testing filter variant.
We don't need to restrict based on bits in the key id any longer,
since we have a real filter.
2022-06-17 08:46:16 -04:00
Nick Mathewson 9c4f31edc1 GuardMgr: Add a new filter type based on reachable addresses. 2022-06-17 08:46:16 -04:00
Nick Mathewson 801b6bec5f Guardmgr: Change the GuardFilter API.
The guard filter is now a set of restrictions that can be placed on
allowable guards.
2022-06-17 08:46:16 -04:00
Nick Mathewson bf15abbb97 Avoid matching crate names by prefix. 2022-06-17 08:41:38 -04:00
Nick Mathewson 5509bd0269 Merge branch 'config-fix2' into 'main'
Use impl_standard_builder more and remove manual Default/builder impls

See merge request tpo/core/arti!594
2022-06-16 20:30:34 +00:00
Nick Mathewson 677f1b8af0 Update check_tree to better detect errors in cargo-tree. 2022-06-16 16:13:11 -04:00
Nick Mathewson 349f9d5000 Don't install cargo-tree: It's built-in. 2022-06-16 15:54:21 -04:00
Ian Jackson 44659ebb8b tor-proto: channel: Tell clippy it's ok to print in tests 2022-06-16 19:33:32 +01:00
Ian Jackson 61bd8b810a Merge branch 'upgrade_float_eq' into 'main'
Upgrade to float_eq 1.0.0

See merge request tpo/core/arti!591
2022-06-16 17:26:04 +00:00
Ian Jackson db51bdcbc1 Merge branch 'config-fix' into 'main'
Config handling and logging fixes

Closes #480

See merge request tpo/core/arti!589
2022-06-16 15:46:18 +00:00
Ian Jackson ed62a575d3 arti: cfg: Remove another needless borrow 2022-06-16 16:08:10 +01:00
Ian Jackson 2ca2c03059 impl_standard_builder: Use for tor_dirmgr::Authority 2022-06-16 15:42:06 +01:00
Ian Jackson e004316942 impl_standard_builder: Use for tor_guardmgr::FallbackDir 2022-06-16 15:42:06 +01:00
Ian Jackson 17caebd284 impl_standard_builder: Use for tor_dirmgr::DownloadSchedule 2022-06-16 15:42:06 +01:00
Ian Jackson c466f13ce3 impl_standard_builder: Use for arti::logging::LogfileConfig 2022-06-16 15:42:06 +01:00
Ian Jackson 90ba8b15de impl_standard_builder: Allow for !Default 2022-06-16 15:42:06 +01:00
Ian Jackson c5bbaf470a arti: logging config: Replace a manual Debug impl 2022-06-16 15:27:00 +01:00
Ian Jackson 8b724d40f8 impl_standard_builder: Use for tor_dirmgr::DownloadScheduleConfig 2022-06-16 15:27:00 +01:00
Ian Jackson 2ab5c0861e impl_standard_builder: Use for tor_dirmgr::NetworkConfig 2022-06-16 15:27:00 +01:00
Ian Jackson e32210a398 impl_standard_builder: Use for tor_dirmgr::DirSkewTolerance 2022-06-16 15:27:00 +01:00
Ian Jackson c895057cb9 tor-config: impl_standard_builder: handle contexts with local Result 2022-06-16 15:27:00 +01:00
Nick Mathewson e1fc59ba5f Merge branch 'accel-features' into 'main'
Top-level (arti and arti-client) features to enable crypto acceleration

Closes #441

See merge request tpo/core/arti!590
2022-06-16 14:19:32 +00:00