aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-proto: fix failing cargo fmtSteven Engler2025-08-071-1/+1
|
* Merge branch 'enable-cgo' into 'main'Nick Mathewson2025-08-074-52/+34
|\ | | | | | | | | Enable counter-galois onion negotiation and make it work. See merge request tpo/core/arti!3133
| * proto: In CircuitExtender, derive relay crypt protocol from settings.Nick Mathewson2025-08-072-40/+25
| | | | | | | | | | | | | | | | | | This change fixes a CGO bug: when extending circuits with ntorv3, we were never actually using CGO encryption for the newly constructed layer. This change also simplifies the code a bit, by un-parameterizing CircuitExtender a bit.
| * proto: List CGO-related features in supported_client_protocolsNick Mathewson2025-08-061-3/+9
| |
| * proto: remove code that had disabled CGO.Nick Mathewson2025-08-061-9/+0
| | | | | | | | Now that we can negotiate CC, we can negotiate CGO.
* | Revert confusing change to use of StreamExt::into_futureNick Mathewson2025-08-071-2/+5
| | | | | | | | | | We're not sure why `cargo fix` did this, but it doesn't seem necessary.
* | Fix warnings and errors from edition 2024.Nick Mathewson2025-08-072-5/+8
| | | | | | | | | | | | | | | | | | | | The two main causes of errors were: - Since some of the lifetime rules have changed, we no longer need to do as many "bind a variable and immediately return it" patterns, and so clippy now warns about them. - We needed to adjust the explicit captures (`use<...>`) in a couple of our RPIT instances.
* | Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-0746-164/+217
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Update code for Edition 2024Nick Mathewson2025-08-0710-14/+13
|/ | | | | | | | | | | | | | | | | | 1. Run cargo fix --edition 2. Selectively revert the "if let"->"match" changes. These changes are meant to protect us from the lifetime changes for "if let" bindings in Rust 2024. But we're not actually relying on the old lifetime rules anywhere, and the match syntax here is quite ugly. 3. Automatically revert `$pat:expr_2021` to `$pat:expr`. (We don't actually want to restrict the expression syntax that our macros accept). Done with `git grep -l expr_2021 | xargs perl -i -pe 's/expr_2021/expr/g;'` 4. Run cargo fmt.
* tor_proto: add FLOWCTRL_CC to supported_client_protocolsNick Mathewson2025-08-061-5/+15
| | | | | Since we now allow it to be turned on, we can include it among our supported protocols.
* tor-proto: make stream recv queues unbounded if "flowctl-cc" enabledSteven Engler2025-08-055-15/+54
|
* Merge branch 'use-cc' into 'main'Nick Mathewson2025-08-051-11/+0
|\ | | | | | | | | Use congestion control when "flowctl-cc" is enabled See merge request tpo/core/arti!3118
| * tor-proto: use congestion control when "flowctl-cc" is enabledSteven Engler2025-08-041-11/+0
| |
* | test: Fix build issues likely due to past rebase conflictsDavid Goulet2025-08-051-1/+2
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | proto: Deferred fmtGabriela Moldovan2025-08-052-4/+3
| |
* | conflux: Adjust docs and fix doc links.Gabriela Moldovan2025-08-056-18/+18
| |
* | proto: abolish path_ref() in favor of all_paths().Gabriela Moldovan2025-08-052-24/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | Until now, we've been using `ClientCirc::path_ref()` to get the *only* path of a circuit. Now that `ClientCirc` is a handle to a tunnel reactor (which may or may not be multi-path), we need to decide for each call site of `path_ref()`, if we actually want *all* paths in the tunnel, or if we expect the tunnel to be single-path and thus want the *only* path in the tunnel. I've added two new APIs to address this: `all_paths()`, for getting all the paths in the tunnel, and `single_path()` for getting the only path in the tunnel, or an error if the tunnel is single-path.
* | proto: Use UserMsgHandler instead of MsgHandler throughout.Gabriela Moldovan2025-08-051-8/+8
| |
* | proto: Make UserMsgHandler pub if send-control-msg is enabled.Gabriela Moldovan2025-08-051-0/+1
| | | | | | | | | | When the `send-control-msg` feature is enabled, we reexport it from `tor-proto`, so it needs to be made `pub`.
* | proto, circmgr: Fix feature-gating.Gabriela Moldovan2025-08-051-1/+2
| |
* | proto: Feature-gate UserMsgHandler.Gabriela Moldovan2025-08-051-1/+3
| |
* | proto: Return a more specific error message from allow_stream_requests.Gabriela Moldovan2025-08-052-5/+8
| | | | | | | | | | | | | | Previously the error message would say `Single circuit getter on multi path tunnel`. The new error message makes it clearer that calling `ClientTunnel::allow_stream_requests()` on a multi path tunnel is not supported.
* | proto: Set is_multi_path = true in the tests.Gabriela Moldovan2025-08-051-6/+14
| | | | | | | | | | | | | | | | | | | | This fixes the `allow_stream_requests()` tests which ensures we don't allow incoming streams on multipath tunnels (because we don't currently support it). This also changes `newcirc_ext` to return `ClientTunnel` instead of `Arc<ClientTunell>` (we need to mutate `ClientTunnel` to manually set `is_multi_path` on its inner `ClientCirc`).
* | proto: Avoid using as_single_circ() in the conflux tests (fmt).Gabriela Moldovan2025-08-051-5/+1
| |
* | proto: Avoid using as_single_circ() in the conflux tests.Gabriela Moldovan2025-08-051-3/+2
| | | | | | | | `as_single_circ()` returns an error for multipath tunnels.
* | proto: Fix the tunnel/circuit.rs unit testsDavid Goulet2025-08-052-80/+122
| | | | | | | | | | | | Adapt all tests to use the new ClientTunnel. Signed-off-by: David Goulet <[email protected]>
* | proto: Remove todo!() from StreamTarget::protocol_error()David Goulet2025-08-051-1/+1
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | tunnel: Implement start_conversation() for all tunnel typesDavid Goulet2025-08-053-152/+154
| | | | | | | | | | | | | | | | | | | | The BaseTunnel now has a start_conversation() which takes a TargetHop meaning it can be used with a multi path tunnel. The Conversation object has been moved into the tunnel namespace out of the circuit one. Signed-off-by: David Goulet <[email protected]>
* | tunnel: Implement Buildable for ClientTunnelDavid Goulet2025-08-051-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | In order to pull this off, the Arc requirement needs to go away because the Arc<ClientCirc> is now within the ClientTunnel. This commit also has a rename of the CircuitBuilder to TunnelBuilder in order to reflect the change that it now builds a ClientTunnel. There is a slight rename in tor-proto as well just for accuracy. Signed-off-by: David Goulet <[email protected]>
* | proto: Change PendingClientCirc to yield back a ClientTunnelDavid Goulet2025-08-052-24/+25
| | | | | | | | | | | | And rename it in the process to "PendingClientTunnel". Signed-off-by: David Goulet <[email protected]>
* | proto: Add last_hop() to Tunnel interfaceDavid Goulet2025-08-051-0/+29
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | circmgr: New Tunnel object interfaceDavid Goulet2025-08-051-2/+2
| | | | | | | | | | | | | | | | | | | | Introduce the new Tunnel structs that is planned to expose publicly as a replacement to `ClientCirc`. Future commits will make those tunnel objects be used accross the code base up until tor-proto which than handles Circuit directly. Signed-off-by: David Goulet <[email protected]>
* | proto: Move ClientCirc stream functions to ClientTunnelDavid Goulet2025-08-056-483/+456
| | | | | | | | | | | | | | | | | | | | | | | | | | 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]>
* | proto: Add a new ClientTunnel typeGabriela Moldovan2025-08-053-2/+103
|/ | | | | | | | | | | | | | | | | | To use the functionality only allowed on single-circuit tunnels (such as `extend*`), callers will have to call `ClientTunnel::as_single_circ()` to obtain a handle to the underlying `ClientCirc`. This is an opinionated design decision that goes against the plan from [!2790]. It stems from my thinking that it would make more sense to keep `ClientCirc`, than to merge it into `ClientTunnel`. If we merge the two, many functions will need become fallible and less ergonomic, because the user of `ClientTunnel` needs to know whether the `ClientTunnel` consists of a single-circuit or not. Providing (fallible) access to the underlying `ClientCirc` of the `ClientTunnel` seems simpler than the alternative. That being said, I am open to switching back to the original plan if this design turns out to be annoying to work with. [!2790]: https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2790
* proto: Add test for ShutdownAndReturnCircuit error condition.Gabriela Moldovan2025-07-251-0/+47
| | | | | | | This command is supposed to return an error when handled by a tunnel reactor that has more than one circuit. Prevents the `ConfluxSet::take_single_leg()` bug fixed in 00bb0628.
* proto: Remove an already-addressed TODO.Gabriela Moldovan2025-07-251-2/+0
| | | | This was fixed in !3091
* proto: Remove element_idx + remove in favor of remove_unchecked().Gabriela Moldovan2025-07-251-11/+1
|
* proto: Replace hand-rolled exactly_one() impl with itertools.Gabriela Moldovan2025-07-252-52/+27
| | | | | | | This slightly reduces the amount of code we need to maintain. This also drive-by fixes a bug in `ConfluxSet::take_single_leg`, which previously never actually checked if the conflux set was of size one.
* proto: Add a ConfluxSet::remove_unchecked method.Gabriela Moldovan2025-07-251-0/+16
| | | | | This method will enable us to remove some duplicated code, as well as the `element_idx` function.
* tor-proto: Temporary measure to disable CGO.Nick Mathewson2025-07-231-1/+11
| | | | | | | | | | | | | This commit prevents us from ever deciding that another relay supports CGO, which prevents us from trying to negotiate it. It also adds an assertion to make sure that we haven't tried to negotiate it. We can remove this once we're ready to have CGO turned on: right now it's blocked on being able to negotiate CC. I'm adding this so we can merge this branch (so that I can stop rebasing it.)
* Downgrade an XXXX to a TODO.Nick Mathewson2025-07-231-1/+3
|
* Remove now-needless allow(unused).Nick Mathewson2025-07-231-1/+0
|
* Refactor/simplify HopSettings constructionNick Mathewson2025-07-232-60/+108
| | | | | | | We now take an enum describing whether we are doing no negotiation, HsV3 negotiation, or full negotiation. This lets us do away with the notions of default relay crypto, and of declaring post-facto that no negotiation has occurred.
* Rename and invert the sense of requires_stream_level_sendmes.Nick Mathewson2025-07-232-5/+9
| | | | | Instead call it compatible_with_cgo, which is what we actually care about in this context.
* proto: Send extensions as appropriate to negotiate CGO.Nick Mathewson2025-07-233-1/+54
| | | | Let's see if it works!
* proto: Construct CGO instances if that is what is selected.Nick Mathewson2025-07-232-2/+15
|
* proto: Take format+crypto settings from HopSettingsNick Mathewson2025-07-237-54/+58
| | | | | Since these will be negotiated (or determined as part of negotiation) they belong in HopSettings.
* tor-basic-utils: add `assert_val_impl_trait!` macroSteven Engler2025-07-171-2/+5
|
* tor-proto: replace `DataReader`Steven Engler2025-07-172-44/+48
| | | | | | | | | | | | `DataReader` -> `DataReaderInner` `DataReaderNew` -> `DataReader` This means that the `DataReader` now supports XON/XOFF flow control using the `XonXoffReader`. This means that it can receive requests for a new drain rate from the reactor, and can send the new drain rate to the reactor once there is no more stream data queued.
* tor-proto: add `DataReaderNew`Steven Engler2025-07-173-5/+75
| | | | This will later become `DataReader`.