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
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
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