Commit Graph

212 Commits

Author SHA1 Message Date
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 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 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 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 5d8874db52 Make RouterFlags public. 2021-03-30 13:08:55 -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 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 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 278ee1fcb3 Add an intern.rs module that I forgot. 2021-03-29 12:32:35 -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
George Kadianakis 508f4c4f39 Don't copy exit policies around; instead use Arc. 2021-03-29 09:41:18 -04:00
Nick Mathewson a4e0dde4da Add appropriate categories to some Cargo.toml files. 2021-03-17 14:51:18 -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 302653977d Bump dependencies with "cargo upgrade" 2021-03-06 08:55:13 -05:00
Nick Mathewson 568567c5e0 Update to latest futures, once_cell 2021-02-23 15:54:29 -05:00
Nick Mathewson ab9d4a2229 Update some dependencies. 2021-02-19 09:39:23 -05:00
Nick Mathewson ddf994acc5 Add support to override network parameters in the configuration. 2021-02-16 13:29:46 -05:00
Nick Mathewson c16412e372 Detect consensuses that are signed by the wrong authorities.
With this patch we don't consider a consensus to be even potentially
well-signed if the authorities that are listed as signing it don't
contain enough authorities we believe in.  Otherwise, we'd just try
fetching certs for them and failing forever.

(I found this by switching from a chutney network to the main
network without cleaning out my cache.)

Closes #44
2021-01-25 14:08:47 -05:00
Nick Mathewson 5916adac88 Function to see whether the authorities on a netstatus are correct.
We should find out if we believe in the authorities before we even
think of downloading their certs.
2021-01-25 11:22:33 -05:00
Nick Mathewson fa57fb4995 Upgrade a few more dependencies. 2021-01-13 08:17:14 -05:00
Nick Mathewson f01d641ec8 cargo upgrade. 2020-12-30 15:59:33 -05:00
Nick Mathewson f132c15cd1 Remove some now unused methods from NetParams. 2020-12-22 15:21:53 -05:00
Nick Mathewson f3ad295224 Expose network parameters more sensibly from NetDir. 2020-12-22 15:20:07 -05:00
Nick Mathewson cc2a5d94ef Migrate from lazy_static to once_cell. 2020-12-22 11:55:41 -05:00
Lunar 42f0d294de Make sure that a circuit doesn't use relays in the same family
We implement `Relay::in_same_family` which is in turn used by
`ExitPathBuilder::pick_path` to avoid picking relays in the
same family.

Compared to the original C implementation, we are missing
support for options EnforceDistinctSubnets and NodeFamilySets.

This has only been very lightly tested so far.

Closes: #43
2020-12-16 16:34:59 +01:00
Nick Mathewson 90fc798646 Fix some rustdoc warnings. 2020-12-09 09:46:39 -05:00
Nick Mathewson 26a0654b05 Make RSAIdentity implement Copy. 2020-12-08 17:07:30 -05:00
Nick Mathewson a1f1dac4eb Resolve a few nightly-only clippy issues 2020-12-07 16:14:36 -05:00
Nick Mathewson 6ddf55f799 Enforce that the periods in a consensus lifetime are nonempty.
To be valid, a lifetime must have valid_after < fresh_until <
valid_until.
2020-12-04 15:00:06 -05:00
Nick Mathewson bb01a55a8c authcert: move location into UncheckedAuthCert.
This lets us make AuthCert Send and Sync.
2020-12-04 13:17:24 -05:00
Nick Mathewson 9418838456 Fix a copy-paste bug in netstatus::Lifetime 2020-12-04 13:15:58 -05:00
Nick Mathewson 49fc20426a Add a few easy tests in weights.rs 2020-12-02 16:57:37 -05:00
Nick Mathewson 01de0cafc5 Run cargo fix --edition-idioms 2020-12-02 15:14:29 -05:00
Nick Mathewson 6f25dd05af Use a better calculation for deciding if we have enough paths. 2020-12-02 14:09:33 -05:00
Nick Mathewson 412f1763de Implement correct (?) weighting for path selection. 2020-12-02 13:51:19 -05:00