summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/path.rs
Commit message (Collapse)AuthorAgeFilesLines
* Remove temporary functions in CheckedRelay.Nick Mathewson2024-03-281-2/+3
|
* tor-circmgr: Make the path module crate-private.Gabriela Moldovan2024-03-201-3/+11
| | | | | | | | | | | | | | 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: Remove unnecessary AnonymousPathBuilder impl.Gabriela Moldovan2024-03-201-6/+15
| | | | | | | | Instead of the `B: AnonymousPathBuilder` argument, `select_guard` now takes separate arguments for the values it previously obtained by calling the methods of `AnonymousPathBuilder`. This enables us to remove the mostly unnecessary `AnonymousPathBuilder` implementation of `VanguardHsPathBuilder`.
* tor-circmgr: Extract guard selection to a separate function.Gabriela Moldovan2024-03-201-43/+58
| | | | | We're about to reuse this in the path selection with vanguards implementation.
* tor-circmgr: Impl From<Vanguard> for MaybeOwnedRelay.Gabriela Moldovan2024-03-201-0/+10
| | | | | We will soon need this in `HsPathBuilder` (for building `TorPath`s that consist of vanguards).
* tor-circmgr: Remove unused lifetime.Gabriela Moldovan2024-03-201-1/+1
|
* tor-circmgr: Move pick_path out of AnonymousCircuitBuilder.Gabriela Moldovan2024-03-141-137/+135
| | | | This enables us to make `AnonymousCircuitBuilder` private.
* tor-circmgr: Add a new hspath module for building onion service circuits.Gabriela Moldovan2024-03-141-0/+2
|
* tor-circmgr: Add AnonymousPathBuilder trait.Gabriela Moldovan2024-03-141-4/+177
| | | | | | | | | | The `pick_path()` default implementation is an almost verbatim copy of `ExitPathBuilder::pick_path()`. The only difference is that instead of using values from `self`, the `AnonymousPathBuilder::pick_path()` uses the values returned by the different `AnonymousPathBuilder` functions (i.e., `AnonymousPathBuilder::pick_exit()` instead of `self.pick_exit()`, `AnonymousPathBuilder::compatible_with()` instead of `self.compatible_with`, etc.).
* Fix typos in doc commentsTobias Stoeckmann2024-03-061-1/+1
|
* Teach *CircUsage structs about stability.Nick Mathewson2024-02-201-0/+15
| | | | | | | | | | | 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.
* arti-client: add exit selection with GeoIP country codeseta2023-09-181-0/+13
| | | | | | | | | | | | | | | | | | | | 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
* remove unused type parametertrinity-1686a2023-03-181-1/+1
|
* circmgr: downgrade TODO pt-client commentsNick Mathewson2022-11-081-3/+3
| | | | These are structure-internal things we can solve later, if ever.
* circmgr: More NOTEs and TODO pt-clients.Nick Mathewson2022-10-241-3/+9
|
* Circmgr: construct paths using either Relay or OwnedCircTargetNick Mathewson2022-10-241-10/+77
| | | | | | | | | | | 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.
* Introduce HasRelayIds::same_relay_ids.Nick Mathewson2022-08-021-3/+3
| | | | | 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.
* squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-251-3/+0
| | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* circmgr: Use guard-manager's view of the fallbacks when possible.Nick Mathewson2022-03-301-0/+12
| | | | | | | | | | | | | | | | | | 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.
* Move fallback.rs into guardmgr.Nick Mathewson2022-03-301-1/+2
| | | | | | | 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.
* impl Debug for various internal typesIan Jackson2022-02-251-1/+1
| | | | | | | | I wanted this while debugging something. The ad-hoc impl Debug with f.debug_struct is getting repetitive and I've already perpetrated one copy-paste mistake. We should consider using something like the `educe` crate's Clone.
* Add kinds for *most* circmgr errors.Nick Mathewson2022-02-161-2/+3
| | | | There are a couple of tricky ones I'll do separately.
* add semicolons if nothing returnedDaniel Eades2021-11-251-1/+1
|
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-0/+1
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+152
This will cause some pain for now, but now is really the best time to do this kind of thing.