summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/hspool.rs
Commit message (Collapse)AuthorAgeFilesLines
* *: suppress cognitive_complexity warnings from nightlyNick Mathewson2025-05-291-0/+1
| | | | | | | | | | | | | Apparently clippy nightly is better (or worse?) about detecting complex functions than before, so I'm suppressing these warnings where they occur. I have mixed feelings about these warnings: On the plus side, they really do help to detect functions that are twistier than they need to be. On the minus side, they get confused by tracing macros, and the "allows" do pile up. But on the plus side, those "allows" do provide a way to find functions that need to be refactored, and they are never uglier than the functions they decorate.
* hspool: Explain _why_ ClientRend is Guarded.Nick Mathewson2025-05-221-4/+12
| | | | (text from Gabi)
* hspool: ClientRend first should be GuardedNick Mathewson2025-05-221-4/+5
| | | | On !3007, @gabi-250 says that it was a mistake to have it be Naive.
* Apply 1 suggestion(s) to 1 file(s)Nick Mathewson2025-05-221-1/+1
| | | Co-authored-by: gabi-250 <[email protected]>
* circmgr: Apply last-hop-in-stem usage when retrieving a stem circ.Nick Mathewson2025-05-201-20/+85
| | | | Closes #1911.
* circmgr: when building client rend stems, make sure last hop has new_rend usage.Nick Mathewson2025-05-201-12/+29
|
* guardmgr, circmgr: Make vanguard selection take a RelaySelector.Nick Mathewson2025-05-201-6/+8
| | | | | | This is the preferred type for choosing a relay, since unlike a RelayExclusion, it lets us add multiple restrictions, and a relay usage.
* circmgr: Propagate Option<HsCircKind> down to path selection functionsNick Mathewson2025-05-201-2/+2
| | | | | | We'll need this in order to build paths that are specifically for client rend circuits. I thought of using a boolean here, but that had potential to get ugly in the future.
* circmgr: Change get_or_launch_stem to take a HsCircKindNick Mathewson2025-05-201-13/+22
| | | | | | We're going to be looking at this a little more closely in order to decide whether the last hop of a stem can be used as a rendezvous point.
* circmgr: rename ensure_circuit_{compatible_with => can_extend_to}_targetNick Mathewson2025-05-201-6/+3
| | | | | There are two other functions called "compatible_with_target" that check a different property, so this one was confusing.
* tor-proto: Future-proof some comments about path_ref() errors.Gabriela Moldovan2025-05-151-2/+2
| | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2996#note_3199590
* tor-proto: Return Error::Protocol if ClientCirc accessors return an error.Gabriela Moldovan2025-05-151-32/+40
| | | | | | | | | | The `ClientCirc` accessors will only return an error if the underlying circuit is closed, so it doesn't make sense to map these errors to `Bug`. Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2996#note_3199072 and https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2996#note_3199073
* tor-proto: Update the TunnelMutableState when a circuit is removed.Gabriela Moldovan2025-05-151-7/+25
| | | | | | | | This is messy, because `ClientCirc::{path_ref, n_hops, ..}` become fallible (we can't unwrap the result, because when a circuit is closed, its state gets removed from the `TunnelSharedState`, but its `ClientCirc` handle continues to exist, so any attempt to retrieve the state will result in an `Err`).
* circmgr: Rename AbstractCirc::{extend_ntor => extend}Nick Mathewson2025-04-281-1/+1
| | | | | We don't want to be thinking about ntor vs ntor3 in circmgr.
* circ: Remove CircParameters reference in call stackDavid Goulet2025-04-231-1/+1
| | | | | | | | | | | This avoids cloning the object and instead allows us to have a CircParameters per hop on the circuit path. This will come handy with congestion control where each hop might have different congestion control parameters. Part of #1817 Signed-off-by: David Goulet <[email protected]>
* tor-circmgr: Added TODO about replacing OnceCellhashcatHitman2025-04-171-0/+8
| | | | | - [`once_cell::sync::OnceCell`] should be replaced by [`std::sync::OnceLock`] once the blocking methods are stabilized and within our MSRV.
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-2/+2
| | | | - `rand::thread_rng()` has been deprecated and renamed to `rand::rng()`
* circmgr: Remove the CircParameters build .expect()David Goulet2025-01-161-4/+2
| | | | | | Instead, return an error and make all call site handle it. Signed-off-by: David Goulet <[email protected]>
* circ: Specialize the circparams from netparams functionDavid Goulet2025-01-161-5/+3
| | | | | | | | | | | | | | | Congestion control parameters have specific values depending on the circuit type. Instead of using a CircuitType, which is removed in this commit, specialize the function in this case onion and exit. This allows us to get rid of CircuitType and solely use TargetCircUsage instead. At this commit, we use .expect() on the Builder. Future commit will remove this to return a Result in case of failure. Worth noting that we don't expect one. Signed-off-by: David Goulet <[email protected]>
* circmgr: Modify CircParameters for congestion controlDavid Goulet2025-01-161-4/+9
| | | | | | | | | | | | | | The congestion control parameters are created from the consensus parameters (netparams) and then put into the CircParameters object that is then passed down the tor-proto crate. Because different parameters are selected depending on the circuit type (onion vs exit vs sbws), a CircuitType enum is introduced for the sole purpose of being used to select the right parameters. Related #534 Signed-off-by: David Goulet <[email protected]>
* tor-circmgr: Rename Short/Extended to Naive/Guarded.Gabriela Moldovan2024-10-241-15/+15
|
* tor-circmgr: Post-renaming documentation fixes.Gabriela Moldovan2024-10-241-4/+4
|
* tor-circmgr: s/stub/stem throughout.Gabriela Moldovan2024-10-241-23/+23
|
* tor-circmgr: s/HsCircStubKind/HsCircStemKind.Gabriela Moldovan2024-10-241-21/+21
| | | | As per #1479
* tor-circmgr: s/HsCircStubKind/HsCircStemKind.Gabriela Moldovan2024-10-241-25/+25
| | | | As per #1479
* tor-circmgr: Use the new vanguards terminology throughout.Gabriela Moldovan2024-10-241-19/+19
| | | | | | | | This is the first step towards clarifying the questions from !2230. Corresponding torspec changes: https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/282 Part of #1479
* memquota: Change ToplevelAccount to be an alias for Arc<MemoryQuotaTracker>Ian Jackson2024-10-151-1/+2
| | | | Fixes a TODO.
* memquota: Add a toplevel account in tor-chanmgrIan Jackson2024-10-031-0/+2
| | | | | | | | | Plumb through a top-level account. This doesn't have any channel-specific, circuit-specific or stream-specific accounts yet. tor-circmgr's and tor-hsclient's *tests* need fake account. In arti-relay, use a dummy account for now.
* CircMgr: Start writing tests.Wesley Aptekar-Cassels2024-10-031-1/+1
|
* Upgrade to derive_more version 1.0.0Nick Mathewson2024-09-251-2/+2
| | | | | | The `derive_more` crate broke backward compatibility with this version, so this change involved quite a few manual fixups. With luck, they'll keep compatibility for some while in the future.
* CircMgr: Make CircMgr and HsCircPool generic over builder type.Wesley Aptekar-Cassels2024-09-241-91/+161
| | | | | | | | | | This will allow for testing, as the CircuitBuilder can be replaced with a mocked version. This did require moving some of what was in the CircuitBuilder impl into the AbstractCircuitBuilder type, since Drop implementations can't be specialized, but that's fine, as we'll probably be doing more of that in the future anyways.
* tor-circmgr: Make client rendezvous circuits EXTENDED instead of SHORT.Gabriela Moldovan2024-06-251-3/+3
| | | | | | | | This updates the code to match the spec. This fixes TROVE-2024-008. Closes #1474
* tor-circmgr: Remove duplicated path building logic from HS pool.Gabriela Moldovan2024-06-201-30/+19
|
* tor-circmgr: Fix clippy warning.Gabriela Moldovan2024-06-201-1/+1
|
* tor-circmgr: Gate vanguard-specific code behind vanguards feature.Gabriela Moldovan2024-06-201-0/+15
| | | | | | | This is just code motion: moving the vanguard-specific parts of `maybe_extend_stub_circuit()` behind the `vanguards` feature will enable us to refactor it to use `select_middle_for_vanguard_circuit()`, which is only available if the `vanguards` feature is enabled.
* tor-circmgr: Rename HsCircStubKind::len to HsCircStubKind::num_hops.Gabriela Moldovan2024-06-201-3/+3
|
* tor-circmgr: Note which test prevents TROVE-2024-005.Gabriela Moldovan2024-06-201-0/+1
| | | | | | This test is not new (it was added in !2168), but I think it's a good idea to annotate the tests preventing security issues with the TROVE number and/or arti ticket they pertain to.
* tor-circmgr: Refactor duplicated circuit stub length calculation.Gabriela Moldovan2024-06-201-13/+25
| | | | Part of #1459
* tor-circmgr: Exclude the target when extending SHORT stubs.Gabriela Moldovan2024-06-041-4/+18
| | | | | When extending SHORT circuit stubs, the last hop shouldn't be the same as the circuit target.
* tor-circmgr: Apply deferred fmt.Gabriela Moldovan2024-06-041-1/+3
|
* tor-circmgr: Add TODOs about improving circuit length checks.Gabriela Moldovan2024-06-041-0/+2
|
* tor-circmgr: Remove HsPool::vanguards_enabled() (fmt).Gabriela Moldovan2024-06-041-2/+10
|
* tor-circmgr: Remove HsPool::vanguards_enabled().Gabriela Moldovan2024-06-041-24/+33
| | | | | | | | | Previously, the HsCircPool had a bug that caused SHORT lite-vanguards circuits to be incorrectly extended by one hop when being repurposed as EXTENDED circuits (EXTENDED circuits only need to be extended by extra hop if full vanguards are in use). Closes #1456 and #1458
* tor-circmgr: Validate the circuit stub length before returning it.Gabriela Moldovan2024-06-041-8/+68
|
* tor-circmgr: Display the offending hop if the circuit is not compatible with ↵Gabriela Moldovan2024-06-031-4/+5
| | | | target.
* tor-circmgr: Use has_any_relay_id_from to check for relay equality.Gabriela Moldovan2024-06-031-2/+2
| | | | | | | When checking for relay equality, we are happy to accept some false positives (which result in building/selecting a different circuit). We want to be less tolerant of false negatives, to avoid accidentally using a circuit that doesn't have the properties we need.
* tor-circmgr: Ensure circuit stubs are compatible with the target.Gabriela Moldovan2024-06-031-1/+39
| | | | | | This is a follow-up from !2167. It should prevent issues like #1417 from going unnoticed.
* tor-circmgr: Make retire_all_circuits unconditional.Gabi Moldovan2024-06-031-1/+0
| | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2168?commit_id=3c67fa55c7c5b0c4f30c1d57e8e67fe541d9c99e#note_3033368
* tor-circmgr: Log the kind of HS circuit stub we are selecting.Gabriela Moldovan2024-06-031-1/+7
|
* tor-circmgr: Remove VanguardMode from Pool (fmt).Gabriela Moldovan2024-06-031-3/+1
|