aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/stream/incoming.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-proto: add test-only `NoOpRequestFilter`Steven Engler2026-07-291-0/+16
|
* proto: Remove unnecessary result mappingGabriela Moldovan2026-06-231-1/+1
| | | | This already returns `()` in the `Ok` case.
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* tor-proto: have `StreamReqInfo` store a `ReactorStreamComponents`Steven Engler2026-05-211-24/+3
|
* proto: Remove unfinished sentence from docsGabriela Moldovan2026-02-161-2/+0
|
* proto: Update IncomingStreamRequestFilter docsGabriela Moldovan2026-02-161-2/+3
| | | | | The `CircHopSyncView` is now the view of a hop, not of the whole circuit.
* proto: Rename CircSyncView to CircHopSyncViewGabriela Moldovan2026-02-161-2/+2
| | | | And update the docs
* proto: Fix docs post-refactoringGabriela Moldovan2026-01-131-2/+2
|
* proto: Dedupe IncomingStreamRequestHandlerGabriela Moldovan2026-01-121-1/+26
|
* proto: Fix a number of newly broken doc linksGabriela Moldovan2025-11-241-1/+1
|
* proto: Move StreamComponents to top-level stream modGabriela Moldovan2025-11-241-2/+1
|
* proto: Move StreamReqInfo to stream moduleGabriela Moldovan2025-11-241-1/+50
|
* proto: Move IncomingStream* types to shared moduleGabriela Moldovan2025-11-241-1/+295
|
* proto: Rename data cmd checkers to {Inbound,Outbound}DataCmdCheckerGabriela Moldovan2025-10-161-3/+3
| | | | | | The previous "incoming" terminology was rather ambiguous. Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3348#note_3275337
* proto: Move IncomingDataCmdChecker to top-level stream module.Gabriela Moldovan2025-10-161-0/+51
| | | | | | | This will be used by relays too (for validating incoming messages on streams). This is just code motion, so it's best reviewed with `--color-moved`.
* proto: Move the `stream` module under `client` (breaking).Gabriela Moldovan2025-08-181-298/+0
| | | | | | | | | | | | The `stream` module is client-specific, for the most part, so I am moving it under `client`. Later on, we will factor out the parts that can be shared with the relay implementation. Note: this is a breaking change as the deleted `stream` module was `pub`. We could've kept the module and reexported from it the public types from `tor_proto::client::stream`, but I think it's better to have this `client` namespacing, because it makes the separation between the client and relay parts clearer.
* proto: Rename the `tunnel` module to `client`.Gabriela Moldovan2025-08-181-2/+2
| | | | | | The implementation from `tunnel` is client-specific, so we are renaming the module accordingly. The more generic parts will be pulled into a separate module in a future commit.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-3/+3
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* proto: Move ClientCirc stream functions to ClientTunnelDavid Goulet2025-08-051-1/+2
| | | | | | | | | | | | | In order to pull this off, some client => tunnel renaming needed to happen including the comments. The send_raw_msg() is an experimental and expert mode method that any tunnel should have access to in order to be able to send whatever message in whatever tunnel type. No behavior changes. Signed-off-by: David Goulet <[email protected]>
* tor-proto: add the `XonXoffReader` and connect it to the reactorSteven Engler2025-07-171-0/+2
| | | | | | | | | | | | The idea here is that the reactor builds an `XonXoffReaderCtrl` for the new stream, and the `XonXoffReaderCtrl` can receive notifications from the reactor's `StreamFlowControl`. The `XonXoffReaderCtrl` can be combined with any `AsyncRead` to build a `XonXoffReader`, essentially wrapping the `AsyncRead` with a type that handles XON/XOFF flow control. Essentially, the reactor gives you a type that allows you to add XON/XOFF flow control support to any `AsyncRead`. We will add this `XonXoffReader` to the `DataReader` in a future commit.
* tor-proto: combine some objects into a `StreamComponents`Steven Engler2025-07-151-23/+16
| | | | | | As we continue adding more functionality to streams like flow control, we'll have more objects to pass around. This tries to group them together.
* tor-proto: rename `StreamReader` to `StreamReceiver`Steven Engler2025-06-261-7/+7
| | | | | | | | | | | | | In rust, the typical nomenclature is to use "receiver" for channels, and "reader" for byte streams. For example `mpsc::Receiver` for something that returns objects and `AsyncRead` for something that reads bytes. Since we also have a `DataReader` for reading bytes, I think renaming this from `StreamReader` to `StreamReceiver` better describes what it is (it's not a "reader" in the typical `Read`/`AsyncRead` sense). This type is public in the API, but is not actually accessible. As far as I can tell there is no way to construct it or access it.
* tor-proto: pass the time provider to the `DataWriter`Steven Engler2025-06-051-1/+12
|
* Add a RelayCellFormat argument to encode().Nick Mathewson2025-04-161-1/+1
| | | | | | | | | This will let us actually _send_ messages in the right format. This approach is not ideal for packed/fragmented messages; they will need a separate RelayCellEncoder. part of #1944.
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-1/+1
| | | | - `rand::thread_rng()` has been deprecated and renamed to `rand::rng()`
* tor-proto: Add a tunnel module.David Goulet2025-02-201-2/+3
| | | | | | | | | | | | | 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: Put a StreamAccount in DataStream etc.Ian Jackson2024-10-031-1/+7
|
* Some HasMemoryCost impls in tor-protoIan Jackson2024-10-021-1/+4
|
* extract tor_async_utils::oneshot into ::oneshot-fused-workaroundJim Newsome2024-08-281-1/+1
| | | | | | | | | | | | | | 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.
* Fix clippy::doc_lazy_continuationIan Jackson2024-07-081-1/+1
|
* Rename the old IncomingStreamRequestContext to StreamReqInfo.Nick Mathewson2024-03-261-3/+1
| | | | (Doing this to prevent us having two structs with the same name.)
* Add an IncomingStreamRequestFilter to check early propertiesNick Mathewson2024-03-261-1/+46
| | | | | | | Based on designs in #1124. Note that there is a TODO here about a hack I had to do to appease the borrow checker.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* relay-cell: Update relay cell decoding API for prop340Jim Newsome2024-03-121-2/+2
| | | | | | | | | | | Prop 340: https://spec.torproject.org/proposals/340-packed-and-fragmented.html This updates the decoding API to support multiple versions of the relay cell encoding, including the new encoding proposed in prop340 that supports relay message packing and fragmentation. This commit doesn't actually add support for that new encoding yet.
* Rename UnparsedRelayCell -> UnparsedRelayMsgJim Newsome2024-03-121-4/+4
| | | | | For consistency with the terminology proposed in https://gitlab.torproject.org/tpo/core/torspec/-/issues/253
* tor_cell: never construct empty DATA messages.Nick Mathewson2024-02-131-1/+1
| | | | | | | We never actually constructed these before, but now we enforce it at the API level. Part of #1269.
* Rename {Any}RelayCell to {Any}RelayMsgOuterNick Mathewson2023-12-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is pure renaming, done automatically with rust-analyzer. Comment fixes and other cleanups will be in the subsequent commits. We're doing this renaming because we need a name for the combination of a `RelayMsg` and an `Option<StreamId>` that we use when we have a `RelayMsg` we intend to route to a given stream or circuit internally. Previously we called this a `RelayCell`, but that name was already somewhat inaccurate, and will become _very_ inaccurate with the arrival of prop340, which breaksthe 1:1 relationship between relay cells and relay messages. (If we didn't do this renaming now, we'd soon be making the relationship between `UnparsedRelayCell`and `RelayCell` many-to-many, which would be ridiculous and confusing.) The `RelayMsgOuter` name is a placeholder: We expect that we'll want to rename this type, and may also want to rename `RelayMsg`, and unify our vocabulary in other areas too. But such a renaming will have to wait for a larger discussion affecting the specifications, so that we can use the same vocabulary everywhere.
* Convert StreamId to NonZeroU16Jim Newsome2023-10-251-1/+1
|
* proto: Revise the behavior of IncomingStream::discard().Nick Mathewson2023-10-191-9/+12
| | | | | | | | | | | | | Because dropping a `StreamTarget` causes the circuit reactor to send an End, the previous do-nothing implementation of `discard()` wasn't sufficient to cause the request to be ignored without sending an End. This commit modifies our "close pending stream" behavior to only optionally send an End message. To avoid confusion, I'm using a new `CloseStreamBehavior` enum rather than an `Option<End>`, since we had previously used `None` in some cases to indicate a default (misc) end message.
* IncomingStream:: flatten IncomingStreamInner.Nick Mathewson2023-10-191-13/+11
|
* IncomingStream: Remove state.Nick Mathewson2023-10-191-67/+4
| | | | | | Now that every state-change function consumes the IncomingStream, there is no longer any reason to keep track of an internal state enum.
* Note a bug in IncomingStream::discard.Nick Mathewson2023-10-191-0/+2
|
* Remove IncomingStreamInner from its Option.Nick Mathewson2023-10-191-34/+7
| | | | | Now that IncomingStream doesn't implement Drop, we can just destructure it.
* Remove impl Drop from IncomingStreamNick Mathewson2023-10-191-11/+4
| | | | | Since dropping a StreamTarget will send an End, we don't need to call reject_internal in this case.
* proto: Make StreamTarget::close() misuse less likely.Nick Mathewson2023-10-171-3/+4
| | | | | | | | | It turns out that we can make `IncomingStream::reject()` consume self, thus making it impossible to hit the double-close error from outside the `tor-proto` crate. Also, we rename `StreamTarget::close()` to `close_pending()` to better reflect its limited applicability.
* proto::stream::incoming: Use bit-array representation for command listNick Mathewson2023-10-121-7/+84
| | | | | This should be smaller and faster than vec, and save some allocations. It could also avoid a tiny sidechannel.
* tor-proto: remove a now-unneeded allow in stream::incomingNick Mathewson2023-10-121-2/+0
|
* oneshot: Apply deferred rustfmt churnIan Jackson2023-10-111-1/+1
| | | | cargo fmt, precisely.
* oneshot: Use veneer in tor-protoIan Jackson2023-10-111-1/+1
|
* tor-proto: Make update_state() and discard() return Result<(), Bug>.Gabriela Moldovan2023-08-091-5/+5
| | | | These functions only ever return `Bug` errors.