aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/stream.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-cell: rename `XonKbpsEwma` to `XonKBpsEwma`Steven Engler2026-07-301-2/+2
|
* proto: Add crate-level exports for two extra stream typesGabriela Moldovan2026-06-171-0/+4
| | | | | For convenience. This will soon replace a corresponding re-export from `tor_proto::client::stream`.
* proto: Re-export StreamReceiver from tor_proto::streamGabriela Moldovan2026-06-171-1/+2
| | | | This will soon replace the re-export from `tor_proto::client::stream`.
* proto: Re-export the Incoming* types from tor_proto::streamGabriela Moldovan2026-06-171-0/+6
| | | | | | | | | | These will replace the pub re-exports from `tor_proto::client::stream`. This reorg is needed because currently, the only public export of the incoming stream types is from `tor_proto::client::stream`, but these aren't actually client specific: relays will use them too, for implementing exit, DNS and directory streams. So it makes more sense to export them from the top-level stream module instead.
* proto: Fix relay/hs-service feature gatingGabriela Moldovan2025-12-081-2/+10
| | | | | Without this, `tor-proto` doesn't compile if you enable the `relay` feature but not `hs-service`.
* proto: Fix a number of newly broken doc linksGabriela Moldovan2025-11-241-1/+2
|
* proto: Deduplicate msg_streamid()Gabriela Moldovan2025-11-241-1/+19
| | | | | | | | | | 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-0/+12
|
* proto: Add a Tunnel::Relay variant for StreamTargetGabriela Moldovan2025-11-241-5/+13
|
* proto: Move StreamComponents to top-level stream modGabriela Moldovan2025-11-241-0/+22
|
* proto: Move raw under top-level stream modGabriela Moldovan2025-11-241-0/+1
|
* proto: Move StreamTarget to stream moduleGabriela Moldovan2025-11-241-1/+172
|
* proto: Move CloseStreamBehavior to top-level stream moduleGabriela Moldovan2025-11-141-0/+23
|
* proto: Move StreamMpsc{Sender,Receiver} to stream moduleGabriela Moldovan2025-10-211-0/+7
| | | | These will be shared with the relay code.
* proto: Move dumb pipes to top-lvl stream moduleGabriela Moldovan2025-10-211-0/+2
|
* proto: Move IncomingDataCmdChecker to top-level stream module.Gabriela Moldovan2025-10-161-0/+3
| | | | | | | 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 cmdchecker under top-level stream module.Gabriela Moldovan2025-10-161-0/+1
| | | | | The CmdChecker will be used by relays too, so I am moving it to the shared `stream` module.
* proto: Move flow_ctrl module under stream.Gabriela Moldovan2025-10-071-0/+2
| | | | This will be used by exits too, so I am moving it out of `client`.
* proto: Add a top-level stream module.Gabriela Moldovan2025-10-071-0/+4
| | | | | This will house the implementation-agnostic stream types and functionality.
* proto: Move the `stream` module under `client` (breaking).Gabriela Moldovan2025-08-181-47/+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-1/+1
| | | | | | 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.
* conflux: Adjust docs and fix doc links.Gabriela Moldovan2025-08-051-1/+1
|
* tor-proto: add the `XonXoffReader` and connect it to the reactorSteven Engler2025-07-171-1/+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: add dedicated types for the incoming stream queueSteven Engler2025-07-161-0/+1
| | | | | XON/XOFF flow control will want to know how many data bytes are queued on a stream, so the new types track that.
* tor-proto: rename `StreamSendFlowControl` and related changesSteven Engler2025-07-151-1/+1
| | | | | | | | The plan is to use `StreamSendFlowControl` (now `StreamFlowControl`) for both outgoing and incoming directions, so a name change is needed. This also updates some comments, and renames some related struct fields that have the word "send" in them.
* tor-proto: establish channel for rate limit updatesSteven Engler2025-07-071-1/+1
|
* tor-proto: rename `StreamReader` to `StreamReceiver`Steven Engler2025-06-261-1/+1
| | | | | | | | | | | | | 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: Add a tunnel module.David Goulet2025-02-201-1/+1
| | | | | | | | | | | | | 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]>
* proto: Rename DataStreamCtrl to ClientDataStreamCtrlNick Mathewson2025-01-301-1/+1
| | | | | | The API for this type, and the fact that it implements ClientStreamCtrl unconditionally, means that it is only for client DataStreams.
* tor-proto: Encapsulate flow-controlJim Newsome2024-08-131-0/+3
| | | | | | Encapsulate flow-control into a separate object that partially abstracts away the difference between window-based (legacy) flow control and xon-based (prop324) flow control.
* Add an IncomingStreamRequestFilter to check early propertiesNick Mathewson2024-03-261-1/+4
| | | | | | | Based on designs in #1124. Note that there is a TODO here about a hack I had to do to appease the borrow checker.
* tor-proto: Add IncomingCmdChecker for IncomingStream.Gabriela Moldovan2023-08-031-0/+3
|
* proto: Create a `DataStreamCtrl` type.Nick Mathewson2023-05-221-0/+6
| | | | | | | | | | | | | | | | | The idea here is that we want to make DataStream visible to the RPC system without requiring that the RPC session hold the DataStream itself (or the Reader, or the Writer). We could solve this problem by making _all_ the state in the DataStream shared, but that would introduce unnecessary extra locking in our critical path. Instead we're creating the notion of a "control handle" that lets you manage and observe a stream without actually owning the stream. Right now the only supported functionality is asking for the stream's circuit. Part of #847
* Rename onion-* cargo features to hs-* in tor-* cratesIan Jackson2023-02-281-3/+3
| | | | Fixes #756
* tor-proto: Introduce CmdChecker, and define it for our streams.Nick Mathewson2023-02-171-0/+3
| | | | | | | | The role of CmdChecker is to verify that messages are arriving at the appropriate sequence on a stream, with respect to the other messages that have been received. Once the stream becomes half-closed, the CmdChecker is also in charge of consuming incoming messages on the stream and making sure that they are well-formed.
* tor-proto: Draft API to handle incoming BEGIN requests.Nick Mathewson2023-01-171-0/+5
| | | | Onion services (and later, exits and caches) will need this.
* Improve the layout of crate exports; add runtime convenience functionseta2022-01-111-1/+1
| | | | | | | | | | | | | | | | | | | | This commit addresses multiple problems highlighted by arti#182: - `arti-client` had some types in its public API that weren't accessible without importing another crate (`CfgPath`, `DataReader`, `DataWriter`). This has been fixed. - In addition, the doc comments for `DataReader` and `DataWriter` were cleaned up to be of better quality, now that they're public. - It was impossible to use `arti-client` without also importing `tor-rtcompat`. This is now fixed by the addition of two convenience methods: `TorClient::bootstrap_with_tokio` and `TorClient::bootstrap_with_async_std`. - Potentially controversially: `tor-rtcompat` now returns *concrete* types from methods like `current_runtime`, instead of `impl Runtime`. - This was needed in order to actually be able to name the `TorClient` type that results from using these methods. - This does mean we lose API flexibility, but on balance I think this is a good thing, because the API we *do* have is actually usable...
* Get rid of unbounded stream sender, and RawCellStreameta2021-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | Previously, the reactor would use an `UnboundedSender` to send things to the `RawCellStream`, in order that the reactor wouldn't block if you failed to read from the latter. This is bad, though, since it means people can just run us out of memory by sending lots of things. To fix this, we make the new `StreamReader` type (which does the reading parts from `RawCellStream`) keep track of the stream's receive window and issue SENDMEs once *it* has consumed enough data to require it, thus meaning that we shouldn't get sent enough data to fill the channel between reactor and `StreamReader` (and, if we do, that's someone trying to flood us, and we abort the circuit). As hinted to above, the `RawCellStream` was removed and its reading functionalities replaced by `StreamReader`; its writing functionalities are handled by `StreamTarget` anyway, so we just give out one of those for the write end. This now means we don't need any mutexes! note: this commit introduces a known issue, arti#230
* Merge IpVersionPreferences and the optimistic flag into one type.Nick Mathewson2021-11-101-0/+4
| | | | | It seems like a good time to do this, before we add a zillion other arguments to begin_stream.
* Update our disclaimers and limitations sections.Nick Mathewson2021-10-271-4/+1
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+21
This will cause some pain for now, but now is really the best time to do this kind of thing.