aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/path/dirpath.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.
* 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
* tor-circmgr: make `GuardMgr` mandatorySteven Engler2024-08-121-141/+16
| | | | | | | Functions that took `Option<&GuardMgr>` now take only `&GuardMgr`. Three unit tests were removed that covered behaviour when no guard manager was set.
* Remove temporary functions in CheckedRelay.Nick Mathewson2024-03-281-1/+1
|
* tor-circmgr: Make the path module crate-private.Gabriela Moldovan2024-03-201-3/+3
| | | | | | | | | | | | | | 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
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* circmgr: Begin porting path selection to tor-relay-selectionNick Mathewson2024-03-121-16/+12
| | | | | 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/+1
| | | | | | | | 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.
* Only pick Fast-flagged relays as directory cachesNick Mathewson2024-02-201-1/+3
| | | | | | Matches the behavior of C tor. Part of #1100.
* 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
|
* 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.
* Refactor external guardmgr APIs: Stop taking NetDir arguments.Nick Mathewson2022-11-081-10/+3
| | | | | | | | | 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.
* Allow "clippy::single_char_pattern" in tests.Ian Jackson2022-10-121-0/+1
| | | | | | | This lint exists for perf reasons, and this is rarely relevant in tests. Using double quoted str is generally cognitively less burdensome.
* Final (?) API revisions for tor-linkspecNick Mathewson2022-08-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 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: Refactor DirPathBuilder::pick_path.Nick Mathewson2022-07-121-9/+7
| | | | | We no longer needs to have a "return" at the end of each match block.
* circmgr: Use FilterCounts to explain why we couldn't build pathsNick Mathewson2022-07-121-8/+15
|
* Add more information to failed-to-select fallback errors.Nick Mathewson2022-07-071-1/+1
| | | | Also re-order the filters to be a little more logical.
* clippy: Consolidate many lints in maint/add_warningIan Jackson2022-06-241-1/+8
| | | | | | Found these by disabling the nightly dbg macro special case. Now, we have a mechanism for globally adding suppressions to tests, we can use that instead.
* tor-netdir: testnet: Make construct_netdir infallible (rustfmt)Ian Jackson2022-06-131-6/+2
| | | | | Run rustfmt. Separate commit to make review of the substantive commit easier.
* tor-netdir: testnet: Make construct_netdir infallibleIan Jackson2022-06-131-2/+0
| | | | | This is a *lot* of unwraps. The function takes no parameters and is used only for testing. It ought to be infallible.
* Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-021-4/+5
| | | | | | This only affects uses of thread_rng(), and affects them all more or less indiscriminately. One test does not work with ARTI_TEST_PRNG=deterministic; the next commit will fix it.
* FallbackDir: Use VecBuilder for orportsIan Jackson2022-05-041-12/+16
| | | | | | | And drop the ad-hoc orport() method. This brings FallbackDir's orports field in line with our list builder API. The general semver note in "configuation" seems to cover most of this.
* DirPathBuilder::pick_path: re-order match cases for clarity.Nick Mathewson2022-03-301-16/+18
|
* circmgr: Use guard-manager's view of the fallbacks when possible.Nick Mathewson2022-03-301-10/+30
| | | | | | | | | | | | | | | | | | If we're building a path with the guard manager involved, we now ask the guard manager to pick our first hop no matter what. We only pick from the fallback list ourselves if we're using the API with no guard manager. This causes some follow-on changes where we have to remember an OwnedChanTarget object in a TorPath we've built, and where we gain the ability to say we're building a path "from nothing extra at all." Those are all internal to the crate, though. Closes #220, by making sure that we use our guards to get a fresh netdir (if we can) before falling back to any fallbacks, even if our consensus is old. Compilation should be fixed in the next commit.
* Turn FallbackList into a real type, and store one in GuardMgr.Nick Mathewson2022-03-301-13/+11
| | | | | | | | | | | | | | The guard manager is responsible for handing out the first hops of tor circuits, keeping track of their successes and failures, and remembering their states. Given that, it makes sense to store this information here. It is not yet used; I'll be fixing that in upcoming commits. Arguably, this information no longer belongs in the directory manager: I've added a todo about moving it. This commit will break compilation on its own in a couple of places; subsequent commits will fix it up.
* Move fallback.rs into guardmgr.Nick Mathewson2022-03-301-1/+1
| | | | | | | This is the logical place for it, I think: the GuardMgr's job is to pick the first hop for a circuit depending on remembered status for possible first hops. Making this change will let us streamline the code that interacts with these objects.
* circmgr: Change API for using FallbackDirsNick Mathewson2022-03-211-2/+3
| | | | | | It'll soon more convenient to pass in FallbackDirs as a slice of references, rather than just a slice of FallbackDirs: I'm going to be changing how we handle these in tor-dirmgr.
* Add kinds for *most* circmgr errors.Nick Mathewson2022-02-161-2/+2
| | | | There are a couple of tricky ones I'll do separately.
* add semicolons if nothing returnedDaniel Eades2021-11-251-1/+1
|
* Allow clone-on-copy in tor-circmgr tests to fix a nightly-only clippy warning.Nick Mathewson2021-11-021-0/+1
|
* tor-circmgr: test DirPathBuilder with GuardMgr.Nick Mathewson2021-11-021-0/+40
|
* Implement guards for multihop paths.Nick Mathewson2021-10-131-0/+1
| | | | There are some limitations here, as noted in the comments.
* Actually select guards for directory circuits.Nick Mathewson2021-10-131-10/+19
|
* Pass the guard manager down to the path selection functions.Nick Mathewson2021-10-111-5/+14
|
* WIPNick Mathewson2021-10-111-5/+7
|
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-0/+1
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+121
This will cause some pain for now, but now is really the best time to do this kind of thing.