summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/channel
Commit message (Collapse)AuthorAgeFilesLines
* tor-proto: Add a tunnel module.David Goulet2025-02-203-10/+10
| | | | | | | | | | | | | Move StreamTarget to the tunnel module and the circuit module. From now on streams will be implemented on tunnels, not circuits. This moves `StreamTarget` to the tunnel module. A future change will replace `ClientCirc` with `ClientTunnel` inside `StreamTarget`. This is mostly code motion, best reviewed with `--color-moved`. Signed-off-by: David Goulet <[email protected]>
* tor-proto: remove `use asynchronous_codec as futures_codec`Neel Chauhan2025-02-062-16/+16
| | | | Closes #1690.
* tor-proto: Remove dependency on tor-netdir.Gabriela Moldovan2025-01-151-39/+6
| | | | | | | | This moves the `NetParameters -> KistParams` conversion to `tor-chanmgr`. Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2706#note_3147557
* tor-proto: Replace constants with caret_int.Gabriela Moldovan2025-01-151-3/+14
|
* tor-rtcompat: Rename UnsupportedStreamOps to NoOpStreamOpsHandle (fmt).Gabriela Moldovan2025-01-151-1/+1
|
* tor-rtcompat: Rename UnsupportedStreamOps to NoOpStreamOpsHandle.Gabriela Moldovan2025-01-151-2/+2
| | | | | This renames UnsupportedStreamOpsHandle to NoOpStreamOpsHandle for clarity (the old name kind of sounded like the name of an error type).
* tor-proto: Set kist params in channel reactor.Gabriela Moldovan2025-01-151-2/+32
|
* tor-proto: Add CtrlMsg for setting kist options (fmt).Gabriela Moldovan2025-01-151-1/+3
|
* tor-proto: Add CtrlMsg for setting kist options.Gabriela Moldovan2025-01-151-1/+8
|
* tor-proto: Pass a StreamOps handle to the channel reactor.Gabriela Moldovan2025-01-152-2/+14
|
* tor-rtcompat: Big invasive change adding StreamOps bound everywhere.Gabriela Moldovan2025-01-152-10/+19
| | | | | | This is unfortunately necessary, because after the channel handshake, we need to give the channel reactor a `StreamOps` handle to the underlying stream.
* tor-proto: Add KistParams type built from NetParameters.Gabriela Moldovan2025-01-151-0/+60
| | | | | | | | Note: this commit makes `tor-proto` depend on `tor-netdir` (because it adds a `KistParams` type that is buildable from `NetParameters`, which is defined in `tor-netdir`). Closes #1729
* tor-proto: fix bad indentationSteven Engler2025-01-091-3/+3
|
* tor-proto: test `Channel::wait_for_close`Steven Engler2025-01-091-5/+35
|
* tor-proto: `Channel::wait_for_close` return success statusSteven Engler2025-01-091-6/+5
| | | | | | This had a TODO about returning a "status indication instead of just ()" so this commit adds some status indication that we can expand later if needed.
* tor-proto: replace `Channel`s "closed" state handlingSteven Engler2024-12-101-9/+30
| | | | | | | | | | | | | | | Previously `Channel` had two concepts of "closed". There was an atomic flag that was set to `true` at the end `Reactor::run`, and an experimental oneshot channel where the sender was dropped when the reactor was dropped. This commit consolidates these two using the `oneshot_broadcast` module. This means that the behaviour is consistent between both "closed" statuses (`is_closing()` and `wait_for_close()`). A channel is considered closed when its reactor is dropped. This also helps progress towards making the channel reactor cancellation safe (see arti#1756).
* tor-proto: Specify which of the 2 senders is used for sending cells.Gabriela Moldovan2024-11-201-1/+1
|
* Apply deferred rustfmt churnIan Jackson2024-10-092-6/+3
|
* memquota: Use an mq_queue for channel->circuit RX queueIan Jackson2024-10-092-7/+8
| | | | | | Fixes #1682. (This involves some noise in the tests.)
* memquota: Introduce type aliases for channel->circuit RX queueIan Jackson2024-10-092-7/+6
| | | | | This is neater and will make changing the type (in a moment) less noisy.
* tor-proto: Make circuit->channel queues participate in memquotaIan Jackson2024-10-031-1/+2
| | | | | | | | We use the *channel*'s memquota account. This is arguably wrong, but it's hard to get right now. See #1652. Change the type of the queue, and the places it's constructed. The use sites can all stay the same.
* tor-proto: Plumb the ChannelAccount through to queue creation siteIan Jackson2024-10-032-4/+22
| | | | | This gets it as far as the outbound circuit->channel mpsc queue creation. Also, we provide an accessor for it.
* tor-proto: Plumb the ChannelAccount through to queue creation site (pre-fmt)Ian Jackson2024-10-031-1/+5
|
* tor-proto: channel: Make construction fallibleIan Jackson2024-10-032-3/+4
| | | | | Making a channel is going to involve making a memquota Participant, which can fail.
* tor-proto: Add a CoarseTimeProvider bound to all the SleepProviders (fmt)Ian Jackson2024-10-011-4/+14
|
* tor-proto: Add a CoarseTimeProvider bound to all the SleepProvidersIan Jackson2024-10-011-8/+8
| | | | | | | The memquota arranagements are going to use this. We *don't* apply this to Channel (or to other types that aren't already generic over SleepProvider).
* extract tor_async_utils::oneshot into ::oneshot-fused-workaroundJim Newsome2024-08-282-5/+4
| | | | | | | | | | | | | | Having this in the `tor-async-utils` crate prevents us from doing both of the following without introducing a circular dependency: * using it in `tor-rtmock` (which we currently do, particularly in tests). * using `tor-rtmock` to test things in `tor-async-utils`. We don't do this yet, but it is generally sensible to do so. In particular we want to move the `stream_peak` module there, which is currently tested with `tor-rtmock`. Moving this into its own crate avoids this circular dependency.
* UnverifiedChannel: Clarify check's peer_certClara Engler2024-07-111-1/+1
| | | | | | | This commit clarifies the documentation of the `peer_cert` parameter in the `UnverifiedChannel::check` function, in order to reflect that it represents the certificate presented during the ServerHello in the TLS handshake and not in the in-protocol CERTS cell.
* proto: Divide up some elements of ChannelDetails.Nick Mathewson2024-05-161-2/+4
| | | | | | | | | | | | | | Previously ChannelDetails had a double duty: It held elements shared among the clones of a Channel, and it also held elements shared between the Channel and the Reactor. But now that Channel doesn't have to implement Clone, we can more the non-Reactor elements into Channel itself. This change may improve cache locality a bit, and should make it a little easier to follow the channel code. I've also moved unique_id out of ChannelDetails into Channel _and_ Reactor: it is small, immutable, and used all the time in logging.
* proto: Make Channel explicitly Arc<.>Nick Mathewson2024-05-162-2/+2
| | | | | | | | | | | | | | | | Previously, Channel was a type that you could Clone that implicitly its state. Now, Channel always appears as an Arc<Channel>. This change has several benefits: * It makes the relationship between Channel struct and the underlying channel more clear. * It enables Channel to participate in the RPC system, where everything has to be an Arc<.> * It enables us to have a Weak<Channel>, if we ever want to. * It will let us move various members out of ChannelDetails. We did this change a while ago with ClientCirc.
* Use uXX::MAX in place of std::uXX::MAXNick Mathewson2024-04-221-1/+1
| | | | | | The old code produced a warning from clippy nightly; we may as well update to use the new associated consts. (They've been there since Rust 1.4x.)
* Run maint/add_warning.Nick Mathewson2024-03-133-0/+3
|
* clippy: Replace many calls to .get(0) with .first()Ian Jackson2024-01-021-1/+1
| | | | | FTR I don't think agree with clippy on this question, but then I often don't.
* Downgrade some messages to traceIan Jackson2023-11-291-1/+1
| | | | | These messages are very verbose and I doubt anyone will want them, usually, even when debugging.
* Change `CircId` to never be zeroJim Newsome2023-10-253-46/+81
| | | | | | | | | | This changes the internal representation to be `NonZeroU32` instead of just `u32`. Various places where a circuit ID is optional now use `Option<CircId>`. Fixes a bug in `CircIdRange::sample` that would previously return a circuit ID of 0, when the rng returned 0x8000_0000 for a low range.
* Upgrade to latest asynchronous_codec (0.7.0)Nick Mathewson2023-10-171-2/+2
|
* oneshot: Use veneer in tor-protoIan Jackson2023-10-112-5/+8
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-233-0/+3
|
* test: add a test for missing NETINFO cellsEmil Engler2023-08-121-0/+15
| | | | | | This commit adds a unit test to the `tor_proto::handshake` module, which tests the behavior when no NETINFO cell is present within a channel.
* proto: methods to wait until a channel/circuit is shut down.Nick Mathewson2023-08-041-0/+7
| | | | | | | | | | | | | | | | | | The implementation here is perhaps excessively simple: we put a `oneshot::Sender` in the `Reactor` object, and a `Shared<oneshot::Receiver>` in the circuit or channel. When the reactor is dropped, any copy of the `Shared<Receiver>` will yield `Err(Cancelled)`. I'm marking these methods as experimental because I'm not sure I've thought of all the implications here, and we might want to change things around. Down the road, these methods might want to yield a `Result<>` indicating why the reactor was shut down. This feature was inspired by a request from Saksham Mittal, and a felt need while working on !1472.
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-103-0/+3
|
* tor-proto: Remove use of arrayref.Nick Mathewson2023-06-011-2/+5
|
* Replace usage of KeyUnknownCert::check_key.Nick Mathewson2023-05-161-2/+2
|
* async-utils: rename SinkExt to SinkPrepareExtNick Mathewson2023-04-191-1/+1
|
* Move functionality from tor_basic_utils to tor_async_utilsNick Mathewson2023-03-291-1/+1
| | | | | This commit is mostly code movement; I'd recommend reviewing it with git's `--color-moved` option.
* Fix a bunch of needless-conversion warnings.Nick Mathewson2023-03-101-1/+0
| | | | | Apparently 1.68 now warns when you call into_iter() on something that's already an iterator. Fair enough. Let's stop doing that.
* Rename OpenClientChan{Msg,Cell} => OpenChan{Msg,Cell}S2CNick Mathewson2023-02-091-20/+20
|
* tor-proto: Do not parse forbidden commands on inbound cells.Nick Mathewson2023-02-091-84/+28
| | | | | | | | | | Unlike C tor, we treat unrecognized commands as reason to kill off the connection entirely. That's fine; if we need to add an unrecognized command in the future, we can use VERSIONS to negotiate it. Also, if someday we want this code to support relay channels as well, we can use some type trickery to have that work too.
* tor-proto: only parse allowed ChanMsg types during handshake.Nick Mathewson2023-02-092-28/+97
|
* tor-cell: Rename ChanMsg and ChanCell-related types.Nick Mathewson2023-02-073-42/+42
|