Commit Graph

1107 Commits

Author SHA1 Message Date
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 df097c19a3 Note redundancy in authority and fallback toml files. 2021-03-31 08:27:55 -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 063f747e47 Make ConsensusFlavor a real type.
Previously we were "stringly typing" this field.  Now it's time to stop.
2021-03-31 08:06:54 -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 7ad1c58398 Merge branch 'sd-storage' 2021-03-30 15:02:56 -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
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
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 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
David Goulet 9025f19756 rs: Add getters to router status objects
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-03-30 13:44:50 -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 d1f182719c Experimental accessor functions for Relay members. 2021-03-30 13:14:15 -04:00
Nick Mathewson 5d8874db52 Make RouterFlags public. 2021-03-30 13:08:55 -04:00
Nick Mathewson a062edc257 Tell .gitignore to ignore more "target" directories. 2021-03-30 13:03:41 -04:00
Nick Mathewson ceb310c013 Add an accessor for the members of a relay family. 2021-03-30 13:00:56 -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 2cf2287bce Add a missing member documentation 2021-03-30 11:23:10 -04:00
Nick Mathewson e6b7fb5a98 Add a fuzzer for NsConsensus documents 2021-03-30 11:15:58 -04:00
Nick Mathewson 63fc8d6a7c Add a test case for NS consensus parsing. 2021-03-30 11:15:58 -04:00
Nick Mathewson 42fb6015d2 NS consensus documents have signatures on SHA1 hashes, not SHA256. 2021-03-30 11:15:58 -04:00
Nick Mathewson cd31eefeb1 Implement parsing for ns-flavored consensus documents. 2021-03-30 11:15:58 -04:00
Nick Mathewson 80a11fd4f5 Make RouterStatus a trait and Consensus into a generic type.
This breaks surprisingly little.
2021-03-30 10:09:53 -04:00
Nick Mathewson f9f7176d5e Start moving MdConsensus-specific code to a submodule.
This is part of refactoring to handle NsConsensuses.
2021-03-30 08:37:40 -04:00
Nick Mathewson 7aa876cc0a Resolve rustdoc warnings. 2021-03-29 18:18:25 -04:00
Nick Mathewson e9e85dfce8 Resolve two clippy warnings in blind_pubkey. 2021-03-29 18:08:56 -04:00
Nick Mathewson 63a4f37f2e Merge remote-tracking branch 'origin/mr/23' 2021-03-29 17:09:05 -04:00
George Kadianakis 32a117ebc0 v3: Add two new test vectors that test key blinding clamping. 2021-03-30 00:06:26 +03:00
George Kadianakis 294c6b0897 v3: Improve error handling on key blinding. 2021-03-30 00:06:20 +03:00
Nick Mathewson d52ff18b46 Fix a bunch more new clippy lints in Rust 1.51
The major types are:
  * You implemented Into when you should have implemented From.
  * You sliced a slice when you didn't have to.
  * You said Ok(x?) when you could have said x.
  * You said Vec::new(); push(); push(); when you could have said vec![].
2021-03-29 16:45:45 -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 401d7e9fd1 tor-config: fix a new clipppy warning. 2021-03-29 15:45:50 -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
George Kadianakis ea10259be2 Implement basic ed25519 key blinding for v3 onion services. 2021-03-29 20:29:12 +03:00
Nick Mathewson 278ee1fcb3 Add an intern.rs module that I forgot. 2021-03-29 12:32:35 -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