Commit Graph

125 Commits

Author SHA1 Message Date
Nick Mathewson 9737580402 Add a few more clippy warnings 2021-05-03 16:10:39 -04:00
Nick Mathewson b81db158bb tweak semantics of routerdesc docid 2021-05-03 15:54: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 975374beb5 Fix some broken rustdoc links. 2021-04-18 17:55:43 -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 e0f4c222dd Move the "sleep()" function from task to timer. 2021-04-16 15:44:36 -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 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
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
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 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 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 ca7e1a0de9 DirMgr: add text() and texts() functions to ask for document text
Also, start on a larger refactoring where we ask for documents by
their ID.
2021-03-31 12:41:56 -04:00
Nick Mathewson beb9eff27b Refactor sqlite.rs to know about consensus flavors.
These were stored in the database before, but they were hardwired in
the API.
2021-03-31 08:23:51 -04:00
Nick Mathewson 4a438afbd5 Use Arc::make_mut() to simplify the code a bit
Previously we used NetDir::extend here, which used try_unwrap.  But
it's much simpler to use the intended object for this purpose.
2021-03-30 16:05:59 -04:00
Nick Mathewson 8cf4778c71 Look for RdDigest in the right location 2021-03-30 15:05:23 -04:00
Nick Mathewson 565e48ff8c small tweaks to routerdesc storage code. 2021-03-30 14:57:11 -04:00
David Goulet 2d43bdd561 dirmgr: Add functions to store/read/update router descriptors
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-03-30 14:44:42 -04:00
David Goulet f7d1e515b9 dirmgr: Add SQLite schema for router descriptors
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-03-30 14:23:49 -04:00
Nick Mathewson d6d78fdcc3 Make reasonable set of default fallback directories 2021-03-30 12:44:38 -04:00
Nick Mathewson 957701e912 Give the authorities value a reasonable default. 2021-03-30 12:20:39 -04:00
Nick Mathewson 95ea804636 Add a NetDirConfig::use_default_cache_path() function. 2021-03-30 12:08:03 -04:00
Nick Mathewson 6890f18094 resolve a clippy issue 2021-03-30 12:05:59 -04:00
Nick Mathewson d7fff75934 Declare a better default for DownloadScheduleConfig. 2021-03-30 11:48:43 -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 50ba1cb85c DirMgr: cooperative multiprocess support.
A directory manager can now launch or run in read-only or read-write
mode, depending on whether it manages to acquire a lock on the
filesystem.

In read-write mode, it bootstraps and stores data into the database
as usual.

In read-only mode, it assumes that another process will be updating
the database, and so it only loads it periodically, looking for new
information.  However, it also tries to acquire the lock itself, so
it can enter read-write mode.
2021-03-29 15:37:43 -04:00
Nick Mathewson 87d191c4b8 Create a DirMgr::load_or_bootstrap_from_config. 2021-03-29 14:12:59 -04:00
Nick Mathewson 1bd110bf11 Add support for a lockfile to control concurrent access to a dirmgr. 2021-03-29 13:58:49 -04:00
Nick Mathewson 83ebd56f64 Add DirMgr::load_once.
This function loads a current bootstrapped directory from disk, if
it can.
2021-03-29 12:23:47 -04:00
Nick Mathewson e226a57869 Use the CircMgr in the DirMgr for all our downloading needs. 2021-03-29 12:13:31 -04:00
Nick Mathewson efe99633a5 Make CircMgr an optional element of DirMgr. Not yet used. 2021-03-29 12:00:33 -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