summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/channel
Commit message (Collapse)AuthorAgeFilesLines
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-273-0/+3
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* tor-proto: rustfmtIan Jackson2023-01-061-1/+2
| | | | Not sure why the tree didn't have this newline already. "Whatever".
* tor-proto: When relay IDs mismatch, the IDs are sensitive in errorsIan Jackson2023-01-061-2/+4
|
* Merge branch 'test-lints' into 'main'eta2023-01-062-0/+17
|\ | | | | | | | | Add test lint blocks to all "mod test" See merge request tpo/core/arti!937
| * test lint blocks: Add many many automaticallyIan Jackson2022-12-122-0/+17
| | | | | | | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* | Use parse_rfc3339() in the tor-proto crateNeel Chauhan2022-12-161-1/+2
| |
* | Merge branch 'err-dyn-report' into 'main'Ian Jackson2022-12-151-1/+1
|\ \ | | | | | | | | | | | | Error logging (ErrorReport, .report()) POC See merge request tpo/core/arti!936
| * | tor-proto: reactor tests: Use debug fmt on an errorIan Jackson2022-12-121-1/+1
| |/ | | | | | | | | | | | | In tests, debug fmt is usually appropriate. Found while looking for a candidate for https://gitlab.torproject.org/tpo/core/arti/-/issues/680
* / Tackling issue #663 (Use humantime in tests)coral2022-12-121-1/+1
|/
* Merge branch 'rename_for_to_from' into 'main'Nick Mathewson2022-10-251-2/+2
|\ | | | | | | | | tor-cell: Rename for_client and for_relay See merge request tpo/core/arti!793
| * tor-cell: Rename for_client and for_relayEmil Engler2022-10-211-2/+2
| | | | | | | | | | | | | | This commit renames the for_client and for_relay functions to from_client and from_relay respectively, in order to indicate their origin, as the term "for" is more likely to indicate a destination, which is not true in that situation.
* | linkspec: Remove now-useless declared_peer_addrNick Mathewson2022-10-241-3/+4
|/ | | | The singleton variation here is almost never what we want.
* Allow "clippy::single_char_pattern" in tests.Ian Jackson2022-10-121-0/+1
| | | | | | | This lint exists for perf reasons, and this is rarely relevant in tests. Using double quoted str is generally cognitively less burdensome.
* Change multiplicity of ChannelMethod and addressesNick Mathewson2022-10-111-2/+2
| | | | | | | Now each `ChanTarget` has at most one `ChannelMethod`, and only `Direct` `ChannelMethods` can have multiple addresses. Closes #600.
* Clarify limits on socket address from ChannelMethodNick Mathewson2022-10-061-2/+2
|
* tor-linkspec: Remove the old OwnedFoo::new() functionsNick Mathewson2022-10-062-5/+15
| | | | These are now builders.
* tor-proto: Preserve the ChannelMethod, not the SocketAddrNick Mathewson2022-10-061-21/+42
|
* add feature annotation not added by doc_auto_cfgtrinity-1686a2022-08-241-0/+1
|
* channel padding: Only do anything with link protocol 5Ian Jackson2022-08-171-0/+7
| | | | | | | Or rather, if we *didn't* negotiate 4, which is too old. As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2828354
* channel padding: Properly advertise link protocol 5Ian Jackson2022-08-171-3/+2
| | | | | | | | | We already actually send and negotiate the padding, since !657, but we ought to negotiate a protocol version where that's not a violation! As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2828354
* channel padding: Move initial config of ChannelPaddingInstructionsIan Jackson2022-08-171-6/+5
| | | | | | | | | | | | | Making ChannelPaddingInstructions::default() accurately reflect the initial state of the reactor's padding timer simplifies the code somewhat. (When padding is wanted, parameters are computed and inserted explicitly, so the only change is that if we start out dormant, we defer setting the timer parameters until necessary.) As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2827249
* channel padding: Parameters: default_padding replaces Default implIan Jackson2022-08-172-1/+7
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2827249
* channel reactor: Add some commented-out debug for paddingIan Jackson2022-08-171-1/+5
|
* channel padding: Correctly always send the timer parametersIan Jackson2022-08-171-1/+8
| | | | Fixes "chanmgr configuration: Avoid sending needless initial update(s)"
* channel padding: Abolish ARTI_EXPERIMENTAL_CHANNEL_PADDING env varIan Jackson2022-08-171-8/+0
| | | | This was for testing and is no longer needed.
* ChannelPaddingInstructions: Update and expand docsIan Jackson2022-08-172-11/+41
|
* ChannelPaddingInstructions: Rename `params` field to `insns`Ian Jackson2022-08-171-6/+6
|
* Rename ChannelsParams types to ChannelPaddingInstructions (fmt)Ian Jackson2022-08-171-1/+4
| | | | Run rustfmt; no other changes.
* Rename ChannelsParams types to ChannelPaddingInstructionsIan Jackson2022-08-172-38/+38
| | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826167 This makes some lines too long; I will run rustfmt in a separate commit for clarity.
* Rename PaddingParameters::all_zeroes constructor to disabledIan Jackson2022-08-171-4/+2
|
* tor-cell: PaddingNegotiate::default_reducedIan Jackson2022-08-171-10/+0
| | | | | | | | | | | Get rid of unneeded constructor. We never need to use hardcoded reduced padding parameters during negotiation cell construction. If we are using reduced padding parameters, the layers which decide this have netparams to use. Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826092
* tor-cell: PaddingNegotiate::start: take IntegerMillisecondsIan Jackson2022-08-171-2/+1
|
* channel: Clarify (and in some places replace) "frontend" terminologyIan Jackson2022-08-172-3/+5
|
* tor-proto channel padding: Document PADDING_NEGOTIATE overwritingIan Jackson2022-08-171-0/+3
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2825979
* channel padding: Rename low_ms and high_msIan Jackson2022-08-171-13/+13
| | | | | These have the unit in the type. Putting that in the field name too is otiose.
* tor-proto, testing: Provide accessors for ChannelsParamsUpdatesIan Jackson2022-08-161-0/+11
|
* 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.