summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/mocks.rs
Commit message (Collapse)AuthorAgeFilesLines
* circmgr: Implement expiration for long-lived tunnels.Nick Mathewson2025-11-121-0/+4
| | | | | | | | | | | | | | | | | This code uses the algorithm of prop368: When a tunnel is sufficiently isolated, we want to expire it after it has been disused for a certain amount of time. The implementation is a little tricky, since we need to call an async function on ClientTunnel to look up the disused_since() check. We don't want to call async functions while holding locks, so we need to drop the TunnelList lock before we do the disused_since() calls, and the grab it again. As part of this change, I've had made expiration functions return the earliest time at which any tunnel might expire. We can use this in the future to spawn fewer expiration tasks, and scan the list of tunnels less often.
* proto: Add a circuit module shared between client and relay impls.Gabriela Moldovan2025-08-281-1/+2
| | | | | | | This is just code motion (I suggest reviewing with `--color-moved`). This also moves the implementation-agnostic parts from `tor_proto::client::circuit` to a new `tor_proto::circuit` module.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-1/+1
| | | | | | | | | | | | | | 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.
* Do not fully-qualify Sync.Gabriela Moldovan2025-08-051-1/+1
| | | | It's necessary and more verbose (and it's rather uncommon).
* proto: abolish path_ref() in favor of all_paths().Gabriela Moldovan2025-08-051-1/+1
| | | | | | | | | | | | | 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.
* circmgr: Fix unit testsDavid Goulet2025-08-051-3/+3
| | | | Signed-off-by: David Goulet <[email protected]>
* circmgr: Major rename for the new Tunnel namespaceDavid Goulet2025-08-051-17/+17
| | | | | | | | | | | | The CircMgr will no longer yield circuits but tunnels (src/tunnel.rs). This is a first step to rename most circuit related objects to use "tunnel" instead. Some "circuit" names have been kept for more precise definitions. No behavior changes. Signed-off-by: David Goulet <[email protected]>
* tor-proto: Update the TunnelMutableState when a circuit is removed.Gabriela Moldovan2025-05-151-2/+2
| | | | | | | | 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]>
* CircMgr: Start writing tests.Wesley Aptekar-Cassels2024-10-031-3/+36
|
* CircMgr: Make CircMgr and HsCircPool generic over builder type.Wesley Aptekar-Cassels2024-09-241-0/+239
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.