aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/channel
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-proto: Make "testing" feature that exports some thingsIan Jackson2022-08-161-1/+3
| | | | | We are going to want this for through-the-layers padding control testing.
* channel padding: Send negotiation cellsIan Jackson2022-08-162-0/+9
|
* tor-proto channel: Make arrangements to send PADDING_NEGOTIATEIan Jackson2022-08-161-2/+34
| | | | | | | | | | | | | This is actually a general facility for inserting locally-generated cells into the outgoing stream. It doesn't seem to be possible to do this without adding an additional condition check to the reactor, since we need to insert it into the right place in the stream, giving it priority over data, and only using it up if there was room in the output. We don't engage this machinery yet, because nothing sets special_outgoing.
* chanmgr configuration: Avoid sending needless initial update(s)Ian Jackson2022-08-161-5/+6
| | | | | | | | | | | Change ChannelsParams::initial_update to compare fields with their default values, and, if they're the same as the default, not to include them in the returned update. And if that update is then empty, return None. The overall effect is to avoid the call to chan.reparameterize if we're using the builtin default parameters, which is usual.
* channel params: ChannelsParamssUpdates: provide combine()Ian Jackson2022-08-161-0/+13
| | | | | We're going to need this because the frontend is going to need to defer some channel padding parameters updates.
* channel params: Add a missing comma.Ian Jackson2022-08-161-1/+1
| | | | | | | Unfortunately, because we don't have derive-adhoc here yet, rustfmt didn't get to notice that this comma was needed. We are going to add field(s), so add the comma now.
* channel params: Rename initial_update (from total_update)Ian Jackson2022-08-161-3/+3
| | | | The semantics of this are going to become a bit more subtle.
* tor-proto: padding::Parameters: Provide all_zeroesIan Jackson2022-08-161-0/+10
| | | | | This exists so that we handle this case specially, as we will need to, and so that we can represent disablement in a Parameters.
* tor-proto: padding::Parameters::padding_negotiate_cellIan Jackson2022-08-161-1/+17
| | | | | The channel manager is going to use this as part of constructing the right cell for padding neogotiattion.
* tor-proto: padding::Parameters: Provide default_reduced constructorIan Jackson2022-08-161-0/+12
| | | | We're going to want this so that we can do reduced padding.
* channel padding: Add doc commentary with the channel padding planIan Jackson2022-08-162-0/+27
| | | | | | | Much of this does not exist yet. It will do by the end of this branch. Expand a doc note for ChannelsParamsUpdates too.
* tor-proto: padding::Parameters: use impl_standard_builderIan Jackson2022-08-161-7/+3
| | | | | | | This is more standard. It also provides the ::build() method. This isn't a config type, and build failures ought not to happen, so we use Bug for the error.
* tor-proto: Unify the check_match code in channel and handshakeNick Mathewson2022-08-101-27/+15
| | | | | | | | | | This had to become a new internal function, since at the point that the handshake needs this code, it does not yet have a Channel to use. This change made the error messages in the handshake code more informative: and now they require a regex to check. Later, we might want to defer formatting these strings, but I don't think we need to do it now.
* Final (?) API revisions for tor-linkspecNick Mathewson2022-08-101-10/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, each individual identity type becomes optional. The functions that expose them unconditionally are now in a "legacy" trait that only some downstream types are expected to implement. There are new convenience APIs in HasRelayIds: * to return Option<&keytype>, * to see if one identity-set contains another. This commit will break several downstream crates! For the reviewer's convenience, I will put the fixes for those crates into a series of squash! commits on this one. tor-netdir ---------- Revise tor-netdir to accept optional identities. This required some caveats and workarounds about the cases where we have to deal with a key type that the tor-netdir code does not currently recognize at all. If we start to add more identity types in the future, we may well want more internal indices in this code. tor-proto --------- In order to make tor-proto support optional identities, there were fewer changes than I thought. Some "check" functions needed to start looking at "all the ids we want" rather than at "the two known IDs"; they also needed to accommodate that case where we don't have an ID that we demand. This change will also help with bridges, since we want to be able to connect to a bridge without knowing all of its IDs up front. The protocol currently _requires_ the two current ID types in some places. To deal with that, I added a new `MissingId` error. I also removed a couple of unconditional identity accessors for chanmgr; code should use `target().identity(...)` instead. tor-chanmgr ----------- This is an incomplete conversion: it does not at all handle channel targets without Ed25519 identities yet. It still uses those identities to index its internal map from identity to channel; but it gives a new `MissingId` error type if it's given a channel target that doesn't have one. We'll want to revise the map type again down the road when we implement bridges, but I'd rather not step on the channel-padding work in progress right now. tor-guardmgr ------------ This change is mostly a matter of constructing owned identity types more sensibly, rather than unwrapping them directly. There are some places marked with TODOs where we still depend on particular identity types, because of how the directory protocol works. This will need revisiting when we add bridge support here. tor-circmgr ----------- These changes are just relatively simple API changes in the tests.
* Remove some testing-only reimplementations of OwnedChanTarget.Nick Mathewson2022-08-021-17/+1
| | | | These predate OwnedChanTarget, and are no longer needed.
* change usage of PublicKey to Ed25519 in tor-certtrinity-1686a2022-07-231-5/+3
| | | | and propagate to other affected crates
* change check_key to take a Option<&_> instead of &Option<_>trinity-1686a2022-07-231-2/+2
|
* tor-cell: Make encoding method signatures fallible.Nick Mathewson2022-07-111-1/+5
|
* Merge branch 'clippy' into 'main'Ian Jackson2022-06-241-3/+9
|\ | | | | | | | | Fix clippy nightly again See merge request tpo/core/arti!603
| * clippy: Consolidate many lints in maint/add_warningIan Jackson2022-06-241-3/+9
| | | | | | | | | | | | 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.
* | tor-proto: split and elaborate tor_bytes::Error instancesNick Mathewson2022-06-231-5/+14
| | | | | | | | | | | | | | | | | | 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.
* | tor-proto: Split CellErr based on activity.Nick Mathewson2022-06-233-7/+15
| | | | | | | | | | | | Failing to encode is fundamentally different from failing to decode. We now treat those separately, and describe _what_ we failed to encode or decode.
* | tor-proto: clean up error names and messagesNick Mathewson2022-06-233-26/+26
|/ | | | | This avoids adding additional information for now; that will come on the next commits.
* channel padding: Rename ChannelsParams from ChannelsConfig (rustfmt)Ian Jackson2022-06-211-1/+1
| | | | Consequential ordering changes.
* channel padding: Rename ChannelsParams from ChannelsConfigIan Jackson2022-06-212-53/+53
| | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2814276 Change names and comments and docs everywhere.
* tor-proto: err: Provide ChannelClosed as a separate unit errorIan Jackson2022-06-211-2/+2
|
* channel padding: Use IntegerMilliseconds in padding::ParametersIan Jackson2022-06-211-10/+11
|
* Fix docs for `CtrlMsg::ConfigUpdate`Ian Jackson2022-06-211-5/+2
| | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2813565
* Fix typoseta2022-06-211-1/+1
|
* channel padding: Introduce ChannelsConfig and reconfigure facilityIan Jackson2022-06-213-2/+226
| | | | Nothing geenrates config updates yet.
* channel padding timer: Support reconfigurationIan Jackson2022-06-211-4/+15
| | | | Nothing calls this yet.
* channel padding timer: Allow creation without providing parameters yetIan Jackson2022-06-211-14/+30
| | | | It turns out that we are going to want this.
* channel padding: Test creation in disabled stateIan Jackson2022-06-211-0/+12
| | | | | We're about to split the main new() function off so write a separate test for new_disabled().
* channel padding: Make Parameters a pub struct with builderIan Jackson2022-06-211-2/+13
| | | | chanmgr is going to want to make one of these from a NetDir.
* Merge branch 'config-fix2' into 'main'Nick Mathewson2022-06-161-0/+1
|\ | | | | | | | | Use impl_standard_builder more and remove manual Default/builder impls See merge request tpo/core/arti!594
| * tor-proto: channel: Tell clippy it's ok to print in testsIan Jackson2022-06-161-0/+1
| |
* | Permit eprintln in channel-padding test.Nick Mathewson2022-06-151-0/+1
|/ | | | | There is not, apparently, an eprintln equivalent for allow-dbg-in-tests.
* channel padding timer: Explain why next() in select_biased!Ian Jackson2022-06-091-0/+7
|
* channel padding timer: document state invariantsIan Jackson2022-06-091-2/+24
| | | | There aren't very many.
* Fix more typos in comments, from a spellcheckerIan Jackson2022-06-091-6/+6
|
* Fix typo in commentNick Mathewson2022-06-091-1/+1
|
* Fix erroneous commentNick Mathewson2022-06-091-1/+1
|
* Fix typos in commentsNick Mathewson2022-06-091-3/+3
|
* tor-proto: padding: Test padding timer distributionIan Jackson2022-06-081-0/+123
|
* tor-proto: channel: Use padding::TimerIan Jackson2022-06-082-11/+30
|
* tor-proto: channel: Provide padding::TimerIan Jackson2022-06-081-0/+405
|
* Merge branch 'sleep' into 'main'Ian Jackson2022-06-082-51/+102
|\ | | | | | | | | Plumb a SleepProvider (now Clone + ....) into Channel See merge request tpo/core/arti!569
| * Plumb a SleepProvider into the channel reactorIan Jackson2022-06-082-51/+102
| | | | | | | | | | The channel reactor is going to want to be able to sleep so that it can do padding, so it needs a SleepProvider.
* | Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-021-1/+2
|/ | | | | | 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.
* prepare_send_from: clippy: Replace some or_else with orIan Jackson2022-05-231-2/+2
|