Commit Graph

1107 Commits

Author SHA1 Message Date
Nick Mathewson fe22c329c6 Simple unit tests for tor_rtcompat: at last! 2021-04-19 10:24:13 -04:00
Nick Mathewson a271faca3a rtcompat: mark some outputs as must-use. 2021-04-19 10:08:18 -04:00
Nick Mathewson b8e1234a4c Clarify what TlsConnector doesn't validate. 2021-04-19 08:24:22 -04:00
Nick Mathewson 50f5ad9850 Flatten async_std impl module slightly. 2021-04-19 08:20:20 -04:00
Nick Mathewson e3c51519e8 Flatten tokio TcpProvider implementation a bit. 2021-04-19 08:15:12 -04:00
Nick Mathewson 065162aff2 Add a local_addr() function for TcpListener. 2021-04-18 18:02:30 -04:00
Nick Mathewson 975374beb5 Fix some broken rustdoc links. 2021-04-18 17:55:43 -04:00
Nick Mathewson 342a98dccd tor_rtcompat: Documentation and cleanups 2021-04-17 17:09:20 -04:00
Nick Mathewson a774cdde80 Remove the no-longer-needed "global runtime" code. 2021-04-17 17:09:20 -04:00
Nick Mathewson ee556eb714 Remove some cruft in tor_rtcompat::impls 2021-04-17 17:09:20 -04:00
Nick Mathewson 745a7a89f5 Remove need for async_trait in SleepProviderExt 2021-04-17 17:09: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 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
Nick Mathewson e0f4c222dd Move the "sleep()" function from task to timer. 2021-04-16 15:44:36 -04:00
Nick Mathewson 6821211e1e Make incoming Streams of TcpStream a real type for each backend.
This makes things a little more complicated for AsyncStd, and a
little simpler for Tokio.
2021-04-16 15:44:20 -04:00
Nick Mathewson 5a587a55b4 Port tor_rtcompat::net to use Runtime objects. 2021-04-16 15:44:20 -04:00
Nick Mathewson 459a884f94 Port tor_rtcompat::timer to use Runtime objects. 2021-04-16 13:20:56 -04:00
Nick Mathewson f3505cad49 Begin a refactoring of tor-rtcompat to use runtime objects.
So far, all traits are defined (I hope) and the task api is ported.

With time I want to have none of the current "global runtime" APIs
exposed, and just use Runtime objects instead.  But that isn't just
yet.
2021-04-16 11:25:50 -04:00
Nick Mathewson d18013c03a rtcompat: rename traits module to impl_traits. 2021-04-16 09:47:15 -04:00
Nick Mathewson 67eec8ab91 upgrade dalek dependencies 2021-04-14 08:37:57 -04:00
Nick Mathewson d60cf6ace6 Fix a compilation problem with async_std.
Thank you, CI!
2021-04-13 17:11:43 -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 9efe458ad6 Merge branch 'dirstate' 2021-04-13 10:49:15 -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 421d7d14cc Remove fallback_caches.toml, which is no longer in sync 2021-04-13 09:20:15 -04:00
Nick Mathewson 66de570b27 Merge remote-tracking branch 'origin/mr/30' 2021-04-13 09:16:40 -04:00
David Goulet 37c5ae6440 fallbackdir: New list from April 2021
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-04-12 10:12:03 -04:00
David Goulet 8bd09067cf circmgr: Add missing rng trait to build_path()
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-04-09 08:45:09 -04:00
Nick Mathewson 48bcde631f DocQuery: sort requests before splitting. 2021-04-09 08:03:09 -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 1da7fccfc0 rtcompat: Add a cancellable-task-handle type.
The API is a bit yucky, since it has to be compatible with tokio and
async_std.

(Also, this patch fixes some async_std clippy warnings)
2021-04-09 08:01:38 -04:00
Nick Mathewson 6b805ece67 Merge branch 'mr_28_squashed' 2021-04-07 08:36:15 -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 9f44408bb9 Upgrade rsa, zstd, httpdate. Remove redundant pin-project. 2021-04-05 08:26:29 -04:00
Nick Mathewson 6cc8e5e028 Remove a few unused dependencies 2021-04-05 08:20:06 -04:00
Nick Mathewson f664a76504 Upgrade rusqlite; remove needless usage. 2021-04-05 08:12:10 -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 c0cb790873 missing file. 2021-04-02 10:58:28 -04:00
Nick Mathewson 6daccf89fc Turn the shared network directory reference into its own type
Doing this will make it easier to use it from other parts of the
crate, and will make it more obvious that it's safe to use a regular
(not async) rwlock here.
2021-04-02 09:15:42 -04:00
Nick Mathewson 23c672708a Merge branch 'hs3_ntor_squashed' 2021-04-02 08:34:46 -04:00
Nick Mathewson 89cae112b6 hs_ntor: add a disclaimer and put it behind a feature. 2021-04-02 08:34:03 -04:00
George Kadianakis 81fa7d01ad First draft of HS Ntor implementation. 2021-04-02 08:30:45 -04:00
Nick Mathewson e68c27a324 Fix a rust 1.51 warning: remove a semicolon 2021-04-02 08:00:25 -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