aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/client/reactor
Commit message (Collapse)AuthorAgeFilesLines
* tor-proto: disable flowctrl sidechannel mitigations for relaysSteven Engler7 days2-3/+22
| | | | | | | | The end result should be: 1. outgoing streams - enable sidechannel mitigations 2. incoming hs streams - enable sidechannel mitigations 3. incoming exit streams - disable sidechannel mitigations
* Merge branch 'clippy-fixes' into 'main'gabi-25013 days2-2/+3
|\ | | | | | | | | tor-proto: Some misc rust/clippy warning fixes See merge request tpo/core/arti!4304
| * tor-proto: box `CircParameters` in test-only `CtrlCmd::AddFakeHop`Steven Engler2026-08-111-1/+2
| | | | | | | | This fixes a `clippy::large_enum_variant`.
| * tor-proto: fix a 'clippy::useless_conversion'Steven Engler2026-08-111-1/+1
| |
* | tor-proto: change some instances of `sendme_inc` to u8Steven Engler2026-08-121-1/+1
|/
* proto: Add {backward|forward} prefix to circ_id in logsDavid Goulet2026-08-033-17/+17
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Rename uniq_id to circ_unique_id mostly in loggingDavid Goulet2026-08-033-22/+22
| | | | | | | | | We have decided that instead of "uniq_id" in logging, we'll use the "<domaine>-[<type>]-id" syntax to indicate who is that unique ID. This commit only renames circuit's unique ID to "circ_uniq_id". Signed-off-by: David Goulet <[email protected]>
* proto: Log both UniqId and CircId when possibleDavid Goulet2026-08-034-24/+88
| | | | | | | | | | This commit only affects logging. Whenever possible, log both the UniqId and CircId. This also changes the log lines which is now "uniq_id=" and "circ_id=" as the UniqId is internal and circ_id (CircId) is protocol level. Signed-off-by: David Goulet <[email protected]>
* proto: Rename CircId and UniqId variable nameDavid Goulet2026-08-032-10/+10
| | | | | | | | | | | | | | | A CircId is now a circ_id and a UniqId is a unique_id so we stop confusing them in the code. Furthermore, channel_id that are CircId are now circ_id. Channel IDs are different and encoded internally into a UniqId. This is the first step to clarify semantic before we change the logging to log both unique ID and circ ID. No behavior change. Signed-off-by: David Goulet <[email protected]>
* tor-cell: rename `XonKbpsEwma` to `XonKBpsEwma`Steven Engler2026-07-302-4/+4
|
* proto: Remove feature-gating from CircHop::handle_msg()Gabriela Moldovan2026-07-231-1/+3
| | | | | | | | | | | | | | | This feature-gating has been a source of confusion, and it unnecessarily complicates the stream message handling flow. I've previously argued in favour of keeping it, in the spirit of a belt and braces approach to message validation, but I've been convinced that in this particular case, the feature-gate is more trouble than it's worth. What makes things worse is that the `CircHop::handle_msg()` function was designed poorly (by yours truly). I plan on refactoring it at some point, hopefully soon. There is a TODO about this below its doc comment.
* Remove now-unneeded allow(clippy::cognitive_complexity)Jim Newsome2026-07-151-1/+0
|
* proto: log virtual hop additions at trace.Nick Mathewson2026-07-021-0/+2
| | | | We do something similar with non-virtual hops at !4076.
* proto: log hop settings at trace upon client circuit opening.Nick Mathewson2026-06-231-1/+2
|
* proto: Add crate-level exports for two extra stream types (fmt)Gabriela Moldovan2026-06-172-4/+4
|
* tor-proto: have `StreamReqInfo` store a `ReactorStreamComponents`Steven Engler2026-05-211-4/+1
|
* tor-proto: move memquota stream account arg to last positionSteven Engler2026-05-213-8/+8
| | | | This better matches nearby code.
* tor-proto: move more stream queue init to reactorSteven Engler2026-05-213-80/+7
| | | | | | | | | | | | | | | | | | | | Previously when initializing a stream, we constructed most of the stream-related queues outside of the reactor and passed the relevant halves of the queues (senders or receivers) into the reactor. A downside of the above approach is that the reactor may be better informed about what queues to construct, and how to construct them. For example the reactor knows what type of flow control that the hop is using, so it knows whether we need queues for passing rate limits and drain rates for XON/XOFF flow control. This commit moves the construction of these queues into the reactor and passes the relevant halves out of the reactor. In the future we can make better decisions about which queues are needed depending on the flow control method used instead of always constructing them (see arti#2068). Reviewing with `--color-moved` might be helpful as a few lines have been moved.
* tor-proto: add `ReactorStreamComponents` to bundle return valsSteven Engler2026-05-203-14/+18
|
* tor-proto: move stream incoming queue init to reactorSteven Engler2026-05-203-34/+36
| | | | | | | | | | | The stream queue length (for messages incoming from the Tor network) depends on the type of flow control we're using for the hop. Currently we construct the stream queue outside of the circuit reactor, but we don't have the flow control information here. Instead of constructing the stream queue outside of the reactor and passing the sender into the reactor, we construct the stream queue inside of the reactor and pass the receiver out of the reactor.
* tor-proto: clean up return type of `Circuit::begin_stream()`Steven Engler2026-05-112-13/+8
|
* tor-proto: reorg error handling for BeginStream reactor cmdSteven Engler2026-05-111-2/+19
|
* tor-proto: Simplify a match+if statement.Nick Mathewson2026-04-211-13/+5
|
* tor-proto: small cleanup of legacy codeSteven Engler2026-04-081-6/+1
| | | | | | | I think it was written like this because earlier versions of rust didn't allow references to temporaries like `&mut rand::rng()` and needed them to be bound to a variable. But this isn't necessary anymore and so the comment doesn't make sense.
* tor-proto: Port to web-time-compatNick Mathewson2026-03-262-2/+2
|
* Fix word duplicate typosTobias Stoeckmann2026-03-152-2/+2
|
* proto: Rename CircSyncView to CircHopSyncViewGabriela Moldovan2026-02-161-3/+3
| | | | And update the docs
* proto: Remove unused n_open_streams() functionsGabriela Moldovan2026-02-161-17/+0
|
* proto: Replace circuit-scoped n_open_streams() with per-hop alternativeGabriela Moldovan2026-02-161-1/+1
| | | | | | | | | | | | | | | | | `IncomingStreamRequestFilter`s, and `CircSyncView`s, by extension, are used both by old relay implementation and the new one for implementing an out-of-reactor way of deciding how to handle an incoming stream. In the new circuit reactor design, we have a separate stream reactor for each hop. Upon receiving an incoming stream, the stream reactor will need to build one of these `CircSyncView` objects, and then pass it to an externally-provided `IncomingStreamRequestFilter`. Before this change, `CircSyncView::n_open_streams()` returned the total number of open streams, which wouldn't have worked with the new reactor design, because the per-hop stream reactor doesn't have a global view of all the hops, so its `CircSyncView` can't return the total number of streams (at least not without message passing, or sharing state with the other stream reactors).
* proto: Replace CircSyncView with previously client-only CircSyncViewGabriela Moldovan2026-02-162-33/+1
| | | | | | | | | | Note: this commit only contains the removal of the old `CircSyncView`, and it of course doens't compile. A future commit will replace the removed file with the `syncview.rs` from the client module. This change is split over two commits because it makes reviewing easier (`git mv`ing the new file over the old results in a confusing diff, because `git` refuses to show it as a move).
* proto: Adjust visibility in client::reactor::CircSyncViewGabriela Moldovan2026-02-161-3/+3
| | | | | This is in preparation for replacing the top-level `CircSyncView` with it.
* proto: Use absolute path in CircHopList importGabriela Moldovan2026-02-161-1/+1
| | | | This file will be moved to the top-level `circuit` module soon.
* proto: Rename ClientCircSyncView to CircSyncViewGabriela Moldovan2026-02-162-5/+4
| | | | | This will soon replace `CircSyncView` wholesale. The preliminary renaming will make the future diffs easier to review.
* proto: Add an accessor for the CircHopOutbound of a CircHopGabriela Moldovan2026-02-161-0/+5
| | | | This will soon be needed for building a `CircSyncView`.
* proto: Move CREATE helpers to a shared moduleGabriela Moldovan2026-02-052-65/+1
| | | | These will be used by the relay code too (for circuit extension).
* proto: Avoid locking in CircHopOutbound::ccontrol()Gabriela Moldovan2026-01-291-1/+1
| | | | | | | | This is just because the generic reactor will soon need a clone of the CC object, so I am preemptively making this function return a ref to the underlying `Arc` instead. Technically, it would've been fine to just kept this method and add a separate one returning `&Arc<Mutex<..>>`, but I'd prefer keeping the API small.
* proto: Rip CC state out of CircHopInboundGabriela Moldovan2026-01-291-5/+1
| | | | | | Soon it won't need be needed here any more. I'm removing it, because having redundant handles to the CC state makes it difficult to see exactly where it's being used from.
* proto: Move padding_disposition() to the shared padding moduleGabriela Moldovan2026-01-291-54/+5
|
* proto: Move CircPaddingDisposition to a new moduleGabriela Moldovan2026-01-291-13/+1
| | | | Relays will need to use it too.
* proto: Move TimeoutEstimator to utilGabriela Moldovan2026-01-291-2/+2
| | | | | This will be used in the stream reactor too (and the stream reactor will eventually replace the corresponding client impl).
* proto: Dedupe IncomingStreamRequestHandlerGabriela Moldovan2026-01-122-6/+12
|
* proto: Rename CircuitAction and cie to CircuitEventDavid Goulet2025-12-101-30/+30
| | | | | | | | | | This mirrors also the relay reactor. We've introduced the ProtoViolation into a previous commit which is not an action but rather an "event" that happened on a circuit. And so, better semantic. No behavior change. Signed-off-by: David Goulet <[email protected]>
* proto: Rename Circuit{Action/Event}::Shutdown to ProtoViolationDavid Goulet2025-12-101-1/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Add TODO in client reactor for bad cellDavid Goulet2025-12-101-0/+6
| | | | | | Because of https://gitlab.torproject.org/tpo/core/torspec/-/issues/385 Signed-off-by: David Goulet <[email protected]>
* proto: Client circuit reactor now handles AnyChanMsgDavid Goulet2025-12-102-5/+10
| | | | | | | | | | | | | | | This commit removes the CircuitRx* based solely on the client circuit message and moves it into the top level of the crate so all reactors can use them. The client reactor then upon receiving the message, it converts the AnyChanMsg into a ClientCircChanMsg. On error, this leads to a shutdown of the entire reactor due to a fatal error. In order to pull this off, we added a CircuitAction::Shutdown that is handled as a priority. Signed-off-by: David Goulet <[email protected]>
* proto: Move ClientCircChanMsg into client moduleDavid Goulet2025-12-101-2/+2
| | | | | | | | Next commit will also move the Relay specific set into the relay module. These two sets are becoming specific to the reactor as the circuit reactor communication channel will use AnyChanMsg instead. Signed-off-by: David Goulet <[email protected]>
* Merge branch 'relay-streams2' into 'main'David Goulet2025-12-021-31/+5
|\ | | | | | | | | proto: Start handling incoming streams in the relay reactor See merge request tpo/core/arti!3487
| * proto: Appropriately gate STREAM_READER_BUFFER to satisfy clippyGabriela Moldovan2025-11-241-1/+4
| |
| * proto: Deduplicate msg_streamid()Gabriela Moldovan2025-11-241-19/+1
| | | | | | | | | | | | | | | | | | | | Initially I wanted to turn `msg_streamid()` into a method on `UnparsedRelayMsg`, but I ultimately decided against it, because it feels like it doesn't belong there (even though intuitively, I would've expected it to handle the mismatch between stream ID and cell command internally). This is because all the `UnparsedRelayMsg` methods return `tor_bytes::Result`, and do not actually do any validation beyond some length checks on the various fields.
| * proto: Move a couple of stream-related constants to stream modGabriela Moldovan2025-11-241-12/+1
| |