Commit Graph

3818 Commits

Author SHA1 Message Date
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
Ian Jackson 2ed2fc4ac7 base64: Move some tests into a separate function, placating clippy 2022-06-23 19:21:55 +01:00
Ian Jackson 20e41c30fe base64: Add yet more test cases 2022-06-23 18:32:58 +01: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
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 0bd375cb34 Merge branch 'channel' into 'main'
Plumb channel padding timing parameters from netdir to tor-proto

See merge request tpo/core/arti!586
2022-06-21 18:37:27 +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