Commit Graph

1048 Commits

Author SHA1 Message Date
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
Nick Mathewson 80e9785fa3 Use interned PortPolicy objects in RouterDescs too. 2021-03-29 11:11:01 -04:00
Nick Mathewson 9e0e2475b5 Netdoc: Add support for interned PortPolicy objects in MicroDescs
In C tor, this saved a whole lot of RAM.
2021-03-29 11:07:27 -04:00
Nick Mathewson 9155ac5155 Allow HS* protover names, since these are from our standard. 2021-03-29 09:58:11 -04:00
Nick Mathewson 6e5c056c6c Use Arc::clone() explicitly with port policies 2021-03-29 09:43:28 -04:00
George Kadianakis 508f4c4f39 Don't copy exit policies around; instead use Arc. 2021-03-29 09:41:18 -04:00
Nick Mathewson 2dce8fda0b Check for channel match in create_firsthop_ntor().
This way we won't even try sending the CREATE2 cell unless the
Ed25519 identity we know for the channel matches the provided
CircTarget.
2021-03-24 15:29:52 -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 3a8fccf94f Add a "this crate has no timeouts" comment to tor-proto. 2021-03-24 11:18:27 -04:00