Commit Graph

706 Commits

Author SHA1 Message Date
Nick Mathewson a7a3ef5135 circmgr: refactor and bugfix a bit.
Notably, turn the hashmap into its own type.  This will help with
other refactoring and fixes in the future.

Also notably, fix the code we use when a pending circuit is
complete.  There's still a design flaw there though.
2020-12-14 14:57:29 -05:00
Nick Mathewson c4d3f34e47 tor-circmgr: update documentation 2020-12-14 14:33:21 -05:00
Nick Mathewson 20751f9993 Give more information if we fail to create a pending circuit. 2020-12-14 14:18:36 -05:00
Nick Mathewson 07c08cdf6c Remove now-unused busted From<TargetCircUsage> for CircUsage 2020-12-14 14:08:58 -05:00
Nick Mathewson 6f800ad271 tor-circmgr: always remove closed circuits from the list. 2020-12-14 14:07:58 -05:00
Nick Mathewson 57499d5cf5 tor-circmgr: Use a better key type for our circuit map.
We now use the unique id of each non-pending circuit as its key in
the map.  I wish I could do this without copying, but I don't see a
great way to do that while keeping the pending entries in the same
map for now.
2020-12-14 14:00:53 -05:00
Nick Mathewson d92c1aac04 Remember the actual usable ports for an exit after we've built a circuit
Previously we'd just remember the port that we _wanted_ a circuit
for, and forget all the ports that it _could_ support.

This is part of a bigger circmgr revision/refactoring pass; there
should be cleanups before I merge this.
2020-12-14 12:29:51 -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 566b7a165d Use anyhow::Context in tor-chanmgr. 2020-12-11 13:23:07 -05:00
Nick Mathewson 66a304a0bd Add more anyhow Contexts in client-main 2020-12-11 13:18:10 -05:00
Nick Mathewson 9a68054c4b Do not keep a NetDir alive just because we have a stream. 2020-12-10 16:50:18 -05:00
owen66 18915e84d4 Fixup! issue #34: adding support for xz2 2020-12-10 20:17:04 +00:00
Nick Mathewson 9ea02c066a Merge remote-tracking branch 'origin/mr/5' into main 2020-12-10 12:14:46 -05:00
George Kadianakis cc91b3ce2b Use anyhow crate to add extra context for various dirclient errors. 2020-12-10 17:36:18 +02:00
Nick Mathewson 381530aa84 Add a couple of anyhow contexts in main.rs 2020-12-10 09:53:48 -05:00
Nick Mathewson 90fc798646 Fix some rustdoc warnings. 2020-12-09 09:46:39 -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 b095f3325e It is an internal error if we do a TLS connection and get no cert. 2020-12-08 17:21:04 -05:00
Nick Mathewson 26a0654b05 Make RSAIdentity implement Copy. 2020-12-08 17:07:30 -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 5fc116ad7a Tolerate attempt to write a non-UTF-8 HTTP header.
previously, we would panic.
2020-12-07 21:22:12 -05:00
Nick Mathewson 9419f6d699 Use uniform weight all measured weights are zero. 2020-12-07 21:07:41 -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 8301ae699b gitlab-ci.yml -- on rust-latest, turn all clippy warnings into errors. 2020-12-07 16:18:21 -05:00
Nick Mathewson a1f1dac4eb Resolve a few nightly-only clippy issues 2020-12-07 16:14:36 -05:00
Nick Mathewson 6f7d48eb1c Merge branch 'moar_gitlab_ci' into main 2020-12-07 16:08:03 -05:00
Nick Mathewson a52585d9d6 Mark some XXXX issues as XXXX-A1. 2020-12-07 16:07:59 -05:00
Nick Mathewson 6f286ba7c2 fixup! fixup! fixup! Try adding "test --all" and "fmt" and "clippy". 2020-12-07 14:04:05 -05:00
Nick Mathewson b5f17167c2 fixup! fixup! Try adding "test --all" and "fmt" and "clippy". 2020-12-07 12:51:03 -05:00
Nick Mathewson 09849c64f8 fixup! Try adding "test --all" and "fmt" and "clippy". 2020-12-07 12:41:28 -05:00
Nick Mathewson fd74f6c13f Try adding "test --all" and "fmt" and "clippy". 2020-12-07 12:16:00 -05:00
Nick Mathewson 0f963774db Fix grammar in a log message 2020-12-07 10:21:01 -05:00
Nick Mathewson 9c96b5ea5d Add a missing documentation comment. 2020-12-07 09:26:22 -05:00
Nick Mathewson 6f1e05a1d3 Add a few log messages about download timing. 2020-12-07 09:24:51 -05:00
Nick Mathewson bb62dc8eb5 Merge remote-tracking branch 'origin/mr/2' into main 2020-12-07 08:39:39 -05:00
Nick Mathewson 2d19985cb5 Merge branch 'mr_4_squashed' into main 2020-12-07 08:35:11 -05:00
Alexander Færøy 1923c7820f Let's try explicit target? 2020-12-07 08:35:02 -05:00
Alexander Færøy dee4d7bf72 No need to install Husky hooks on CI. 2020-12-07 08:35:02 -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 5e0b8380e2 Refactor NetDir a little for space savings and updating
Rather than having the NetDir own its microdescs and consensus, give
it Arc<>s for them.  This way, we can do a shallow copy of a NetDir
to work around mutability issues that would otherwise make it hard
to add microdescs to a netdir on the fly.
2020-12-06 11:13:10 -05:00
Alexander Færøy 6fa8f2c0f5 No need to install libsqlite3-dev on CI servers. 2020-12-06 16:01:06 +00:00
Alexander Færøy 3bccafd6b9 Also install libsqlite3-dev. 2020-12-06 01:05:15 +00:00
Alexander Færøy 128f8c31c0 Add Gitlab CI support. 2020-12-06 00:16:34 +00:00
Alexander Færøy 0eedd017ce Fix typo in pick_path().
This patch fixes a minor typo in the error case when looking for a
middle relay for a 3-hop circuit where the error message should say "No
middle relay found" and not "No exit relay found".
2020-12-05 22:45:43 +00: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