aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/relay.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-cell: rename `XonKbpsEwma` to `XonKBpsEwma`Steven Engler2026-07-301-2/+2
|
* proto: Add newtype wrapper for incoming stream receiverGabriela Moldovan2026-07-221-2/+2
| | | | | The inner type is an eyesore, and doesn't really need to be exposed outside of tor-proto (we might even replace it at some point).
* proto: Remove RelayCirc::allow_stream_requests()Gabriela Moldovan2026-06-291-141/+3
| | | | | | | | | | | | | We don't need it anymore now that `RelayCirc`s always allow incoming stream requests. The previous design, where you could build a `RelayCirc` that didn't allow stream requests, was a leftover from the onion service `ClientCirc` implementation that this was inspired from (onion services *do* need the two to be decoupled, because incoming stream requests are only allowed on the virtual hop, after it's established). Closes #2582
* proto: Pass an IncomingStreamRequestFilter factory to the create handlerGabriela Moldovan2026-06-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements what we discussed in `doc/dev/notes/relay-streams.md` (lines 218-234): > Currently, to allow incoming stream requests on a circuit, > you first need to call `RelayCirc::allow_stream_requests()` > to install a `CmdChecker` and `IncomingStreamRequestFilter`. > This is not ideal, because `allow_stream_requests()` will need to be > called unconditionally, on each `RelayCirc`, > right after it's created in the `CreateHandler` impl > (which in turn, would mean making `handle_create()` async too, > because `allow_stream_requests()` is async, which wouldn't be great). > > So, the first step here is to rework the `RelayCirc` API to make relay circuits > be constructable with a list of allowed `RelayCmd`s and `IncomingStreamRequestFilter` > from the get-go ([#2582]), and to get rid of `allow_stream_requests()`, > which will enable the `CREATE*` handler to remain non-`async`. > > In any case, the `CREATE*` handler will still require some changes, > because it needs to be initialized with an `IncomingStreamRequestFilter`, I am not sure using an `IncomingStreamRequestFilter` "factory" is necessarily the right approach here, but the circuit `Reactor`'s constructor needs to take an `IncomingStreamRequestFilter`, and `IncomingStreamRequestFilter` is not `Clone` (and FWIW, I think it's better if we don't make it `Clone`). One obvious limitation is that the `IncomingStreamRequestFilter` of the circuit reactor is fixed for the entire lifetime of the circuit. In practice, I don't think this is going to be a problem, because the arti-relay `IncomingStreamRequestFilter` is only going be used for * preventing single-hop exit streams * per-circuit rate-limiting. Both of these checks will require the filter to have access to a recent `NetDir`, which is straightforward if the filter has an Arc<dyn NetDirProvider> (as mentioned in doc/dev/notes/relay-streams.md, `NetDirProvider` has a handy non-async `timely_netdir()` function we can use). And since these checks are based on consensus params, we don't really need to ever update an already-built circuit with a new `IncomingStreamRequestFilter` (because all `IncomingStreamRequestFilter` will have the ability to obtain a fresh `NetDir` as needed). Nevertheless, I left a TODO about this, because I expect this type to change once we figure out all the other pieces needed for #1448.
* proto: Implement RelayCirc::close_pending()Gabriela Moldovan2026-06-231-4/+17
| | | | Closes #2590
* proto: Add a control message for closing pending streamsGabriela Moldovan2026-06-231-0/+1
|
* 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-8/+12
|
* tor-chanmgr: add support for a `CreateRequestHandler`Steven Engler2026-04-081-0/+3
|
* Revert "proto: Add a new ToRelayMsg util"Gabriela Moldovan2026-02-121-13/+0
| | | | | | | | | | This reverts commit 04ab3cd848d7977baf58dd64ebfcad6aa54ecb17. Reverted because we no longer need to "peek" into the opaque `CircChanMsg` of a circuit reactor: now the implementation-dependent part of the reactor is in charge of handling the channel messages, and extracting `Relay` objects out of RELAY/RELAY_EARLY cells, which then get processed in the base reactor.
* proto: Publicly re-export MaybeVerifiableRelayResponderChannelDavid Goulet2026-02-091-0/+2
| | | | | This type is needed in the tor-chanmgr crate in order to decide to verify or not the underlying relay channel.
* proto: Replace relay reactor with new generic reactorGabriela Moldovan2026-01-291-14/+144
|
* proto: Add a new ToRelayMsg utilGabriela Moldovan2026-01-291-0/+13
| | | | | | | | | This will be used in a future commit, inside the new generic circuit reactor. We need it because RELAY cells are handled very similarly, so we need some way of finding out if a given generic chancell is actually a RELAY cell that we can handle in an implementation-agnostic way.
* proto: #[macro_use] be gone!Gabriela Moldovan2025-12-101-0/+2
|
* proto: Move relay specific unit test to relay moduleDavid Goulet2025-12-101-0/+41
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Move RelayCircChanMsg into relay moduleDavid Goulet2025-12-101-0/+23
| | | | | | This follows the move of the client specific object. Signed-off-by: David Goulet <[email protected]>
* proto: Fix a number of newly broken doc linksGabriela Moldovan2025-11-241-1/+2
|
* proto: Add a Tunnel::Relay variant for StreamTargetGabriela Moldovan2025-11-241-0/+88
|
* proto: Give RelayCirc a DynTimeProviderGabriela Moldovan2025-11-241-0/+5
| | | | This will be needed soon.
* proto: Remove doc ref to private itemGabriela Moldovan2025-10-291-1/+1
|
* proto: Add RelayCirc API for checking if circuit is closedGabriela Moldovan2025-10-291-0/+7
|
* proto: Remove redundant channel from RelayCircGabriela Moldovan2025-10-291-3/+0
| | | | | We don't really need this channel here, because we already have control and command channels for checking if the reactor task is still alive.
* proto: Make RelayCirc publicGabriela Moldovan2025-10-291-1/+1
|
* proto: Rename RelayReatorHandle to RelayCircGabriela Moldovan2025-10-291-2/+2
| | | | | | | | | While this is technically a "reactor handle", I think RelayCirc sounds better, because this is essentially our only public API for interacting with a relay circuit (it will be used outside of tor-proto). (This would also be consistent with our existing ClientCirc client-side terminology).
* proto: Move RelayReactorHandle to relay moduleGabriela Moldovan2025-10-291-0/+15
| | | | This will soon become `pub`, so I am factoring it out of `reactor.rs`.
* proto: Add RelayInitiatorHandshakeDavid Goulet2025-10-231-0/+1
| | | | | | | This implements the relay initiator side of the handshake up to the creation of an unverified channel. Signed-off-by: David Goulet <[email protected]>
* 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.
* proto: Reorganize relay_tunnel module.Gabriela Moldovan2025-08-181-0/+14
This reorganizes the `relay_tunnel` module as per @dgoulet's [suggestion]. [suggestion]: https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3162/diffs#note_3240092