summaryrefslogtreecommitdiff
path: root/crates/tor-dirmgr/src
Commit message (Collapse)AuthorAgeFilesLines
* Upgrade event_listener dependency to 3.0.0Nick Mathewson2023-09-281-1/+1
|
* arti-client: add exit selection with GeoIP country codeseta2023-09-181-0/+8
| | | | | | | | | | | | | | | | | | | | This threads the country codes work through the rest of the codebase: - `tor-dirmgr` will now enable GeoIP with the embedded database when the `geoip` future is enabled - This can be extended later using the `DirMgrConfig` to allow specifying a custom database; this is not done here, though - `tor-circmgr`'s `SupportedCircUsage` and `TargetCircUsage` fields gain new `country_code` members to allow filtering circuits by country - These are `()` in builds where the `geoip` feature is not enabled -- doing it this way means we don't have to copy and paste huge swathes of code, since we can't use `#[cfg]` in patterns - `ExitPathBuilder` gains (hacked-in) support for choosing a relay with the correct country code - Due to the lack of conjuction, we just copy and paste a small bit, pending further refactoring - `StreamPrefs` now lets you specify a country code, letting embedders make use of the feature
* Add cognitive-complexity exceptions for clippy.Nick Mathewson2023-09-051-0/+1
| | | | I have no idea why these became necessary.
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-2312-0/+12
|
* Resolve warnings about ambiguous/redundant doc linksNick Mathewson2023-08-221-1/+1
| | | | | Nightly rustdoc now warns if you have a link that isn't necessary, and if you have a link that might refer to two different things.
* tor-dirclient: Make Requestable return requests with String bodies.Gabriela Moldovan2023-08-161-1/+1
| | | | | It's simpler to always use a `String` to represent directory request bodies. We no longer need the `StringBody` trait.
* tor-dirclient: Make the body type of a `Requestable` type configurable.Gabriela Moldovan2023-08-161-1/+1
| | | | | | | | | Previously, the `Requestable` trait assumed the body of the request would always be empty (`http::Request<()>`). This change replaces the hardcoded `()` body type with the `Requestable::Body` associated type (which will allow implementors to create requests with non-empty bodies). This will enable us to reuse the `Requestable` trait for building `POST` requests for uploading descriptors.
* tor-dirclient: Rename download() to send_request() (fmt).Gabriela Moldovan2023-08-161-1/+5
|
* tor-dirclient: Rename download() to send_request().Gabriela Moldovan2023-08-161-2/+2
| | | | | | `download()` is actually a general-purpose function for sending HTTP requests on a stream. We will soon repurpose it for `POST`-ing descriptors, so let's rename it to `send_request`.
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* Merge branch 'clippy-allow' into 'main'Ian Jackson2023-07-1112-0/+13
|\ | | | | | | | | clippy: Allow some of our existing code patterns See merge request tpo/core/arti!1396
| * Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-1012-0/+13
| |
* | rng ranges: Use gen_range_infallible() for Duration::ZERO..=TIan Jackson2023-07-101-3/+2
|/
* Merge branch 'event_report_everywhere' into 'main'Nick Mathewson2023-07-074-32/+23
|\ | | | | | | | | | | | | Throughout: Use event_report!() macros for reporting Errors. Closes #949 See merge request tpo/core/arti!1383
| * Throughout: Use *_report!() macros for reporting Errors.Nick Mathewson2023-07-074-32/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I identified the cases to replace by searching for the string `.report()`. There are a few that I didn't change: * A couple of cases that used anyhow::Error, * One case that reported two Errors. * Two cases in `tor_hsclient::err` that just did `error!("Bug: {}")`. I have also not audited the cases in `tor-hsclient` where we're using `tor_error::Report` manually. Nonetheless, closes #949.
* | rng ranges: Use inclusive Duration ranges in several placesIan Jackson2023-07-071-1/+1
|/ | | | | | | | | | | | | | Many of these call sites would panic if, somehow, the upper bound was zero. In most cases it is very complicated to see if whether this could happen. However, there is a better answer: Durations are (conceptually) dense, so picking the closed set (which includes its boundary) rather than the open one (which doesn't) will make little practical difference. So change four call sites to use `..=` instead of just `..`.
* Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
| | | | Closes #950.
* tor-dirmgr: bridge descriptor tests: Add a missing #[traced_test]Ian Jackson2023-07-061-0/+1
| | | | This seems to have been overlooked.
* tor-dirmgr: bridge descriptor tests: Use MockRuntime (fmt)Ian Jackson2023-07-061-270/+271
| | | | Run rustfmt.
* tor-dirmgr: bridge descriptor tests: Use MockRuntimeIan Jackson2023-07-061-35/+25
| | | | This abolishes a bodge sleep. It should make the tests deterministic.
* tor-dirmgr: bridge descriptor tests: Fix a v. low prob. raceIan Jackson2023-07-061-2/+5
| | | | | | | | | | Drain a number of events, not just one. The stream might yield many events, as explained in this new comment. This fails every time with MockExecutor::try_test_with_various(). I think it might fail with the tokio exeuctor too, but evidently not with high probability or we would have noticed.
* dirmgr: use voting_period.Nick Mathewson2023-06-291-4/+1
|
* lints: Run maint/add_warning to actually apply new lintsIan Jackson2023-06-211-0/+2
|
* dirmgr: remove a needless .borrow()Nick Mathewson2023-05-111-4/+3
| | | | This fixes a warning from nightly clippy.
* Downgrade and clarify message about dir replacment time.Nick Mathewson2023-05-081-8/+12
| | | | Closes #839
* DirMgr: More logs in top-level bootstrapping code.Nick Mathewson2023-05-031-5/+12
| | | | Closes #803, I hope.
* DirMgr: more trace!() logs and information in download/load functions.Nick Mathewson2023-05-031-8/+30
| | | | | | | My goal here is to make sure that we can't confuse one download operation and another, and that we actually know what's going on. Previously, not all state transitions or attempts to fetch information actually corresponded to a log.
* DirMgr: Log at trace! when starting a new "AttemptId".Nick Mathewson2023-05-031-1/+7
|
* Merge branch 'fix_802_core' into 'main'Ian Jackson2023-04-181-1/+6
|\ | | | | | | | | | | | | DirMgr: Detect that directory state is ready if it begins with all MDs Closes #802 See merge request tpo/core/arti!1126
| * DirMgr: Detect that directory state is ready if it begins with all MDsNick Mathewson2023-04-101-1/+6
| | | | | | | | | | | | | | | | | | | | | | Previously, we'd only call PendingNetDir::upgrade_if_necesessary when adding a microdescriptor. But if it began already having all of its descriptors (because we found them in the cache), we wouldn't actually upgrade it to a PendingNetDir::Yielding, which would make it unusable, and would make us schedule its reset time too far in the future. Fixes #802.
* | s/BridgeDescManager/BridgeDescMgr/g in codebaseNeel Chauhan2023-04-121-2/+2
| |
* | Use bool::then_some() as appropriateNick Mathewson2023-04-112-8/+8
|/ | | | | | Now that we require a version of Rust that allows `b.then_some(v)`, clippy complains about our use of `b.then(|| v)`.
* Sort out some TODOs in bdtest.rsIan Jackson2023-03-211-5/+4
|
* Fix a bunch of needless-conversion warnings.Nick Mathewson2023-03-101-3/+2
| | | | | Apparently 1.68 now warns when you call into_iter() on something that's already an iterator. Fair enough. Let's stop doing that.
* tor-dirmgr: Don't try to mark consensus usable in a read-only store.Nick Mathewson2023-03-081-4/+6
| | | | | | | | | | | Doing this means that any attempt to use a read-only store would crash as soon as it found that the consensus was usable. It seems that this bug was introduced at some point doing all the dirmgr refactors we did over the past year. Perhaps there should be a test for running with a read-only store. Fixes #779
* tor-dirmgr: Work around an apparent regression in `time`.Nick Mathewson2023-02-171-3/+3
| | | | | | | Some code in our tests that worked fine with time 0.3.17 no longer works with 0.3.19, despite the semver. See https://github.com/time-rs/time/issues/552 for the upstream bug.
* tor-netdoc: Change fill_from_previous_netdirIan Jackson2023-02-091-1/+1
| | | | | | | | | | | | | | | | * Remove the return value, which was not used anywhere. Also remove the code to calculate the return value. * Take an Arc<NetDir> rather than a reference. We are going to want this for HS support. This has no overall effect on the lifetime of the4 Arc, which was owned at the one call site and then imediately dropped. * Change the documentation to explain what the function's role is in the netdir API, rather than the fiddly details of what it actually does internally. Relegate the latter to a code comment. (When we have HS, this will do more, or, at least, make further arrangements.)
* Use ErrorReport - run rustfmtIan Jackson2023-01-302-3/+11
| | | | Split off for ease of review and possible rebase.
* Use ErrorReport's .report() for two errors in error! in bridgedesc.rsIan Jackson2023-01-301-3/+3
| | | | No functional change, just using the new idiom.
* Use ErrorReport for errors in warn! in tor-dirmgrIan Jackson2023-01-303-10/+10
|
* Use ErrorReport for errors in info! in tor-dirmgrIan Jackson2023-01-302-3/+4
|
* "Fix" remaining unchecked-subtraction warnings.Nick Mathewson2023-01-271-1/+3
| | | | | In both cases I think it's fine to panic; but it's best to do so explicitly.
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-2712-0/+12
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* Disable clippy::unlinlined-format-argsNick Mathewson2023-01-271-0/+1
| | | | | | | | This warning kind of snuck up on us! (See #748) For now, let's disable it. (I've cleaned it up in a couple of examples, since those are meant to be more idiomatic and user-facing.) Closes #748.
* Complete our migration to base64ct.Nick Mathewson2023-01-201-1/+2
| | | | | | | | | This is in lieu of upgrading to the latest base64 crate, which has a different API from the old one. Since we have to migrate either way, we might as well use base64ct everywhere. I don't think that most of these cases _require_ constant-time base64, but it won't hurt.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-128-0/+66
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* test lint blocks: Do some semi-manuallyIan Jackson2022-12-123-1/+25
| | | | | | | This is the hunks from running the rune in maint/adhoc-add-lint-blocks but which require some subsequent manual fixup: usually, deleting now-superfluous outer allows, but in some cases manually putting back lints that the adhoc script deleted.
* Merge branch 'spelling-20221206' into 'main'Ian Jackson2022-12-063-14/+14
|\ | | | | | | | | A few spelling fixes for bridgedescmgr code See merge request tpo/core/arti!925
| * dirmgr: Spelling fixes and normali[sz]ationsNick Mathewson2022-12-063-14/+14
| |
* | Merge branch 'faravahar-removal' into 'main'Ian Jackson2022-12-061-1/+0
|\ \ | | | | | | | | | | | | dirauth: Remove Faravahar See merge request tpo/core/arti!924