summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* maint/add_warning: Run script to add new warningGabriela Moldovan2026-01-271-0/+1
| | | | This adds the lint to all our crates.
* Remove unnecessary `doc(cfg(...))` attributesNeel Chauhan2025-12-041-3/+0
| | | | | | | | | Fixes part of #2193. (Edits from nickm: I selected the cases here that I could verify were correct from immediate context.) Edited-by: Nick Mathewson <[email protected]>
* opentelemetry: Instrument a bunch of functions.Wesley Aptekar-Cassels2025-11-241-1/+17
| | | | | These are all aimed at figuring out in more detail what's going on in #2079 and related issues.
* circmgr: Implement expiration for long-lived tunnels.Nick Mathewson2025-11-121-1/+3
| | | | | | | | | | | | | | | | | 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.
* circmgr: make expiration functions asyncNick Mathewson2025-11-121-8/+11
| | | | We'll need them to be async so they can call disused_since() on tunnels.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-2/+2
| | | | Run maint/add_warning
* all: run cargo fmtSteven Engler2025-11-041-1/+1
|
* all: replace all uses of `futures::task::SpawnExt` with `tor_rtcompat::SpawnExt`Steven Engler2025-11-041-1/+1
|
* Remove "doc_auto_cfg" incantation from all crates.Nick Mathewson2025-09-291-1/+1
| | | | This feature has been removed from nightly, in favor of doc_cfg.
* Move `FallbackDir` into `tor-dircommon`Clara Engler2025-09-111-1/+1
|
* 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.
* circmgr: Feature gate multi path tunnel with conflux flagDavid Goulet2025-08-051-5/+9
| | | | Signed-off-by: David Goulet <[email protected]>
* Revert "circmgr: Feature-gate all the onion service tunnel types."Gabriela Moldovan2025-08-051-13/+1
| | | | This reverts commit 9dca6010d17e2a4b9deee34c9bb66e523a6ac834.
* circmgr: Feature-gate all the onion service tunnel types.Gabriela Moldovan2025-08-051-1/+13
| | | | | We shouldn't be exposing these unless `hs-service`/`hs-client` is enabled.
* hs: Use the new Tunnel interface for onion serviceDavid Goulet2025-08-051-1/+1
|
* circmgr: Return more type specific tunnelDavid Goulet2025-08-051-7/+11
| | | | | | | | | | This is the first step towards making the circmgr return high level tunnel types (wrappers around ClientTunnel). Future commits will then modify each subsystems to use those specific types. They are split in order to reduce complexity. Signed-off-by: David Goulet <[email protected]>
* tunnel: Implement Buildable for ClientTunnelDavid Goulet2025-08-051-6/+6
| | | | | | | | | | | | 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]>
* circmgr: Major rename for the new Tunnel namespaceDavid Goulet2025-08-051-30/+30
| | | | | | | | | | | | 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]>
* circmgr: New Tunnel object interfaceDavid Goulet2025-08-051-0/+8
| | | | | | | | | | 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]>
* Temporarily suppress mismatched_lifetime_syntaxes.Gabriela Moldovan2025-07-071-0/+1
| | | | See #2060.
* *: suppress cognitive_complexity warnings from nightlyNick Mathewson2025-05-291-0/+2
| | | | | | | | | | | | | 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.
* circmgr: Propagate Option<HsCircKind> down to path selection functionsNick Mathewson2025-05-201-5/+12
| | | | | | 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: Make path module public on "--features=experimental-api"Nick Mathewson2025-05-051-1/+9
| | | | | | | | | | | | Back in 4c1eb94173521bc5104449327650e20ffe32afa7, for sensible reasons, we made `tor_circmgr::path` a crate-private module. But when we did that, we lost the ability for callers to construct circuits with custom paths. This will make it possible for callers to build custom circuits again, without committing to a very-long-term API for that. Closes #1981.
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-1/+1
| | | | - `rand::thread_rng()` has been deprecated and renamed to `rand::rng()`
* circmgr: Remove the CircParameters build .expect()David Goulet2025-01-161-4/+4
| | | | | | 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-9/+16
| | | | | | | | | | | | | | | 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-13/+10
| | | | | | | | | | | | | | 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]>
* clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* tor-circmgr: Rename Short/Extended to Naive/Guarded.Gabriela Moldovan2024-10-241-1/+1
|
* tor-circmgr: s/HsCircStubKind/HsCircStemKind.Gabriela Moldovan2024-10-241-3/+3
| | | | As per #1479
* Disable a lot of dead code warningsIan Jackson2024-10-171-0/+3
| | | | | | | Now cargo check --workspace --no-default-features --all-targets cargo build -p arti --no-default-features --features=memquota,tokio,native-tls are both clean.
* CircMgr: Move note_external_{failure, success} methods to generic impl.Wesley Aptekar-Cassels2024-10-031-27/+27
|
* CircMgr: Move get_or_launch_dir_specific method to generic impl.Wesley Aptekar-Cassels2024-10-031-18/+18
|
* CircMgr: Move get_or_launch_exit method to generic impl.Wesley Aptekar-Cassels2024-10-031-45/+45
|
* CircMgr: Move get_or_launch_dir method to generic impl.Wesley Aptekar-Cassels2024-10-031-8/+8
|
* CircMgr: Move skew_events method to generic impl.Wesley Aptekar-Cassels2024-10-031-11/+11
|
* CircMgr: Move retire_circ method to generic impl.Wesley Aptekar-Cassels2024-10-031-6/+6
|
* CircMgr: Move reconfigure method to generic impl.Wesley Aptekar-Cassels2024-10-031-67/+67
|
* CircMgr: Move retire_all_circuits method to generic impl.Wesley Aptekar-Cassels2024-10-031-11/+11
|
* CircMgr: Start writing tests.Wesley Aptekar-Cassels2024-10-031-272/+331
|
* CircMgr: Make CircMgr and HsCircPool generic over builder type.Wesley Aptekar-Cassels2024-09-241-98/+263
| | | | | | | | | | 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.
* Fix typosDimitris Apostolou2024-09-031-1/+1
|
* tor-circmgr: make `GuardMgr` mandatorySteven Engler2024-08-121-4/+0
| | | | | | | Functions that took `Option<&GuardMgr>` now take only `&GuardMgr`. Three unit tests were removed that covered behaviour when no guard manager was set.
* tor-circmgr: Remove VanguardMode from Pool.Gabriela Moldovan2024-06-031-3/+7
| | | | | | | | | Storing the VanguardMode in multiple places (in the VanguardMgr *and* the HS circ Pool) is dangerous and can lead to split brain situations where different parts of the code think they are running in different VanguardModes. See #1424
* Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | This commit is automatically generated.
* tor-guardmgr: Temporarily reintroduce VanguardConfig.Gabriela Moldovan2024-04-291-1/+1
| | | | | | | | | | | | | | As discussed on #tor-dev, I'm reintroducing `VanguardConfig` for now. The `VanguardConfig` specifies what mode (full/lite/disabled) the `VanguardMgr` should run in. We currently don't have a separate modes for HS clients and HS services. We shouldn't actually *need* a `VanguardConfig` at all, so this is just a (hopefully!) short- or medium-term fix until we sort out #1382 (which might involve making breaking changes to our `reconfigure()` APIs). Closes #1272
* tor-guardmgr: Store whether we're running an onion svc (fmt).Gabriela Moldovan2024-04-111-1/+6
|
* tor-guardmgr: Store whether we're running an onion svc.Gabriela Moldovan2024-04-111-2/+8
| | | | | | The `VanguardMgr` needs to know whether arti is running as an onion service or not, in order to figure out which of the `vanguards_enabled` and `vanguards_hs_service` modes to use.