aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/usage.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-netdoc: Wrap port policies in InternClara Engler2026-06-241-2/+4
| | | | This commit wraps the port policies in an Intern.
* circmgr: Port to web-time-compat.Nick Mathewson2026-03-261-2/+3
|
* opentelemetry: Instrument a bunch of functions.Wesley Aptekar-Cassels2025-11-241-1/+2
| | | | | These are all aimed at figuring out in more detail what's going on in #2079 and related issues.
* tor-circmgr: fix incorrect match on `HsOnly`Steven Engler2025-11-191-0/+1
| | | | | | | | | | | | | | | | | | | Rust was treating this as a wildcard match if the `hs-common` feature wasn't enabled. This shouldn't have caused any bugs since the other match arms were already exhaustive, but this could have lead to a bug if new enum variants were added to `SupportedTunnelUsage`. ```text warning: variable `HsOnly` should have a snake case name --> crates/tor-circmgr/src/usage.rs:600:13 | 600 | HsOnly => { | ^^^^^^ help: convert the identifier to snake case: `hs_only` | = note: `#[warn(non_snake_case)]` (part of `#[warn(nonstandard_style)]`) on by default warning: `tor-circmgr` (lib) generated 1 warning ```
* RelayFlags: Use RelayFlag enum variant names everywhereIan Jackson2025-11-181-1/+1
| | | | | | | Abolish the constants with the transitional names. This also abolishes the controversial name `H_S_DIR`, which Rust case transformation rules generated from `HSDir`.
* RelayFlags: Use the singular RelayFlag for naming individual flagsIan Jackson2025-11-181-2/+2
| | | | | | | | | | | | | | We're going to separate RelayFlag from RelayFlags. We could continue to provide a bunch of constant values for RelayFlags, for each individual type, but that would involve an ad-hoc derive, and would still be a bit of an unusual API. Instead, we're going to make ``RelayFlag` a normal enum. In this commit, we change everyone to refer to it by its singular name. Hopefully separating out this bulk change makes both this, and the core commit, easier to review.
* tor-netdoc: Remove the RelayFlags type alias in netstatusIan Jackson2025-11-181-1/+1
| | | | I would do `#[deprecated]` but empirically that has no effect...
* Fix compilation without all-features.Nick Mathewson2025-11-121-7/+8
|
* circmgr: Add a notion of long-lived tunnels.Nick Mathewson2025-11-121-0/+32
|
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-4/+4
| | | | | | | | | | | | | | 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-071-2/+1
| | | | | | | | | | | | | | | | | | 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.
* circmgr: Major rename for the new Tunnel namespaceDavid Goulet2025-08-051-73/+73
| | | | | | | | | | | | 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: Propagate Option<HsCircKind> down to path selection functionsNick Mathewson2025-05-201-4/+9
| | | | | | 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.
* tor-circmgr: Post-renaming documentation fixes.Gabriela Moldovan2024-10-241-1/+1
|
* tor-circmgr: s/stub/stem throughout.Gabriela Moldovan2024-10-241-1/+1
|
* tor-circmgr: s/HsCircStubKind/HsCircStemKind.Gabriela Moldovan2024-10-241-2/+2
| | | | As per #1479
* tor-circmgr: Remove AbstractSpec and FakeSpec.Wesley Aptekar-Cassels2024-09-161-17/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AbstractSpec and FakeSpec actually make testing more difficult, since they prevent using FakeBuilder in code that relies on the concrete TargetCircUsage and SupportedCircUsage types. Removing them means FakeBuilder can be used in more places, and also means that the test code is closer to the real code, since TargetCircUsage and SupportedCircUsage are now exercised directly in more tests. This did require making one change to a test, which I think was previously testing behaviour that was true for FakeSpec but not for the real code: The mgr::test::isolated test previously asserted that, in the case where three circuits were requested, two with isolation and one without, the non-isolated circuit would be shared with one of the isolated circuits. This was allowed by the FakeSpec::supports function. However, in the actual code, the path is as follows: * AbstractCircMgr::get_or_launch * AbstractCircMgr::prepare_action * CircList::find_open * AbstractSpec::find_supported * abstract_spec_find_supported * OpenEntry::supports * SupportedCircUsage::supports * StreamIsolation::compatible_same_type StreamIsolation::compatible_same_type checks owner_type, which is always zero for non-isolated streams and always non-zero for isolated streams, meaning that a isolated stream will never be compatible with a non-isolated stream. The seems like desirable behaviour, so I simply modified the test to make four connections, two isolated and two not, and checked that the isolated streams never share any circuits, and that the two non-isolated streams use the same circuit. As far as I can tell, this is the intended behaviour in the existing code.
* tor-netdir: Allow access to the `ConsensusBuilder` when building test netdirs.Gabriela Moldovan2024-09-091-2/+2
| | | | | This allows us to set SRVs for example (needed because by default, the test `NetDir` is built from a consensus that doesn't contain any SRVs).
* tor-circmgr: make `GuardMgr` mandatorySteven Engler2024-08-121-34/+30
| | | | | | | Functions that took `Option<&GuardMgr>` now take only `&GuardMgr`. Three unit tests were removed that covered behaviour when no guard manager was set.
* tor-circmg: prepare tests for runtime requirementSteven Engler2024-08-121-130/+135
| | | | | | This wraps some unit tests with `tor_rtcompat::test_with_all_runtimes!`. This is its own commit to get the indentation changes out of the way and declutter the following commit.
* tor-guardmgr: Store whether we're running an onion svc.Gabriela Moldovan2024-04-111-0/+2
| | | | | | 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.
* tor-guardmgr: Give VanguardMgr a handle to the runtime (fmt).Gabriela Moldovan2024-04-051-2/+12
|
* tor-guardmgr: Give VanguardMgr a handle to the runtime.Gabriela Moldovan2024-04-051-5/+6
|
* Remove temporary functions in CheckedRelay.Nick Mathewson2024-03-281-6/+6
|
* tor-circmgr: Rename pick_path to pick_path_with_vanguards.Gabriela Moldovan2024-03-201-1/+1
| | | | | | When the `vanguards` feature is enabled, we define `pick_path_with_vanguards` instead of `pick_path`, rather than conditionally defining 2 different versions of the same function.
* tor-circmgr: Give pick_path a VanguardMgr (fmt).Gabriela Moldovan2024-03-201-4/+36
|
* tor-circmgr: Give pick_path a VanguardMgr.Gabriela Moldovan2024-03-201-6/+26
|
* tor-circmgr: Tell HsPathBuilder what kind of circuit stub is needed (fmt).Gabriela Moldovan2024-03-201-5/+2
|
* tor-circmgr: Tell HsPathBuilder what kind of circuit stub is needed.Gabriela Moldovan2024-03-201-2/+8
|
* tor-circmgr: Move pick_path out of AnonymousCircuitBuilder.Gabriela Moldovan2024-03-141-3/+1
| | | | This enables us to make `AnonymousCircuitBuilder` private.
* tor-circmgr: Remove unused require_stability.Gabriela Moldovan2024-03-141-3/+0
|
* tor-circmgr: Use HsPathBuilder instead of ExitPathBuilder.Gabriela Moldovan2024-03-141-6/+7
|
* tor-circmgr: Implement AnonymousPathBuilder for ExitPathBuilder.Gabriela Moldovan2024-03-141-1/+3
|
* Annotate remaining "TODO #504" comments explaining why they are there.Nick Mathewson2024-03-121-4/+14
|
* circmgr: Rename "any exit" code to reflect its real purposeNick Mathewson2024-03-121-1/+1
| | | | | (These functionalities are for onion service circuits, and don't actually need to go to an exit at all.)
* New crate to define a high-level API for relay selectionNick Mathewson2024-03-121-45/+2
|
* Mark code with "TODO #504" and "TODO #789".Nick Mathewson2024-02-221-0/+5
| | | | | | | | I've done this by looking for every non-test instance of pick_relays or pick_n_relays, and for every non-test usage of any non-ID-related method on Relay or UncheckedRelay. Part of #504.
* Teach *CircUsage structs about stability.Nick Mathewson2024-02-201-12/+57
| | | | | | | | | | | This lets us check long_lived_ports only when we are constructing a TargetCircUsage, and lets us remember whether or not the circuit we've built is suitable for non-long-lived ports. It also lets us decide whether existing circuits are compatible with new requests. Closes #1100.
* Add a couple of TODOs about Stable-based path selection.Nick Mathewson2024-02-201-0/+2
|
* When building paths, require the Stable flag as appropriateNick Mathewson2024-02-201-2/+12
| | | | | | | | | | | | The Stable flag means that circuits build through a given relay are not likely to get closed precipitously. (Currently, the authorities guess this by looking at the relay's mean time between failures.) Generally speaking, paths must be Stable if: * They are going to get used for a rendezvous point. * They are going to get used for an introduction point. * They are going to get used for exiting to a member of long_lived_ports.
* Downgrade some messages to traceIan Jackson2023-11-291-2/+2
| | | | | These messages are very verbose and I doubt anyone will want them, usually, even when debugging.
* arti-client: add exit selection with GeoIP country codeseta2023-09-181-6/+89
| | | | | | | | | | | | | | | | | | | | This threads the country codes work through the rest of the codebase: - `tor-dirmgr` will now enable GeoIP with the embedded database when the `geoip` future is enabled - This can be extended later using the `DirMgrConfig` to allow specifying a custom database; this is not done here, though - `tor-circmgr`'s `SupportedCircUsage` and `TargetCircUsage` fields gain new `country_code` members to allow filtering circuits by country - These are `()` in builds where the `geoip` feature is not enabled -- doing it this way means we don't have to copy and paste huge swathes of code, since we can't use `#[cfg]` in patterns - `ExitPathBuilder` gains (hacked-in) support for choosing a relay with the correct country code - Due to the lack of conjuction, we just copy and paste a small bit, pending further refactoring - `StreamPrefs` now lets you specify a country code, letting embedders make use of the feature
* circmgr: Mark a number of internal APIs as hs-only.Nick Mathewson2023-04-061-0/+2
| | | | | | This resolves a few dead-code warnings. Closes #801.
* Add some missing importsIan Jackson2023-03-281-1/+4
| | | | | | | | Now nailing-cargo +stable clippy -p tor-hsclient --all-features --all-targets actually works. squash! Add some missing imports
* circmgr: Make a separate SupportedCircUsage for HS stuffNick Mathewson2023-03-221-3/+6
| | | | | This uncovered a bug: NoUsage wasn't correct for Hs circuits because of its behavior with channel_usage().
* circmgr: Add a usage for building the beginning of an hs circNick Mathewson2023-03-221-0/+25
| | | | | This only builds the first 3 hops. It can be extended to a fourth hop later -- or not, depending on the circuit kind.
* circmgr: make some imports conditionalNick Mathewson2022-11-181-2/+1
| | | | | This resolves an "unused import" warning when bridges are not enabled.
* Remove a spurious log that I committed by mistake. Whoops.Nick Mathewson2022-11-151-1/+0
|
* Implement more cases for `DirSpecificTarget`.Nick Mathewson2022-11-151-1/+22
| | | | | | Without this fix, any attempt to actually use a circuit for a `DirSpecificTarget` will fail, since supports() will say false, and `restrict_mut()` will say `NotSupported`.
* tor-circmgr: Make get_or_launch_dir_specific feature-specificIan Jackson2022-10-211-2/+9
|