summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* circmgr: drop a receiver more explicitly.Nick Mathewson2023-01-271-1/+4
| | | | | | | | | Clippy now complains about `let _ = (expr_producing_a_future);`, which is probably smart, since maybe you wanted to await that future and ignore the result. So it seems that the right way to get rid of an unwanted Receiver is now to drop it explicitly. Closes #749
* 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.
* Disable clippy::unlinlined-format-argsNick Mathewson2023-01-271-0/+1
| | | | | | | | This warning kind of snuck up on us! (See #748) For now, let's disable it. (I've cleaned it up in a couple of examples, since those are meant to be more idiomatic and user-facing.) Closes #748.
* CircMgr: Draft API to construct targeted multihop circuits.Nick Mathewson2023-01-241-1/+24
| | | | | Onion services and onion clients need these to make connections to HsDirs, Introduction points, and Rendezvous points.
* CircMgr: Draft APIs used to implement onion service clients.Nick Mathewson2023-01-241-0/+46
|
* Merge branch 'test-lints' into 'main'eta2023-01-061-0/+8
|\ | | | | | | | | Add test lint blocks to all "mod test" See merge request tpo/core/arti!937
| * test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+8
| | | | | | | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* | tor-circmgr: Use ErrorReport on a logged errorIan Jackson2022-12-121-1/+2
|/ | | | To demonstrate what the use looks like.
* Improve notes surrounding circuit cancellation.Nick Mathewson2022-11-221-1/+0
| | | | | | | It turns out that bug #656 is not a real bug, but it was easy to overlook the code that prevented it. Closes #656.
* CircMgr: retire all circuits if bridge configuration changes.Nick Mathewson2022-11-221-5/+9
| | | | Closes #650.
* CircMgr: Refactor DirSpecificTarget constructorNick Mathewson2022-11-181-3/+3
| | | | | | | | | | | | This commit replaces the `impl From<&T> for OwnedChanTarget where T:ChanTarget` with a new `IntoOwnedChanTarget` trait. This lets us be explicit that we're constructing an owned object, and not just converting something. No semver change needed, since these APIs haven't been released. ----------- (new description)
* Move GuardMgr::new call to arti_client::TorClientIan Jackson2022-11-141-1/+1
| | | | | | | Having this done within circmgr was irregular - most of our other key buildup functions are done in TorClient::create_inner. It is also inconvenient, as it buries the guardmgr within the circmgr.
* Document Clone semantics of GuardMgr and DirMgrIan Jackson2022-11-111-0/+2
|
* Refactor external guardmgr APIs: Stop taking NetDir arguments.Nick Mathewson2022-11-081-12/+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-10/+3
| | | | | It doesn't seem to me like it makes sense to provide the backward compatibility here.
* guardmgr config: Pass fallback list from config by referenceIan Jackson2022-11-031-1/+1
| | | | | This does involve additional cloning. However, soon it will mean that we can pass the whole `TorClientConfig` by reference.
* Run add_warnings.Nick Mathewson2022-11-031-0/+1
|
* tor-circmgr: Make get_or_launch_dir_specific feature-specificIan Jackson2022-10-211-1/+6
|
* tor-circmgr: Rename get_or_launch_dir_specific from _bridgeIan Jackson2022-10-211-1/+1
| | | | | DirSpecificTarget in the usage was renamed apropos an MR comment but this function name was overlooked.
* circmgr: Plumbing for direct to target directory circuitsIan Jackson2022-10-201-1/+16
| | | | | The target is identified by Into<OwnedChanTarget>. We introduce corresponding TargetCircUsage and SupportedCircUsage.
* cargo fmt to remove blank linesIan Jackson2022-10-121-1/+0
| | | | | | | Apparently cargo fmt doesn't like these, which my perl rune didn't delete. This commit is precisely the result of `cargo fmt`.
* Replace all README copies in src/lib.rs with includesIan Jackson2022-10-121-21/+1
| | | | | | | | The feature we want is `#[doc = include_str!("README.md")]`, which is stable since 1.54 and our MSRV is now 1.56. This commit is precisely the result of the following Perl rune: perl -i~ -0777 -pe 's{(^//!(?!.*\@\@).*\n)+}{#![doc = include_str!("../README.md")]\n}m' crates/*/src/lib.rs
* CircMgr: Add an accessor for the CircuitBuilder.Nick Mathewson2022-09-221-0/+8
| | | | | | | Without this, actually building circuits manually is a pain. This API is behind the `experimental-api` feature, and so it does not require a semver.md entry.
* circmgr: treat usage as sensitive.Nick Mathewson2022-08-251-1/+6
|
* enable doc_auto_cfg feature on every crate when documenting for docs.rstrinity-1686a2022-08-241-0/+1
|
* guardmgr: Change APIs that used to take IDs.Nick Mathewson2022-08-021-10/+8
| | | | These are the other inspiration for #428.
* CircMgr: Update to new NetDirProvider APINick Mathewson2022-07-261-8/+7
| | | | | Everything here wants a timely directory, except that it is okay to build timeout-testing circuits with a stale one.
* Run maint/add_warning crates/*/src/{lib,main}.rsIan Jackson2022-06-231-0/+3
| | | | Update all lint blocks
* CircMgr: Enable reachable_addrs filter.Nick Mathewson2022-06-171-0/+7
|
* Move responsibility for GuardMgr NetDir updates to GuardMgr.Nick Mathewson2022-06-071-32/+24
| | | | | | | | | | | Previously it was the job of a task in CircMgr to do this; but we're going to want to give GuardMgr full access to the latest NetDir for this, and for other code-simplification reasons. With this change I'm deprecating a couple of functions in tor-circmgr. It's no longer necessary for us to have an artificial external way for you to feed new NetDirs to a circmgr. (I could just remove them, but I want practice deprecating.)
* Remove now-redundant Send+Sync constraints alongside NetDirProviderNick Mathewson2022-06-071-4/+4
|
* lints: Add let_unit_value allow to all cratesIan Jackson2022-05-311-0/+1
| | | | | From running add_warning, with manual picking of the right hunks/lines.
* lints: Add lint block delimiters to every crateIan Jackson2022-05-311-0/+2
| | | | | | This was the result of: maint/add_warning crates/*/src/{lib,main}.rs and then manually curating the results.
* squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-251-1/+0
| | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* fix typo in doctrinity-1686a2022-04-251-1/+1
|
* Merge branch 'report-skew' into 'main'eta2022-04-131-0/+12
|\ | | | | | | | | Report skew estimates from arti-client See merge request tpo/core/arti!455
| * circmgr: re-export clock skew estimates.Nick Mathewson2022-04-121-0/+12
| |
* | circmgr: back off on preemptive circuits if they fail consistentlyNick Mathewson2022-04-121-8/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | Rather than running preemptive circuit construction every 10 seconds, we change it to back off when it is "failing". (We define "failing" as creating no new circuits, and as giving at least one error.) This change means that we'll have one less reason to hammer the network when our connectivity is failed for some reason. Closes #437. Part of #329.
* | circmgr: Remove now-unused scheduled entry points.Nick Mathewson2022-04-121-18/+8
| | | | | | | | | | Now that we have TaskSchedule, we don't need to expose these any longer.
* | circmgr: Report CircProvenance from AbstractCircMgr.Nick Mathewson2022-04-121-2/+2
|/ | | | | | | This feature is similar to ChanProvenance from ChanMgr, except that we don't yet need to report it outside the crate. I'm going to use it to distinguish newly created circuits from existing circuits in the preemptive circuit builder.
* Run cargo fmt one more time for good measure.Nick Mathewson2022-03-301-2/+2
|
* Refactor FirstHopId into type-differentiated formNick Mathewson2022-03-301-10/+22
| | | | | | | | | | | The FirstHopId type now records an enum that stores whether the hop is a guard or a fallback. This change addresses concerns about remembering to check the type or source of an Id before passing it down to the FallbackState or GuardSet. Making this change required an API change, so that dirmgr can report success/failure status without actually knowing whether it's using a fallback or a guard.
* Rename Guard=>FirstHop, GuardId=>FirstHopIdNick Mathewson2022-03-301-3/+3
| | | | | This is preparation for having separate GuardId and FirstHopId types that distinguish which back-end they index.
* Rename ExternalFailure => ExternalActivity.Nick Mathewson2022-03-301-3/+3
|
* Replace the fallback directories when they change in the config.Nick Mathewson2022-03-301-0/+5
| | | | | | The code here uses a new iterator type, since I couldn't find one of these on crates.io. I tried writing the code without it, but it was harder to follow and test.
* Add status tracking to FallbackDir.Nick Mathewson2022-03-301-0/+9
| | | | | | | | | | | We do this by creating a new FallbackSet type that includes status information, and updating the GuardMgr APIs to record success and failure about it when appropriate. We can use this to mark FallbackDirs retriable (or not). With this change, FallbackDir is now stored internally as a Guard in the GuardMgr crate. That's fine: the FallbackDir type really only matters for configuration.
* circmgr: Use guard-manager's view of the fallbacks when possible.Nick Mathewson2022-03-301-1/+4
| | | | | | | | | | | | | | | | | | 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-7/+12
| | | | | | | | | | | | | | 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/+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.
* Make daemon tasks self-contained; introduce NetDirProvidereta2022-03-301-3/+251
| | | | | | | | | | | | | | | The various background daemon tasks that `arti-client` used to spawn are now handled inside their respective crates instead, with functions provided to spawn them that return `TaskHandle`s. This required introducing a new trait, `NetDirProvider`, which steals some functionality from the `DirProvider` trait to enable `tor-circmgr` to depend on it (`tor-circmgr` is a dependency of `tor-dirmgr`, so it can't depend on `DirProvider` directly). While we're at it, we also make some of the tasks wait for events from the `NetDirProvider` instead of sleeping, slightly increasing efficiency.