Nick Mathewson
82766e74e4
Improve display for tor-dircache errors.
...
These errors no longer use Debug to dump the `Option<SourceInfo>`, but
instead produce reasonable text. Also, I've fixed the SourceInfo
Display implementation so that it now says that it got the error
"from $source via $circuit" rather than the other way around.
2022-07-07 14:07:04 -04:00
Nick Mathewson
d681967b61
dirclient: Generalize MdSha256Empty to EmptyRequest.
...
(It makes sense to use this for things that are not in fact lists of
SHA256 digests of Microdescriptors.)
2022-07-07 14:07:04 -04:00
Nick Mathewson
1735b70769
Note semver break in tor-guardmgr::Error.
2022-07-07 13:20:57 -04:00
Nick Mathewson
3a2631ff9e
Remove now-unused NoGuardsUsable case.
2022-07-07 13:16:06 -04:00
Nick Mathewson
287fe915f9
Improve message for failure to select a guard.
...
This uses similar techniques to the commit I just did for Fallbacks.
2022-07-07 13:16:06 -04:00
Nick Mathewson
d7a626aaa8
Add more information to failed-to-select fallback errors.
...
Also re-order the filters to be a little more logical.
2022-07-07 13:16:06 -04:00
Nick Mathewson
fecc57fbef
FilterCount: Add a simple Display helper.
...
This is a helper rather than a Display implementation because it
isn't the only logical way to display these values. (In fact,
without context, it isn't even the _most_ logical way)
2022-07-06 15:39:30 -04:00
Nick Mathewson
b6e0eea2b0
New "counting filter" iterator helper in tor-basic-utils.
...
This is going to make it simpler to write the code in guardmgr (and
later in circmgr) that keeps track of how many relays were rejected
for what reason. The latter, in turn, should improve error messages
when we're unable to pick a guard or a path.
2022-07-06 15:39:14 -04:00
Nick Mathewson
373b9e2ccf
GuardMgr: tweak an error message.
2022-07-06 15:39:14 -04:00
Ian Jackson
357606a479
Merge branch 'chanmgr-error-cleanup' into 'main'
...
ChanMgr: Add more contextual info to error types.
See merge request tpo/core/arti!616
2022-07-06 17:26:49 +00:00
eta
0537e88d80
Merge branch 'persist-error-cleanup' into 'main'
...
tor-persist: Big refactoring on Error type.
See merge request tpo/core/arti!614
2022-07-06 17:20:43 +00:00
Nick Mathewson
7213c4a45f
Add a semver note.
2022-07-06 11:51:28 -04:00
Nick Mathewson
dd491931c8
ChanMgr: errors: attribute errors to correct address.
...
Even when keys are relevant, we still don't want to attribute errors
to a set of addresses when we have a single address that we're
connected with.
2022-07-06 11:51:28 -04:00
Nick Mathewson
bc9db9b84c
ChanMgr: Add more contextual info to error types.
...
Now each type has a peer. In some cases this peer is just an
address, whereas in others (where key is relevant or address isn't
yet narrowed down) it's a full OwnedChanTarget.
2022-07-06 11:51:28 -04:00
Nick Mathewson
853aed6859
tor-persist: Big refactoring on Error type.
...
Every error now has an action (what we were trying to do), a
resource (what we were trying to do it to), and a source (what
problem we encountered).
Initially I tried to add "action" and "resource" fields to error
variants individually, but that led to a combinatorial explosion.
Part of #323 .
2022-07-06 11:47:17 -04:00
Nick Mathewson
48e44b0140
Implement functionality to construct signed Ed25519 certs.
...
This is behind a feature flag, since it isn't needed for pure
clients: only onion services and relays need this.
I've named the object that constructs these certs
`Ed25519CertConstructor` because it doesn't follow the builder
pattern exactly: mainly because you can't get an Ed25519Cert out of
it. _That_ part is necessary because we require that an Ed25519Cert
should only exist if the certificate was found to be well-signed
with the right public key.
Closes #511 .
2022-07-06 11:11:04 -04:00
Nick Mathewson
56fefd7adf
tor-llcrypto: expose the Signer API from ed25519-dalek
2022-07-06 11:11:04 -04:00
Ian Jackson
6878e3a2d4
Merge branch 'update-rsa-v2' into 'main'
...
Update `rsa` dependency (and use `x25519-dalek` prerelease)
Closes #448
See merge request tpo/core/arti!612
2022-07-06 14:42:26 +00:00
eta
c2e2da5dc3
Update `rsa` dependency (and use `x25519-dalek` prerelease)
...
- arti#448 and arti!607 highlight an issue with upgrading `rsa`: namely,
the `x25519-dalek` version previously used has a hard dependency on
`zeroize` 1.3, which creates a dependency conflict.
- However, `x25519-dalek` version `2.0.0-pre.1` relaxes this dependency.
Reviewing the changelogs, it doesn't look like that version is
substantially different from the current one at all, so it should be
safe to use despite the "prerelease" tag.
- The new `x25519-dalek` version also bumps `rand_core`, which means we
don't have to use the RNG compat wrapper in `tor-llcrypto` as much.
closes arti#448
2022-07-06 14:57:45 +01:00
Ian Jackson
9318e8712a
Fix clippy needless deref
2022-07-06 12:05:57 +01:00
Ian Jackson
8f63c07b5f
tor-netdoc: b64 tests: add exhaustive roundtrip test
2022-07-06 12:04:23 +01:00
Nick Mathewson
aeef36a538
tor-persist: Move Error to a module.
2022-07-06 11:38:10 +01:00
spongechameleon
1242925e68
Add unit tests for arti-hyper's uri -> host,port,tls conversion
2022-07-05 13:45:41 -06:00
Ian Jackson
a63d540d68
Merge branch 'bump-base64ct' into 'main'
...
Bump `base64ct` crate `1.5.0` -> `1.5.1`
See merge request tpo/core/arti!608
2022-07-05 13:36:48 +00:00
Nick Mathewson
56f931e8e1
Merge remote-tracking branch 'origin/mr/610'
2022-07-05 09:10:10 -04:00
Richard Pospesel
61119d5004
Fixed typo in convert_curve25519_to_ed25519_private comments
2022-06-29 16:52:59 +00:00
Dimitris Apostolou
e5175a2178
Fix typo
2022-06-28 14:40:25 +03:00
Arturo Marquez
af4970ec1f
Bump `base64ct` crate `1.5.0` -> `1.5.1`
...
This new release checks for invalid symbols in non-padded inputs
for decoding. Therefore, we can get rid of the logic implemented
in `https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/600 `
2022-06-27 23:10:58 -05:00
Nick Mathewson
1dda69af2b
Remove semver.md files now that 0.5.0 is out
2022-06-24 13:31:38 -04:00
Nick Mathewson
20435aea75
Bump crate and dependency versions.
...
These were done with the following commands:
```
cargo set-version -p tor-basic-utils --bump patch
cargo set-version -p fs-mistrust --bump minor
cargo set-version -p tor-error --bump patch
cargo set-version -p tor-config --bump patch
cargo set-version -p tor-units --bump patch
cargo set-version -p tor-rtcompat --bump minor
cargo set-version -p tor-llcrypto --bump patch
cargo set-version -p tor-bytes --bump minor
cargo set-version -p tor-socksproto --bump minor
cargo set-version -p tor-cert --bump minor
cargo set-version -p tor-cell --bump minor
cargo set-version -p tor-proto --bump minor
cargo set-version -p tor-netdoc --bump patch
cargo set-version -p tor-netdir --bump minor
cargo set-version -p tor-persist --bump patch
cargo set-version -p tor-chanmgr --bump minor
cargo set-version -p tor-guardmgr --bump minor
cargo set-version -p tor-circmgr --bump patch
cargo set-version -p tor-dirclient --bump patch
cargo set-version -p tor-dirmgr --bump minor
cargo set-version -p arti-client --bump patch
cargo set-version -p arti --bump minor
cargo set-version -p arti-bench --bump minor
cargo set-version -p arti-testing --bump minor
```
2022-06-24 12:00:22 -04:00
Nick Mathewson
d5170d5318
Increment versions of crates with trivial changes only.
...
"Trivial" here includes stuff like cargo reformatting, comment
edits, error message string changes, and clippy warning changes.
Crates that depend on these do not need to increment.
2022-06-24 11:43:02 -04:00
Ian Jackson
4831f9d38c
Merge branch 'clippy' into 'main'
...
Fix clippy nightly again
See merge request tpo/core/arti!603
2022-06-24 14:13:58 +00:00
Nick Mathewson
1f8f24dbcb
Merge branch 'dirmgr' into 'main'
...
dirmgr: followups to !587 , mostly using iterators
Closes #468
See merge request tpo/core/arti!599
2022-06-24 13:46:52 +00:00
Ian Jackson
23c352b96b
clippy: Consolidate many lints in maint/add_warning
...
Found these by disabling the nightly dbg macro special case. Now, we
have a mechanism for globally adding suppressions to tests, we can use
that instead.
2022-06-24 14:23:38 +01:00
Ian Jackson
d965dc3f70
clippy: Add standard test lint block to several examples
2022-06-24 14:23:38 +01:00
Ian Jackson
bebf013bef
maint/add_warning: Add two lints via add_warning as a test case
2022-06-24 14:23:38 +01:00
Ian Jackson
72515abf91
maint/add_warning: Add ability maintain test lint blocks
2022-06-24 14:23:38 +01:00
eta
ec3e1f2ada
Merge branch 'error_cleanup_2' into 'main'
...
Error refactoring: bytes, cert, proto.
See merge request tpo/core/arti!604
2022-06-24 13:01:42 +00:00
Nick Mathewson
ea3160737c
Fix a couple of typos in rustdoc comments.
2022-06-24 08:18:15 -04:00
Nick Mathewson
ce4d062c09
Update README.md files from rustdoc.
2022-06-24 08:02:56 -04:00
Nick Mathewson
38004a4f4d
tor-proto: split and elaborate tor_bytes::Error instances
...
Some of these were for decoding particular objects (we now say
what kind of objects), and some were unrelated tor_cert errors that
for some reason we had shoved into a tor_bytes::Error.
There is now a separate tor_cert::CertError type, independent from
tor_cert's use of `tor_bytes::Error` for parsing errors.
2022-06-23 15:42:45 -04:00
Nick Mathewson
35b7b8a47a
tor-proto: Split CellErr based on activity.
...
Failing to encode is fundamentally different from failing to
decode. We now treat those separately, and describe _what_ we failed
to encode or decode.
2022-06-23 14:59:52 -04:00
Ian Jackson
b1aab512ff
Merge branch 'tor-netdoc/use-base64ct' into 'main'
...
Replace `base64` crate with `base64ct` crate in `tor-netdoc`
See merge request tpo/core/arti!600
2022-06-23 18:52:14 +00:00
Nick Mathewson
92fd9fb0de
tor-proto: clean up error names and messages
...
This avoids adding additional information for now; that will come on
the next commits.
2022-06-23 14:35:26 -04:00
Ian Jackson
2ed2fc4ac7
base64: Move some tests into a separate function, placating clippy
2022-06-23 19:21:55 +01:00
Ian Jackson
589c6e52bb
Run maint/add_warning crates/*/src/{lib,main}.rs
...
Update all lint blocks
2022-06-23 19:15:42 +01:00
Ian Jackson
6c110a232c
dirmgr: Use ... .find().is_none() rather than clippy's suggestion
2022-06-23 18:42:33 +01:00
Ian Jackson
20e41c30fe
base64: Add yet more test cases
2022-06-23 18:32:58 +01:00
Nick Mathewson
f699988c41
tor-bytes: Split EncodeError from Error
...
Since there is currently only one error type that can occur when
encoding, it doesn't make sense to use the full Error type here.
This split will help us downstream, as we no longer need to
categorize tor_bytes::Error as "an error in encoding or decoding".
I considered renaming Error to DecodeError, but that had pretty huge
downstream effects, and didn't seem to be worth it.
2022-06-23 08:58:25 -04:00
Nick Mathewson
210f3f1587
Merge branch 'error_cleanup' into 'main'
...
Error cleanup, part 1
See merge request tpo/core/arti!601
2022-06-22 19:43:50 +00:00
Nick Mathewson
813a648ce2
fs-mistrust: convert Io error variant to a struct.
2022-06-22 15:21:34 -04:00
Nick Mathewson
0369995364
tor-cell: convert BytesErr to a struct variant
2022-06-22 15:21:12 -04:00
Arturo Marquez
b72bf50698
Add some more test cases for base64
...
These tests are borrowed from other parts of the `tor-netdoc`
crate.
2022-06-22 11:30:57 -05:00
Arturo Marquez
87ed48271a
Improve base64 tests
...
Request for changes: `https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/600#note_2816252 `
2022-06-22 10:34:01 -05:00
Arturo Marquez
4333708384
Add link to upstream issue
...
As per request, here: `https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/600#note_2816252 `
2022-06-22 09:55:11 -05:00
Nick Mathewson
c3da82fc2d
tor-cell: error usefulness and style fixes
2022-06-22 10:02:42 -04:00
Nick Mathewson
e3e922d03f
Improve error messages in tor-checkable.
2022-06-22 09:48:42 -04:00
Nick Mathewson
5577163387
tor-socksproto: Style and info fixes in errors.
...
(The use of Cow<> in the error message isn't strictly necessary
here, but it's a pattern I want to encourage.)
2022-06-22 09:16:44 -04:00
Nick Mathewson
3120f1092a
Style fixes to tor-bytes errors.
...
Also note an issue with the design of tor-bytes::Error that should
probably go in a separate MR.
2022-06-22 09:00:59 -04:00
Nick Mathewson
7163b7dcc0
Style fixes to tor-protover errors.
2022-06-22 08:50:44 -04:00
Nick Mathewson
f6d6ac7fe9
tor-llcrypto: style fixes on BlindingError
2022-06-22 08:47:18 -04:00
Nick Mathewson
9ba7750dfe
Style fixes to tor-units errors.
2022-06-22 08:42:13 -04:00
Nick Mathewson
bf2336e547
Style fixes to tor-events errors.
2022-06-22 08:39:44 -04:00
Nick Mathewson
c39631af27
tor-config: style fixes on CfgPathError.
2022-06-22 08:36:13 -04:00
Nick Mathewson
37cbd38abc
tor-config: Don't format source error as part of error message
...
This is one I missed earlier.
2022-06-22 08:23:33 -04:00
Nick Mathewson
48653df68f
Style fixes to retry-error error messages.
2022-06-22 08:11:44 -04:00
Nick Mathewson
9102948045
Style fixes to safelog errors.
2022-06-22 08:07:37 -04:00
Nick Mathewson
326ab1a7ae
Editorial improvements on fs-mistrust errors
...
These changes make sure that the errors conform to our preferred
style, and include a description of what exactly we were doing when
something went wrong.
2022-06-22 08:03:15 -04:00
Ian Jackson
d2bd71c5f0
dirmgr: DirBootstrapStatus: Refactor mut_status_for using entries_mut
...
IMO this is rather less confusing.
2022-06-22 10:53:02 +01:00
Ian Jackson
d36c433b36
dirmgr: Use new statuses() helper method
...
The two call sites become clearer, IMO.
2022-06-22 10:53:02 +01:00
Ian Jackson
24d43f83fd
dirmgr: DirBootstrapStatus: Provide statuses and entries_mut
...
We're going to use these in a moment.
One returns entries and the other statuses simply because that's
what's actually going to be wanted.
2022-06-22 10:53:02 +01:00
Ian Jackson
5c51d03efb
dirmgr: Remove a TODO comment
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/587#note_2815945
2022-06-22 10:53:02 +01:00
Arturo Marquez
2d92e9e218
Remove unused `base64` crate
2022-06-21 20:28:58 -05:00
Arturo Marquez
6536ca0f61
Replace `base64` crate with `base64ct` crate
...
Note: the `base64ct` crate rejects invalid characters when the
decoding is done on padded strings. However, the `FromStr` impl
for `B64` can have both padded **and** unpadded inputs, so all
inputs are now padded first, before decoding.
2022-06-21 20:02:33 -05:00
eta
4e3537746f
Merge branch 'display_source_cleanup' into 'main'
...
Do not include error source() in display() format.
See merge request tpo/core/arti!598
2022-06-21 19:34:27 +00:00
Ian Jackson
9b4ba4893e
Merge branch 'stalled_directory' into 'main'
...
Detect and report stalled directory downloads
Closes #468
See merge request tpo/core/arti!587
2022-06-21 19:13:40 +00:00
Ian Jackson
da2e53bf76
tor-chanmgr: Change to use unwrap_void
...
As per discussion in
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2813573
2022-06-21 19:19:28 +01:00
Ian Jackson
a2614729a4
channel padding: Rename ChannelsParams from ChannelsConfig (rustfmt)
...
Consequential ordering changes.
2022-06-21 19:19:28 +01:00
Ian Jackson
7d676cde02
channel padding: Rename ChannelsParams from ChannelsConfig
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2814276
Change names and comments and docs everywhere.
2022-06-21 19:19:28 +01:00
Ian Jackson
ff228e5d9c
channel padding: chanmgr: Clarify a comment
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2813574
2022-06-21 19:19:28 +01:00
Ian Jackson
65e6683b0b
tor-proto: Have Channel::reconfigure throw ChannelClosed
...
Addresses
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2813567
2022-06-21 19:19:28 +01:00
Ian Jackson
13ca24ba3a
tor-proto: err: Provide ChannelClosed as a separate unit error
2022-06-21 19:19:28 +01:00
Ian Jackson
19c52ff8e4
channel padding: Use IntegerMilliseconds in netdir
2022-06-21 19:19:28 +01:00
Ian Jackson
db71018021
tor-netdir: Make CHANNEL_PADDING_TIMEOUT_UPPER_BOUND pub
...
We need this because it is a type parameter for the types of nf_ito_*.
2022-06-21 19:19:28 +01:00
Ian Jackson
9779e5a2e2
channel padding: Use IntegerMilliseconds in padding::Parameters
2022-06-21 19:19:28 +01:00
Ian Jackson
b1b840c7c6
tor-units: IntegerTimeUnit: Provide try_map
...
This lets a caller map the inner value, eg to convert the type.
I don't provide `map` as well as `try_map` now, since I don't need it;
we could add it later if it is desirable (although try_map can always
be used instead).
I was hoping to provide a `TryFrom` instead, but that necesasrily
overlaps with the std conversion impl from IntegerMilliseconds<T> to
IntegerMilliseconds<U> where T == U.
2022-06-21 19:19:22 +01:00
Ian Jackson
0ea34e3280
tor-units: IntegerTimeUnit: Relax condition on T
...
It is semantically quite meaningful for these to contain something
that isn't `TryInto<u64>`. (Of course the `Duration` conversion won't
work without that.)
Indeed, this condition was only applied to two out of the three types.
Prompted by being near this code, but not actually necessary for
anything I'm doing here.
2022-06-21 19:19:22 +01:00
Ian Jackson
ec756c79e7
tor-units: IntegerTimeUnit: Provide as_time_unit deconstructor
...
We're going to need this to use this in the padding timer parameters.
2022-06-21 19:19:22 +01:00
Ian Jackson
db4e5aba97
channel padding parameters update: Drop a redundant clone
2022-06-21 19:19:22 +01:00
Ian Jackson
a5aaa56c3c
channel padding: Change timeout to match C Tor
...
Pending an official value from the spec.
2022-06-21 19:19:22 +01:00
Ian Jackson
2d97ab3677
Fix docs for `CtrlMsg::ConfigUpdate`
...
Prompted by
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2813565
2022-06-21 19:19:22 +01:00
eta
54c7070b30
Fix typos
2022-06-21 19:19:22 +01:00
Ian Jackson
d2b783641d
channel padding: Test timeout updates
2022-06-21 19:19:22 +01:00
Ian Jackson
e0040701d0
tor-chanmgr tests: Add config_update tracking to FakeChannel
2022-06-21 19:19:22 +01:00
Ian Jackson
6e07401e6b
channel padding: Honour NetDir for timeouts
...
But padding is still not enabled by default.
2022-06-21 19:19:22 +01:00
Ian Jackson
e53555f418
channel padding: Add the parameters from the spec to NetDir
2022-06-21 19:19:22 +01:00
Ian Jackson
7f3f426738
channel padding: Plumb settings from chanmgr
2022-06-21 19:19:22 +01:00
Ian Jackson
b5218a0c0e
channel padding: Introduce ChannelsConfig and reconfigure facility
...
Nothing geenrates config updates yet.
2022-06-21 19:19:22 +01:00
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
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
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
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
Ian Jackson
fc3f36e9c9
arti cfg tests: Remove a redundant line that shadows an earlier binding
...
Prompted by review
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/589#note_2813596
2022-06-16 14:34:43 +01:00
eta
ed3baea683
Fix grammar error
2022-06-16 14:34:43 +01:00
Ian Jackson
a0935ca6ee
arti: Enable some pre-config logging
2022-06-16 14:34:43 +01:00
Ian Jackson
d57fc34841
arti: Introduce closure which will be used for pre-config logging
...
Right now this is an IEFI and therefore a no-op.
2022-06-16 14:34:43 +01:00
Ian Jackson
1332e02b61
arti cfg tests: Test that example config works as-is
...
It contains only sections, but we want to detect when that is a problem!
2022-06-16 14:34:43 +01:00
Ian Jackson
0ab60d832a
arti: cfg tests: Refactor to prepare for new test
...
We're going to call this new closure another time.
2022-06-16 14:34:43 +01:00
Nick Mathewson
c4a9c8a1c4
Merge branch 'main' into 'accel-features'
...
# Conflicts:
# crates/arti-client/Cargo.toml
2022-06-16 13:24:46 +00:00
Nick Mathewson
19679a6f13
Remove rustls from tor-rtcompat/full
...
This is another consequence of the `ring` license issue; see #493 .
2022-06-16 08:45:10 -04:00