aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/path/exitpath.rs
Commit message (Collapse)AuthorAgeFilesLines
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* circmgr: Port to web-time-compat.Nick Mathewson2026-03-261-3/+4
|
* Remove unnecessary `doc(cfg(...))` attributesNeel Chauhan2025-12-041-1/+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-0/+2
| | | | | These are all aimed at figuring out in more detail what's going on in #2079 and related issues.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-2/+2
| | | | | | | | | | | | | | 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.
* relay-selection: Add FamilyRules to exclude_relays_in_same_family.Nick Mathewson2025-02-251-10/+18
| | | | | | | | | | | | When we're trying to exclude relays by family, we need to know which lists to look at. This information ultimately comes from the network parameters. We could avoid this change if we just told clients "look at all family information all the time", but that's not what the proposal says. This is a breaking change.
* tor-netdir: Allow access to the `ConsensusBuilder` when building test netdirs.Gabriela Moldovan2024-09-091-1/+1
| | | | | 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: removed unused 'skip_guard_subnet_check' workaround in testsSteven Engler2024-08-151-18/+5
|
* tor-circmgr: removed unused "chosen exit" functionalitySteven Engler2024-08-151-108/+8
|
* tor-circmgr: fix flaky `path::exitpath::test::by_ports` testSteven Engler2024-08-131-7/+20
| | | | | | | | | | | | | | | | The `path::exitpath::test::by_ports` test sometimes failed now that the test is using a `GuardMgr` since `select_guard`, when given a chosen exit, only ensures that the guard and chosen exit are not in the same family. It does not ensure that the guard and exit do not share an extended family. This commit relaxes an assertion in the test. ```text thread 'path::exitpath::test::by_ports' panicked at crates/tor-circmgr/src/path/exitpath.rs:295:9: assertion failed: r1.can_share_circuit(r3, subnet_config) ``` This "chosen exit" functionality isn't actually being used anywhere (`ExitPathBuilderInner::ChosenExit` is only ever constructed in tests).
* tor-circmgr: assert in test that exit path begins with guardSteven Engler2024-08-121-2/+4
|
* tor-circmgr: make `GuardMgr` mandatorySteven Engler2024-08-121-25/+31
| | | | | | | 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-88/+94
| | | | | | 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.
* exitpath: Refactor a test to use tor-relay-usage.Nick Mathewson2024-03-281-20/+14
|
* Remove temporary functions in CheckedRelay.Nick Mathewson2024-03-281-3/+4
|
* tor-circmgr: Move ExitPathBuilder::from_chosen_exit under the test mod.Gabriela Moldovan2024-03-201-10/+13
| | | | | `ExitPathBuilder` is now `pub(crate)`, so we need to move this under the `test` module to fix the "unused" clippy warning.
* tor-circmgr: Make the path module crate-private.Gabriela Moldovan2024-03-201-6/+6
| | | | | | | | | | | | | | We're not currently using any of the path builders outside of `tor-circmgr`, so let's make them crate-private for now. Care must be taken if/when we decide to make them public again. For instance, the `HsPathBuilder` exposes two path building functions, one that uses vanguards, and one that doesn't. We want to strongly encourage the use of the vanguards-aware version of the function whenever the `vanguards` feature is enabled, without breaking any of its existing non-vanguard uses. Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2046#note_3010217
* tor-circmgr: Move pick_path out of AnonymousCircuitBuilder.Gabriela Moldovan2024-03-141-9/+25
| | | | This enables us to make `AnonymousCircuitBuilder` private.
* tor-circmge: Remove AnyRelayForOnionService.Gabriela Moldovan2024-03-141-34/+0
|
* tor-circmgr: Implement AnonymousPathBuilder for ExitPathBuilder.Gabriela Moldovan2024-03-141-161/+24
|
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* circmgr: Rename "any exit" code to reflect its real purposeNick Mathewson2024-03-121-7/+10
| | | | | (These functionalities are for onion service circuits, and don't actually need to go to an exit at all.)
* circmgr: Begin porting path selection to tor-relay-selectionNick Mathewson2024-03-121-173/+120
| | | | | This covers the easy cases, where we are selecting relays at random based on a selector.
* Mark code with "TODO #504" and "TODO #789".Nick Mathewson2024-02-221-0/+10
| | | | | | | | 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.
* Add a couple of TODOs about Stable-based path selection.Nick Mathewson2024-02-201-0/+4
|
* When building paths, require the Stable flag as appropriateNick Mathewson2024-02-201-0/+21
| | | | | | | | | | | | 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.
* Require the Fast flag on all randomly selected relays.Nick Mathewson2024-02-201-9/+16
| | | | | | This matches the behavior of C tor. Part of #1100.
* Require that guards are Fast and Stable.Nick Mathewson2024-02-201-1/+1
| | | | | | This matches the behavior of C tor. Part of #1100.
* arti-client: add exit selection with GeoIP country codeseta2023-09-181-1/+54
| | | | | | | | | | | | | | | | | | | | 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
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* ExitPath: Add an explanation of WeightRole::Exit on non-exit circsNick Mathewson2023-04-121-0/+7
| | | | | | | | | In one case, we use WeightRole::Exit on circuits that can't actually be used to exit. This commit adds a comment to explain why, so that we don't wonder about it in the future, and we have some indication of whether it's still appropriate. Closes #785
* circmgr: Mark a number of internal APIs as hs-only.Nick Mathewson2023-04-061-0/+4
| | | | | | This resolves a few dead-code warnings. Closes #801.
* circmgr: Expand an incomplete comment in exitpath.rsNick Mathewson2023-04-061-2/+6
|
* circmgr: Add a usage for building the beginning of an hs circNick Mathewson2023-03-221-1/+44
| | | | | This only builds the first 3 hops. It can be extended to a fourth hop later -- or not, depending on the circuit kind.
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-121-1/+8
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* Refactor external guardmgr APIs: Stop taking NetDir arguments.Nick Mathewson2022-11-081-3/+2
| | | | | | | | | These arguments were used only for legacy (testing) purposes; the tests now use `TestNetDirProvider`. This lets us simplify our internal logic for passing a `NetDir` to our samples, and prepare for having a `BridgeSet` to pass there instead. This is a breaking change to `guardmgr` and `circmgr`.
* guardmgr config: Introduce and require new GuardMgrConfig traitIan Jackson2022-11-031-1/+3
| | | | | It doesn't seem to me like it makes sense to provide the backward compatibility here.
* Circmgr: construct paths using either Relay or OwnedCircTargetNick Mathewson2022-10-241-24/+80
| | | | | | | | | | | Previously we could only use Relay for this case, which won't work any more: a Bridge is not a `tor_netdir::Relay`. Instead we allow the GuardMgr to give us something that knows how to convert itself into an OwnedCircTarget. This change required a far amount of follow-on revisions and refactoring, but it should all be internal to the path-building logic.
* Add the necessary APIs for bridge-based circuit construction.Nick Mathewson2022-09-261-0/+1
|
* tor-netdir: Collapse by_id and by_relay_id into a single fn.Nick Mathewson2022-08-101-1/+2
| | | | | | There are some downstream changes required for this to work, but they are all just unit tests that could no longer infer the type of an Ed25519 key.
* Final (?) API revisions for tor-linkspecNick Mathewson2022-08-101-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, each individual identity type becomes optional. The functions that expose them unconditionally are now in a "legacy" trait that only some downstream types are expected to implement. There are new convenience APIs in HasRelayIds: * to return Option<&keytype>, * to see if one identity-set contains another. This commit will break several downstream crates! For the reviewer's convenience, I will put the fixes for those crates into a series of squash! commits on this one. tor-netdir ---------- Revise tor-netdir to accept optional identities. This required some caveats and workarounds about the cases where we have to deal with a key type that the tor-netdir code does not currently recognize at all. If we start to add more identity types in the future, we may well want more internal indices in this code. tor-proto --------- In order to make tor-proto support optional identities, there were fewer changes than I thought. Some "check" functions needed to start looking at "all the ids we want" rather than at "the two known IDs"; they also needed to accommodate that case where we don't have an ID that we demand. This change will also help with bridges, since we want to be able to connect to a bridge without knowing all of its IDs up front. The protocol currently _requires_ the two current ID types in some places. To deal with that, I added a new `MissingId` error. I also removed a couple of unconditional identity accessors for chanmgr; code should use `target().identity(...)` instead. tor-chanmgr ----------- This is an incomplete conversion: it does not at all handle channel targets without Ed25519 identities yet. It still uses those identities to index its internal map from identity to channel; but it gives a new `MissingId` error type if it's given a channel target that doesn't have one. We'll want to revise the map type again down the road when we implement bridges, but I'd rather not step on the channel-padding work in progress right now. tor-guardmgr ------------ This change is mostly a matter of constructing owned identity types more sensibly, rather than unwrapping them directly. There are some places marked with TODOs where we still depend on particular identity types, because of how the directory protocol works. This will need revisiting when we add bridge support here. tor-circmgr ----------- These changes are just relatively simple API changes in the tests.
* Introduce a RelayIdSet and use it in place of HashSet<RelayId>.Nick Mathewson2022-08-101-8/+11
| | | | | This makes lookups a little more efficient. I do with that HashSet just supported this use-case, but for now this seems our best option.
* Teach guard restrictions about RelayId.Nick Mathewson2022-08-101-2/+7
| | | | | This implementation is (sadly) too copy-heavy or now, because HashSet<RelayId> can't be indexed with RelayIdRef.
* Introduce HasRelayIds::same_relay_ids.Nick Mathewson2022-08-021-4/+4
| | | | | This method tells if two HasRelayIds contain exactly the same set of Relay identities, and is generally useful for debugging.
* tor-linkspec: Refactor out traits to represent a relay's ID set.Nick Mathewson2022-08-021-1/+1
| | | | | | | | | | | | | | We want the set of identities supported by a relay to be extensible in the future with minimal fuss; we'd also like to make working with these ID sets more convenient. To handle that, this commit adds a new trait for "Something that has the same IDs as a relay" and a new object for "an owned representation of a relay's IDs." This commit introduces a similar trait for "Something with a list of SocketAddr, like a relay has." There's no owned equivelent for that, since Vec<SocketAddr> is already a thing. Closes #428.
* CircMgr: Remove directory liveness testing.Nick Mathewson2022-07-261-14/+2
|
* circmgr: Use FilterCounts to explain why we couldn't build pathsNick Mathewson2022-07-121-6/+20
|