Commit Graph

40 Commits

Author SHA1 Message Date
Nick Mathewson bd355d14f3 tor-circmgr: Improve coverage on build.rs.
The good news is that this tests the succeeding and failing cases,
and even managed to expose an off-by-one error in our hop counting.

The bad news is that these tests have shown even more ways in which
our wait_for code is unreliable, and forced me to slow it down even
harder.
2021-07-19 14:30:42 -04:00
Nick Mathewson cd51d8bb8b Implement a circuit timeout estimator backend.
This backend uses the kludged-up^W heuristic-enhanced Pareto
estimator from path-spec.txt section 2.4.  See path-spec.txt for
full details on the algorithm.  I've tried to note with TODO-SPEC
comments all the things that the spec currently leaves out.

Nothing actually uses this code yet.  By the time it's in use, I'd
expect that many of these functions will need to have new
visibilities.
2021-07-19 12:25:26 -04:00
Nick Mathewson b0167eec44 Allow tor-rtcompat to build with no runtimes.
Thanks to cargo's version-2 feature resolver, we can require a
runtime for tests only.

I'm also making it so that the functions that create or fetch
Runtimes only exist when one of the runtime features is enabled.
For now that seems like a better solution than having those
functions exist but panic.

Closes #129.
2021-07-01 09:47:55 -04:00
Nick Mathewson 8947e54d7e Remove "default-features=false" thing on tor-rtcompat for now. 2021-06-24 10:53:11 -04:00
Nick Mathewson 2df9b0e921 Bump version dependencies to 0.0.0 2021-06-24 09:27:17 -04:00
Nick Mathewson b774360755 Remove "publish = false" 2021-06-24 07:04:26 -04:00
Nick Mathewson be86df631d Remove anyhow dependency from tor-retry, and rename it to retry-error
Now RetryError is parameterized on an underlying error type.
2021-06-17 16:09:43 -04:00
Nick Mathewson 9310273448 Remove some (but not all) needless dependencies. 2021-06-17 09:09:43 -04:00
Nick Mathewson d3f27716d9 Tests for circmgr::usage 2021-06-16 11:36:50 -04:00
Nick Mathewson 66fad93f31 More tests in tor-cirmgr::mgr 2021-06-16 09:16:54 -04:00
Nick Mathewson 83b1150c81 Enormous tor-circmgr rewrite.
As with the tor-chanmgr code, the circuit manager is now implemented
using an AbstractCircMgr type that uses traits to abstract the
particular behavior of other types that it uses.  (Specifically:
circuits, building circuits, and telling whether one circuit usage
is compatible with another.)  Abstracting out the dependencies in
this ways makes it possible to test the circuit manager without
having to actually build real circuits.

This commit also introduces new behavior for handling pending
circuit requests.  Upon getting a new request, first we check to see
if there's an existing circuit we can use.  If there isn't, we look
for pending circuits and wait for them.  If there aren't any pending
circuits we can use, we launch one or more, and wait for them.

So far, that's the same as the old behavior.  But here's a change:
if, while we are waiting for some pending circuits, a different
circuit is completed, and it's one we could use, then the task that
was building _that_ circuit will tell us: "please look at this
circuit".  This gives us better changes of getting a usable circuit
fast.

Minor changes:

* The Error type in CircMgr no longer uses anyhow; several errors
  have been simplified.

* We've gotten more formal about the relationship between circuit
  usage and target usage.
2021-06-14 12:12:31 -04:00
Nick Mathewson e8214d1df1 Use macros and types to improve handling of Netdir parameters.
(Squashed from typed-netdir-params)
2021-05-25 09:16:59 -04:00
Nick Mathewson ce6702a147 Give every Cargo.toml a repository field 2021-05-19 14:56:09 -04:00
Nick Mathewson 712e6ec23c Fill in "package.categories" on all Cargo.toml 2021-05-19 14:50:39 -04:00
David Goulet 48cbae0bc7 circmgr: Add a function to build a circuit by path
Public function so an application can use to build a circuit using a
custom path.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-04-07 08:36:07 -04:00
Nick Mathewson 603b0436e0 Add a compatibility layer so we can upgrade rand_core.
dalek-crypto is stuck on rand_core 0.5.1, so we've been stuck too.
This commit introduces a compatibility module so that we can wrap
new rand_core instances to make them backward compatible.
2021-03-18 13:16:32 -04:00
Nick Mathewson 6daf57957d Add the tor project as an author. 2021-03-17 14:43:40 -04:00
Nick Mathewson ba14d43be4 Add keywords to each Cargo.toml 2021-03-17 14:41:02 -04:00
Nick Mathewson c8481a9354 Add a description field to all our Cargo.toml files 2021-03-17 14:31:59 -04:00
Nick Mathewson 58d8472ea0 Give it a homepage everyplace. 2021-03-17 14:13:26 -04:00
Nick Mathewson 695268019e upgrade async-trait 2021-03-09 09:43:00 -05:00
Nick Mathewson 302653977d Bump dependencies with "cargo upgrade" 2021-03-06 08:55:13 -05:00
Nick Mathewson 8c31418500 Port to work with tokio or async-std.
This is fairly ugly and I think I'll need to mess around with the
feature configuration a while until we get something that's pleasant
to develop with.  This still seems like a good idea, though, since
we _will_ need to be executor-agnostic in the end, or we'll have no
way to handle wasm or embedded environments.

Later down the road, we'll probably want to use futures::Executor or
futures::Spawn more than having global entry points in
tor_rtcompat.  That would probably make our feature story simpler.

Tokio is the default now, since tokio seems to be more heavily used
for performance-critical stuff.

This patch breaks tests; the next one will fix them, albeit
questionably.
2021-03-02 11:55:09 -05:00
Nick Mathewson 568567c5e0 Update to latest futures, once_cell 2021-02-23 15:54:29 -05:00
Nick Mathewson ab9d4a2229 Update some dependencies. 2021-02-19 09:39:23 -05:00
Nick Mathewson 243880473f bump serde and log 2021-02-01 16:39:07 -05:00
Nick Mathewson 3f455e6f30 require latest futures crate 2021-01-15 17:05:05 -05:00
Nick Mathewson fa57fb4995 Upgrade a few more dependencies. 2021-01-13 08:17:14 -05:00
Nick Mathewson 7e843de2c8 Upgrade a few dependencies. 2021-01-13 08:14:28 -05:00
Nick Mathewson f01d641ec8 cargo upgrade. 2020-12-30 15:59:33 -05:00
Nick Mathewson ccd6cbf627 upgrade to latest anyhow 2020-12-21 10:21:24 -05:00
Nick Mathewson 20751f9993 Give more information if we fail to create a pending circuit. 2020-12-14 14:18:36 -05:00
Nick Mathewson 17c84fd59e upgrade to require latest anyhow. 2020-12-08 17:26:19 -05:00
Nick Mathewson e18b4e07cb Upgrade a couple of dependencies 2020-11-28 14:17:42 -05:00
Nick Mathewson 59e4b5631a Isolate async_std usage in a new tor_rtcompat crate.
Like tor_llcrypto, this crate is meant to expose only the part of
other crates (in this case, a async runtime crate) that we use.
2020-11-11 13:46:39 -05:00
Nick Mathewson dc301094fd Use anyhow in tor-circmgr and tor-chanmgr 2020-11-11 10:23:29 -05:00
Nick Mathewson af16ec18a3 update some dependencies 2020-11-11 09:14:26 -05:00
Nick Mathewson 4d24fff9c0 Upgrade dependencies 2020-11-10 12:27:10 -05:00
Nick Mathewson 9c7ed1fdde upgrade a few packages. 2020-11-05 16:56:29 -05:00
Nick Mathewson d9dafa0a28 Add a new circuit-manager crate and move path selection there. 2020-11-02 10:44:31 -05:00