Commit Graph

49 Commits

Author SHA1 Message Date
Nick Mathewson ccd6cbf627 upgrade to latest anyhow 2020-12-21 10:21:24 -05:00
Nick Mathewson f1eba83ebd Fix a few clippy warnings 2020-12-17 15:23:55 -05:00
Nick Mathewson 31aa73c022 Download and use consensus diffs.
Had to refactor a few methods for database access, and fix a bug
where we were storing valid_until times with the wrong information.
2020-12-17 15:08:53 -05:00
Nick Mathewson a8a35c9914 dirmgr: Refactor so it has no unusable state.
With this new API, if you have a DirMgr, it has a NetDir that was
bootstrapped, and was live at least once during your program's
execution.
2020-12-15 11:57:24 -05:00
Nick Mathewson 863f459389 Add a "RetryError" to capture the idea of multiple failed attempts.
When we try to do something a few times and it fails each time, it
can be a good idea to remember why the individual failures
happened.
2020-12-12 12:54:00 -05:00
Nick Mathewson cfdedb995f upgrade rusqlite 2020-12-08 17:26:49 -05:00
Nick Mathewson 17c84fd59e upgrade to require latest anyhow. 2020-12-08 17:26:19 -05:00
Nick Mathewson 0caee4718f Document a problem on network transition 2020-12-08 16:59:16 -05:00
Nick Mathewson 8d6087426e De-parameterize ChanMgr and everything that wraps it.
This makes a whole lot of our code simpler, and makes it so that
CircMgr and DirMgr no longer need to have anything parameterized
over transports, either.

Instead of boxing Transport inside of ChanMgr, I've made a new
Connection trait that goes from a ChanTarget* straight to a Channel.
This lets us avoid having to box the intermediate TLS object.

[*] Actually, a copy of the information from a ChanTarget. Ick, but
I had to make a copy to avoid parameterizing
Connecter::build_channel.
2020-12-08 16:29:18 -05:00
Nick Mathewson bdc7908c7f Fix a logic bug in the --chutney-dir option.
It was recording the dirport for each chutney authority as though it
were an orport.  That obviously won't work.

Closes arti#45.
2020-12-07 16:54:18 -05:00
Nick Mathewson a52585d9d6 Mark some XXXX issues as XXXX-A1. 2020-12-07 16:07:59 -05:00
Nick Mathewson 0f963774db Fix grammar in a log message 2020-12-07 10:21:01 -05:00
Nick Mathewson 6f1e05a1d3 Add a few log messages about download timing. 2020-12-07 09:24:51 -05:00
Nick Mathewson 57eea69f52 Teach updater to download microdescriptors for usable directory.
This follows a three-phase process: We are either fetching
microdescriptors, waiting for the time to download the next
consensus, or fetching the next consensus and making it usable.

We can stop fetching microdescriptors for two reasons: by having no
more mds that we need to download, or by running out of time in
which the current consensus is usable.
2020-12-07 08:29:35 -05:00
Nick Mathewson 915515442f Reuse microdescriptors from previous consensus
Previously, we'd re-parse them from the database every time we got a
new consensus.
2020-12-06 11:42:50 -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 402d501020 Update a few comments. 2020-12-04 14:03:05 -05:00
Nick Mathewson b56223f382 Dirmgr: Add a feature to keep the directory up-to-date.
This required me to move the sqlite connection from a rwlock into mutex,
since it isn't actually Sync.
2020-12-04 13:53:51 -05:00
Nick Mathewson a72437a1c7 Abandon directory circuits on most kinds of directory failure.
(There are more cases that this _doesn't_ handle, but it's a start
for now.)
2020-12-02 09:46:35 -05:00
Nick Mathewson db55c84c89 tor-dirmgr: retry up to 3 times on download failure. 2020-12-01 09:38:59 -05:00
Nick Mathewson 85cf6c09b3 Make mmap usage optional. 2020-12-01 07:56:36 -05:00
Nick Mathewson d7b79095c8 tor-dirmgr: tests for storage.rs 2020-12-01 07:44:47 -05:00
Nick Mathewson b0fc36c06a Add a decorrelated-jitter implementation.
This is the algorithm we use on download failure to back off before
we retry.
2020-11-30 16:43:36 -05:00
Nick Mathewson ffd4ed16a0 only expire dorectory info on a successful bootstrap. 2020-11-30 12:54:56 -05:00
Nick Mathewson a1d02d4154 Add tests for blob_fname failing cases 2020-11-30 12:35:33 -05:00
Nick Mathewson 39bc39ddd5 More tests for sqlite.rs 2020-11-30 12:26:11 -05:00
Nick Mathewson c3c3d24973 Initial tests for authcert storage 2020-11-30 11:59:41 -05:00
Nick Mathewson baba0773c3 tor-dirmgr: Refactor storage not to take AuthCert type.
Add a new AuthCertMeta type to make it easier to test.
2020-11-30 11:26:03 -05:00
Nick Mathewson e979bd5cb2 tor-dirmgr: Refactor storage not to take Microdesc type.
Since all it needs is an MDDigest, that's what it should take.  This
will make it easier to test.
2020-11-30 11:11:39 -05:00
Nick Mathewson 1806135313 Add a test for sha3_dual 2020-11-30 11:00:58 -05:00
Nick Mathewson e18b4e07cb Upgrade a couple of dependencies 2020-11-28 14:17:42 -05:00
Nick Mathewson ce221476d5 Fetch microdescriptors in parallel. 2020-11-24 11:59:56 -05:00
Nick Mathewson 142116c031 A little better logging on bootstrap. 2020-11-24 10:57:20 -05:00
Nick Mathewson ea27328c67 Make legacy-store code disabled by default.
In the long run we might not want it at all.
2020-11-24 10:43:16 -05:00
Nick Mathewson e3d4a6e114 Turn client-demo into a mostly-good client. 2020-11-24 10:33:38 -05:00
Nick Mathewson f9d741ab36 Add a function to load a directory from cache. 2020-11-24 09:00:45 -05:00
Nick Mathewson 9749022fa2 When a consensus has enough descriptors, mark it non-pending. 2020-11-24 07:08:41 -05:00
Nick Mathewson 7af214b594 When storing consensuses, index them by the sha3 of the whole file. 2020-11-23 11:11:17 -05:00
Nick Mathewson 525f6b2bfa Document and de-warning the rest of tor-dirmgr 2020-11-23 10:41:41 -05:00
Nick Mathewson 5f361d9529 Less copying of the authority list. 2020-11-23 09:33:43 -05:00
Nick Mathewson b4831da536 A little documentation in tor-dirmgr 2020-11-23 09:23:20 -05:00
Nick Mathewson 3f89b3db7b Make "storage" module private 2020-11-20 16:29:55 -05:00
Nick Mathewson 99e0b1d9f5 Remove a couple of #[allow]s. 2020-11-20 15:30:32 -05:00
Nick Mathewson 61593e1c59 Teach DirMgr to use its own NetDir, if present, to bootstrap itself. 2020-11-20 15:11:20 -05:00
Nick Mathewson 7a78bef0d1 Add a better way to get a shared directory out of a DirMgr. 2020-11-20 15:07:38 -05:00
Nick Mathewson 48da54d8c5 Remove needless Arc<> for DirStoreHandle. And DirStoreHandle itself. 2020-11-20 14:52:59 -05:00
Nick Mathewson 999706ee8f Move a few more responsibilities into NetDirConfig.
Also start a DirMgr type.
2020-11-20 14:46:22 -05:00
Nick Mathewson 7e50c4ad3a Move storage and config logic from netdir to dirmgr. 2020-11-20 12:20:43 -05:00
Nick Mathewson 9f4230fb1b Initial pass on directory-manager code.
This code can now bootstrap from the network, cache the results, and
reload from cache.

There's lots more work to do here, including a big pile of tidying
and refactoring and testing and documentation.
2020-11-19 19:11:10 -05:00