Commit Graph

94 Commits

Author SHA1 Message Date
Nick Mathewson 90e96b32c8 Prefer "relay" to "server" when appropriate. 2021-05-18 10:34:15 -04:00
Nick Mathewson e01f227191 Resolve clippy warnings from Rust 1.52.
Rust 1.52 just came out, and there are new clippy lints to deal
with:

   * It spots more cases when we could use Option::map
   * It spots more cases when we could use Iterator::flatten
   * When we build a struct instance, it wants us to list the fields
     in the same order that the struct declares them.
2021-05-07 15:53:17 -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
Nick Mathewson b254158354 Bump regex and memchr versions 2021-05-03 09:19:19 -04:00
Nick Mathewson 615e2ed31a Split mocking parts of rtcompat into new rtmock crate.
Since these parts are testing-only, let's take steps to make sure we
don't ship them in production by accident.
2021-05-03 09:10:33 -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 adefe60f60 upgrade httparse and zeroize 2021-04-25 12:39:35 -04:00
Nick Mathewson 951ea280c8 Only list the supported encodings in the `Accept-Encoding` header
Closes #113
2021-04-21 10:04:22 -04:00
Nick Mathewson 03f25bd2bc Use stream_pair() to write a test for tor_dirclient::download 2021-04-21 09:04:27 -04:00
Nick Mathewson b00ff9f110 Make zstd and xz compression optional, but on-by-default. 2021-04-21 08:37:53 -04:00
Nick Mathewson 572565bce2 Test for tor_dirclient::read_headers 2021-04-20 14:52:58 -04:00
Nick Mathewson 68ce1da4b0 Tests for tor_dirclient::read_and_decompress 2021-04-20 14:33:09 -04:00
Nick Mathewson 8007d719d9 Test for tor_dirclient::read_until_limited() 2021-04-20 13:51:47 -04:00
Nick Mathewson 50978dc7d2 tor-dirclient: more requests.rs tests 2021-04-20 13:32:20 -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 13d4ee888f Replace tor-decompress with async-compression crate.
This lets us simplify tor-dirclient a fair bit.  Closes #79.
2021-04-13 16:27:52 -04:00
Nick Mathewson edbd54f2fd tor-dirclient: Use AsyncBufRead to simplify code a bit.
Previously we read too much data from our input, and then used the
unused portion as an initial state of a buffer for handling
subsequent data.  Yuck!  Instead we can just use an AsyncBufRead and
only read the parts we want.

This code takes some pains to never read too much data: I'd rather
just "read until the first CRLF" or have some kind of pushback
mechanism.  But for now it's probably fine.
2021-04-13 15:45:27 -04:00
Nick Mathewson bec5fa3e9c Major revision on DirMgr logic -- almost a complete rewrite.
The big idea of this revision is to separate the code that knows
about doing downloads from the code that decides what to download.
Later, we can make a similar change for database access.  With these
changes together, we can make our code much more testable, and
eventually enable more download types in parallel.
2021-04-13 10:48:52 -04:00
Nick Mathewson b2d43507b0 Start moving responsibility for building requests into dirmgr
This will help with my planned "directory state" refactoring.
2021-04-09 08:03:09 -04:00
Nick Mathewson 9f44408bb9 Upgrade rsa, zstd, httpdate. Remove redundant pin-project. 2021-04-05 08:26:29 -04:00
Nick Mathewson 51584f1a87 Make ConsensusRequest take a flavor. 2021-04-01 13:20:29 -04:00
Nick Mathewson 8e9abe425a Add accessors for members of different directory requests
This will let us use these types both as client and server-side
implementations.

Making this change required me to change the download code to take
requests by reference.  (Sorry, David)
2021-04-01 12:31:34 -04:00
Nick Mathewson 1e462848da Rename ClientRequest to Requestable. 2021-04-01 11:54:23 -04:00
Nick Mathewson 69fa6c744d Rename ServerDescriptorRequest to RouterDescRequest
Rationale: the name of the request should match the name of the type
that you parse from it.
2021-03-30 14:32:10 -04:00
Nick Mathewson c17d834b77 ServerDescriptorRequest: handle "all.z" case differently
Having "no descriptors" mean "all of them" is kind of an accident
waiting to happen, and had wrong behavior for partial_docs_ok() and
max_response_len().
2021-03-30 14:29:45 -04:00
Nick Mathewson 3465cc979b fix clippy warnings in request.rs 2021-03-30 14:22:36 -04:00
Nick Mathewson 8efe0f7553 Move RdDigest to routerdesc.rs 2021-03-30 14:20:35 -04:00
David Goulet e685ddee84 dir: Add server descriptor directory request
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-03-30 14:15:51 -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 3800c459f6 Rename Rsa{Identity,Signature} to fix clippy warning. 2021-03-29 16:14:43 -04:00
Nick Mathewson 570840c7e1 Refactor errors in tor-decompress and tor-dirclient.
This lets us reinstate the code in dirclient that retired circuits
depending on the error type.
2021-03-24 15:14:44 -04:00
Nick Mathewson d235971ef7 dirclient: add a function to download over a stream.
Also, remove references to DataStream, and comment on the future of
the module.
2021-03-24 13:55:12 -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 988dababf9 Use AsyncRead and AsyncWrite in tor-dirclient 2021-03-10 14:26:01 -05:00
Nick Mathewson 302653977d Bump dependencies with "cargo upgrade" 2021-03-06 08:55:13 -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
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 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