Commit Graph

60 Commits

Author SHA1 Message Date
Nick Mathewson 80535dda01 Check "connection" usage for when stream or channel would be better. 2021-05-18 11:17:28 -04:00
Nick Mathewson 6bf7cbb3f4 Remove tor-proto exposure in tor-client API. 2021-05-18 10:08:29 -04:00
Nick Mathewson f69a68df66 Rename NetDirConfig to DirMgrConfig. 2021-05-14 10:27:01 -04:00
Nick Mathewson 8eb36cbfff Add trait_duplication_in_bounds warning. 2021-05-03 16:30:27 -04:00
Nick Mathewson d516298b47 Add unseparated_literal_suffix lint, and fix it. 2021-05-03 16:19:01 -04:00
Nick Mathewson 9737580402 Add a few more clippy warnings 2021-05-03 16:10:39 -04:00
David Goulet 9c96a0bb3d Fix experimental-api feature after refactoring
Important refactoring happened recently which broke the
"experimental-api" feature.

Fixes are quite simple.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-05-03 09:48:34 -04:00
Nick Mathewson 94c93c9121 Add some more clippy warnings to our list. 2021-04-27 14:51:04 -04:00
Nick Mathewson 2e3780affb Enforce (and obey) clippy lints about exhaustive enums, structs.
These lints force us to declare our exported enums and
exhaustive-looking structs as non-exhaustive (so that we can add to
them in the future without breaking our API) or to explicitly
disable the warning for a given enum/struct (to say that we _intend_
for additions to be a breaking change).
2021-04-27 14:17:49 -04:00
Nick Mathewson 12c45882f0 Refactor and simplify ChanMgr to use AbstractChanMgr. 2021-04-23 12:57:45 -04:00
Nick Mathewson 92de7c58f0 Move timer functions into an extension trait. 2021-04-17 09:37:46 -04:00
Nick Mathewson 6878fe8336 Move around the public modules in tor_rtcompat. 2021-04-17 09:21:09 -04:00
Nick Mathewson 1d07132787 Remove all non-runtime methods in tor_rtcompat. 2021-04-16 17:15:55 -04:00
Nick Mathewson 8532cef9aa Add a "Runtime" parameter to all the manager types.
This is a big change, but it is a step towards our goal of removing
tor_rtcompat:: calls directly.
2021-04-16 16:12:08 -04:00
Nick Mathewson ebcfd38b48 rtcompat: Make TLS functionality use Runtime traits.
Now there is nothing in principle that you couldn't access from a
Runtime implementation.
2021-04-16 15:44:36 -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 6cc8e5e028 Remove a few unused dependencies 2021-04-05 08:20:06 -04:00
Nick Mathewson 98c0ef3dd5 DirMgr::netdir() is no longer async
Since we moved to a non-async mutex(*), we no longer need to worry that
this function might need to suspend.

(*) This is _not_ safe in general, but it's okay in this case, since
we never suspend while holding that mutex: see shared_ref.rs.
2021-04-02 14:08:07 -04:00
Nick Mathewson 75bfdea21e Client: Add a function to expose the current dirmgr.
This function sits behind an `experimental-api` feature so that we
don't need to worry about exposing the entire surface of DirMgr to
our API consumers.

This and the other recent patches are based on work from dgoulet.
2021-03-30 13:16:56 -04:00
Nick Mathewson 3ad503866d Fix Rust-1.51 clippy warnings about acronyms in camel case.
This is painful, but we shouldn't have to do it again.
2021-03-29 16:33:48 -04:00
Nick Mathewson 3833ca2665 Move stream timeout logic into tor-client.
This is consistent with the other pieces of tor-proto, which do not
handle timeouts on their own.  It also lets us remove tor-rtcompat
as a dependency from tor-proto, and simplify some of the test cases
to use async_test.

This commit unindents a lot of test code; use git's "-b" flag to
read the parts that matter.
2021-03-24 11:14:07 -04:00
Nick Mathewson 06d5988cdc upgrade to newer version of config crate. 2021-03-24 09:44:31 -04:00
Nick Mathewson d073f24138 Move responsibility for knowing about TLS into tor_rtcompat.
Now we don't need runtime-specific stuff in tor-chanmgr.
2021-03-23 15:59:39 -04:00
Nick Mathewson 68f18d4fe3 Refactor tokio implpementation in tor-rtcompat.
Now other crates don't need any 'ifdef tokio' code, since there
are wrappers that implement 'futures' right.

Technically, the 'futures' traits are in some ways less good than
the tokio ones, but we need a consistent API if we want to support
WASM someday and keep support for async_std.  I'd rather hold out
hope for a future version of futures::io working like tokio than to
fix ourselves into the tokioverse forever.
2021-03-23 11:00:09 -04:00
Nick Mathewson c2db961424 Move our command-line interface into a new crate called "arti".
Closes #106
2021-03-17 15:14:32 -04:00
Nick Mathewson a4e0dde4da Add appropriate categories to some Cargo.toml files. 2021-03-17 14:51:18 -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 4818d57ed7 Bump a couple of deps 2021-03-13 17:25:05 -05:00
Nick Mathewson e2ed031dfe Improve implementation of copy_interactive
Previously we'd flush after every write.  Now we only flush when the
reader has nothing more to tell us.  This way we can be sure that we're
sending out the data as soon as we can, without leaving any cells
partially filled unnecessarily.
2021-03-12 13:15:52 -05:00
Nick Mathewson 9d07f4160f Only enable the `config` features we are using.
This saves us from a lot of extra backends, including an entire
extra version of serde (!).
2021-03-10 15:46:06 -05:00
Nick Mathewson a8b158b2a6 Use AsyncRead and AsyncWrite in our proxy implementation 2021-03-10 14:16:50 -05:00
Nick Mathewson 29050c2555 Refactor DataStream constituents a bit.
These new (internal so far) APIs correspond more closely to what
we'll need for AsyncRead and AsyncWrite.

We also make write methods take a mutable reference to self, since
that seems to be (closer to) what the AsyncRead/AsyncWrite code
expects.
2021-03-09 13:11:59 -05:00
Nick Mathewson 302653977d Bump dependencies with "cargo upgrade" 2021-03-06 08:55:13 -05:00
Nick Mathewson 2f81e8dd34 Remove use of unwrap() in tor-client. 2021-03-04 11:37:14 -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 b8956b6bd8 Move .onion check into TorClient. 2021-02-25 15:01:54 -05:00
Nick Mathewson cf474e17ec Clean-ups for documentations and lints in tor-client 2021-02-25 14:55:48 -05:00
Nick Mathewson 5da9186d31 Use a ConnectPref type for TorClient::connect, simplify APIs a bit, doc some. 2021-02-25 14:47:43 -05:00
Nick Mathewson 920e5036cb Restore code in proxy.rs so that socks timeout errors work again
This isn't pretty, since it now has to use anyhow::downcast_ref().
I've noted a TODO about maybe not using anyhow::Error for this case.
2021-02-25 13:54:05 -05:00
Nick Mathewson 7133b9900b Start refactoring the tor-client crate.
This commit splits the proxy and client code into a proper module,
and keeps a stripped down version of the main.rs file.
2021-02-25 13:49:04 -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 afdcd69e03 Make first-level directory retry logic configurable. 2021-02-17 11:55:39 -05:00
Nick Mathewson d8d2c0f79c Make our initial bootstrap retry schedule configurarable 2021-02-17 11:25:57 -05:00
Nick Mathewson ddf994acc5 Add support to override network parameters in the configuration. 2021-02-16 13:29:46 -05:00
Nick Mathewson 94901ec355 Apply "deny_unknown_fields" to configuration types. 2021-02-12 11:26:00 -05:00
Nick Mathewson d8c1e7f0cf Implement storage-directory configuration.
This affects the cache_dir and the as-yet-unused state_dir.  It uses
the shellexpand and directories crates so that the default values
can be constant strings that use variables to refer to the right
default locations.
2021-02-12 10:54:24 -05:00