Commit Graph

3755 Commits

Author SHA1 Message Date
Nick Mathewson 0cd05e1793 Implement From<tor_proto::Error> for std::io::Error 2021-03-10 09:08:53 -05:00
Nick Mathewson 8ef6919a07 Move RawCellStream into its own module. 2021-03-10 09:07:52 -05:00
Nick Mathewson 2a93266b7b Rename TorStream => RawCellStream 2021-03-10 08:34:54 -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 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 fb4f3d0029 Avoid unwrap() in llcrypto. 2021-03-04 14:32:07 -05:00
Nick Mathewson d7c1d4166a Avoid unwrap() in dirmgr. 2021-03-04 14:31:28 -05:00
Nick Mathewson 29311b72f6 Remove an unwrap in dirclient. 2021-03-04 14:20:54 -05:00
Nick Mathewson 57682f5ec1 Move content-encoding handling to decompress
This way tor-dirclient doesn't need to link to the compression crates.
2021-03-04 13:59:12 -05:00
Nick Mathewson a444f6c3dc Add tor-decompress to top-level Cargo.toml 2021-03-04 13:31:48 -05:00
Nick Mathewson a2ac0f724e Merge remote-tracking branch 'origin/mr/18' into main 2021-03-04 13:30:46 -05:00
Nick Mathewson 8bbf093e34 Avoid unwrap() in dirmgr 2021-03-04 13:24:00 -05:00
Nick Mathewson 9b97197762 Avoid unwrap() in tor-consdiff. 2021-03-04 12:59:15 -05:00
Nick Mathewson 59bfa4d517 Avoid unwrap() in tor-config 2021-03-04 12:51:11 -05:00
Nick Mathewson 95c71aff91 clippy warning on msg.rs 2021-03-04 11:54:14 -05:00
Nick Mathewson 2f81e8dd34 Remove use of unwrap() in tor-client. 2021-03-04 11:37:14 -05:00
Nick Mathewson b87b3e978b Use expect() instead of unwrap() in tor-circmgr 2021-03-04 11:33:29 -05:00
Kushal Das bfb652e73d
Moves decompress related code into tor-decompress crate
The related data structures are marked as public in the
tor-decompress crate so that tor-dirclient can access them.
2021-03-04 22:01:42 +05:30
Nick Mathewson 7feab6d85d tor-cert: use expect() instead of unwrap() 2021-03-04 11:23:13 -05:00
Nick Mathewson 564bf104d5 Change how we sort link specifiers in extend cells
Instead of implementing a dubious PartialOrd for link spec, add a
sorting function and call that explicitly.
2021-03-04 11:13:22 -05:00
Nick Mathewson 2c8a6de8ac Avoid an is_some()/unwrap() pair in End cell parsing 2021-03-04 11:12:35 -05:00
Nick Mathewson 541883f3df Missing doc for private member 2021-03-02 14:08:04 -05:00
Nick Mathewson 0cfff7e0e4 CI target to build with async-std. Running tests is harder, alas 2021-03-02 12:21:38 -05:00
Nick Mathewson 572e2b93de Update docs wrt tokio a bit 2021-03-02 12:12:41 -05:00
Nick Mathewson bbfbdec733 Make a few async_test tests work correctly again.
For these, we need to call tor_rtcompat::task::block_on() directly,
since they would crash with tokio enabled.  Perhaps down the line we
should look for a better fix here.
2021-03-02 11:59:52 -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 b33bc268d5 My rustfmt is up-to-date with the gitlab ci one again 2021-03-01 07:42:45 -05:00
Nick Mathewson 66c901265d Disable our cargo fmt test on CI for now. 2021-02-26 09:59:23 -05:00
Nick Mathewson a1c4d5a110 Merge remote-tracking branch 'origin/mr/16' into main 2021-02-26 08:16:10 -05:00
George Kadianakis 8e97237cd1 Refactor StreamMap methods to use HashMap::Entry 2021-02-26 14:16:35 +02: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 9f473b2bbf run cargo fix --edition-idioms 2021-02-25 09:06:42 -05:00
Nick Mathewson 7a5cfa4010 Use futures::join!() to simplify test_create(). 2021-02-23 16:47:50 -05:00
Nick Mathewson 568567c5e0 Update to latest futures, once_cell 2021-02-23 15:54:29 -05:00
Nick Mathewson 09e60de858 Fix an intermittent test failure on int overflow. 2021-02-19 09:42:05 -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 bd6625174e tor-dirmgr: simplify config.rs a bit. 2021-02-16 13:37:20 -05:00
Nick Mathewson ddf994acc5 Add support to override network parameters in the configuration. 2021-02-16 13:29:46 -05:00
Nick Mathewson c9b9286fa9 Add some tests for tor_config::CfgPath 2021-02-12 13:13:57 -05:00
Nick Mathewson 94901ec355 Apply "deny_unknown_fields" to configuration types. 2021-02-12 11:26:00 -05:00
Nick Mathewson 209d1df242 Remove fallback to .arti/cache for cache directory 2021-02-12 10:59:06 -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
Nick Mathewson 32c857f71a Add comments to default config files 2021-02-11 14:09:39 -05:00