aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-dirmgr/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * | Run rustfmtIan Jackson2022-03-171-5/+6
| | |
| * | GetMicrodescsState: Abolish separate n_missing field inIan Jackson2022-03-171-12/+12
| | |
| * | GetMicrodescsState: Break out with_mdreceiver_for_missingIan Jackson2022-03-171-13/+23
| | |
| * | GetMicrodescsState: Dedupe slightlyIan Jackson2022-03-171-8/+9
| | |
| * | tor-dirmgr: Remove redundant hashtable.Nick Mathewson2022-03-161-22/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | We were using a hashtable to keep track of missing microdescriptor digests. But this information is redundant with the NetDir state, and there's now no longer any performance benefit to keeping a separate copy. Part of #386.
* | | Merge branch 'config-partials-transparent' into 'main'Ian Jackson2022-03-173-67/+43
|\ \ \ | | | | | | | | | | | | | | | | Absolish builders for CircMgrConfig and DirMgrConfig See merge request tpo/core/arti!417
| * | | DirMgrConfig: abolish builder; make it transparent and exhaustiveIan Jackson2022-03-163-67/+43
| | | | | | | | | | | | | | | | See rationale in the comment.
* | | | Merge branch 'always-ims' into 'main'eta2022-03-161-10/+49
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | dirmgr: Always send if-modified-since on consensus documents. Closes #403 See merge request tpo/core/arti!412
| * | | dirmgr: Always send if-modified-since on consensus documents.Nick Mathewson2022-03-161-10/+49
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | We never want a consensus document that's super-old, since we would reject it immediately for being too old. Also, never send an if-modified-since that's so old that we'd reject the response. Closes #403
* | | RetryDelay: remove accessors.Nick Mathewson2022-03-161-7/+9
| | | | | | | | | | | | Instead, check initial_delay in dirmgr directly.
* | | Remove re-export of retry-schedule in tor-dirmgr.Nick Mathewson2022-03-161-1/+1
| | | | | | | | | | | | It wasn't necessary.
* | | Fix up documentation on RetryDelay.Nick Mathewson2022-03-161-6/+3
| | | | | | | | | | | | | | | It's no longer about downloads; it's about whatever you need to retry.
* | | Move RetryDelay from dirmgr to basic-utils.Nick Mathewson2022-03-161-155/+1
| | | | | | | | | | | | | | | This (almost) a pure code-movement commit: it also makes one public function private in order to suppress a warning.
* | | RetryDelay: add accessors for stateNick Mathewson2022-03-161-5/+22
|/ / | | | | | | | | We'll need these for our unit tests in tor-dirmgr once we move RetryDelay into tor-basic-utils.
* | Merge branch 'missing_shrink_to_fit' into 'main'eta2022-03-141-0/+7
|\ \ | | | | | | | | | | | | | | | | | | dirmgr: Call shrink_to_fit on missing-microdesc hashtable Closes #388 See merge request tpo/core/arti!399
| * | dirmgr: Call shrink_to_fit on missing-microdesc hashtableNick Mathewson2022-03-101-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This hashtable starts out pretty large, but it can spend most of our runtime (when we aren't downloading) being small. To avoid doing too much work, I've made it so we only call shrink_to_fit twice per consensus: once when we're no longer pending, and once when we're complete. Closes #388.
* | | Follow-up from arti!318Nick Mathewson2022-03-112-2/+11
| | | | | | | | | | | | Make update_config only conditionally exported; add semver-status update.
* | | Merge branch 'add-flatfile-dirmgr' into 'main'Nick Mathewson2022-03-113-12/+17
|\ \ \ | | | | | | | | | | | | | | | | Add flatfile DirMgr See merge request tpo/core/arti!318
| * | | Expose APIs for external DirProviderChristian Grigis2022-03-113-12/+17
| |/ /
* | | Drop remaining conversion from FooConfig to FooConfigBuilderIan Jackson2022-03-071-22/+0
| | |
* | | Derive Deserialize for derive-builder-generated config buildersIan Jackson2022-03-072-0/+4
|/ / | | | | | | | | | | | | | | | | | | | | | | | | I used git-grep -P '\#\[serde\((?!default|deny_unknown)' to find places where I needed to add additional attributes on the builder method fields. This is currently a bit duplicative, but when #371 is completely done, the validated (non-builder) configs won't need to be Deserialize any more. This is part of #371 and #372.
* | Merge branch 'errors-for-dirprovider' into 'main'Nick Mathewson2022-03-041-0/+12
|\ \ | | | | | | | | | | | | | | | | | | Errors for dirprovider Closes #370 See merge request tpo/core/arti!385
| * | Provide an error variant for external directory providersIan Jackson2022-03-041-0/+12
| | |
* | | Merge branch 'educe-traits' into 'main'Ian Jackson2022-03-042-26/+14
|\ \ \ | |/ / |/| | | | | | | | Replace many manual trait impls with use of educe See merge request tpo/core/arti!375
| * | Move skip_fmt into tor-basic-utilsIan Jackson2022-03-041-1/+1
| | | | | | | | | | | | | | | | | | | | | Code motion and the minimal mechanical changes. As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/375#note_2783078
| * | Replace manual Default impl with educe in tor-dirmgrIan Jackson2022-03-021-10/+5
| | |
| * | Replace manual Default impl with educe+std in tor-dirmgrIan Jackson2022-03-021-8/+4
| | |
| * | Replace manual Debug impl with educe in tor-dirmgrIan Jackson2022-03-021-8/+5
| | |
* | | Use RsaIdentity::from_hex() and hex::decode_to_slice in more placesNick Mathewson2022-03-044-16/+8
| | | | | | | | | | | | These aren't critical-path, but they do make the code a little nicer.
* | | Merge branch 'dir-provider-redux' into 'main'Ian Jackson2022-03-021-1/+63
|\ \ \ | |/ / |/| | | | | | | | Alternative DirProvider setup See merge request tpo/core/arti!347
| * | DirProvider: Fix infinite recursion bugNick Mathewson2022-02-251-4/+4
| | |
| * | Un-parameterize DirProvider.Nick Mathewson2022-02-231-15/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the EventStream associated type and the Runtime parameter. The Runtime parameter wasn't actually used for anything, and the EventStream was easy enough to replace with a BoxStream in this case. Also replaced DirBootstrapEvents with a BoxStream to avoid tying anything to our backend.
| * | Add basic DirProvider trait, use it in clientChristian Grigis2022-02-231-0/+68
| | |
* | | Disable clippy::clone_on_ref_ptrIan Jackson2022-02-241-1/+0
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lint is IMO inherently ill-conceived. I have looked for the reasons why this might be thought to be a good idea and there were basically two (and they are sort of contradictory): I. "Calling ‘.clone()` on an Rc, Arc, or Weak can obscure the fact that only the pointer is being cloned, not the underlying data." This is the wording from https://rust-lang.github.io/rust-clippy/v0.0.212/#clone_on_ref_ptr It is a bit terse; we are left to infer why it is a bad idea to obscure this fact. It seems to me that if it is bad to obscure some fact, that must be because the fact is a hazard. But why would it be a hazard to not copy the underlying data ? In other languages, faliing to copy the underlying data is a serious correctness hazard. There is a whose class of bugs where things were not copied, and then mutated and/or reused in multiple places in ways that were not what the programmer intended. In my experience, this is a very common bug when writing Python and Javascript. I'm told it's common in golang too. But in Rust this bug is much much harder to write. The data inside an Arc is immutable. To have this bug you'd have use interior mutability - ie mess around with Mutex or RefCell. That provides a good barrier to these kind of accidents. II. "The reason for writing Rc::clone and Arc::clone [is] to make it clear that only the pointer is being cloned, as opposed to the underlying data. The former is always fast, while the latter can be very expensive depending on what is being cloned." This is the reasoning found here https://github.com/rust-lang/rust-clippy/issues/2048 This is saying that *not* using Arc::clone is hazardous. Specifically, that a deep clone is a performance hazard. But for this argument, the lint is precisely backwards. It's linting the "good" case and asking for it to be written in a more explicit way; while the supposedly bad case can be written conveniently. Also, many objects (in our codebase, and in all the libraries we use) that are Clone are in fact simply handles. They contain Arc(s) (or similar) and are cheap to clone. Indeed, that is the usual case. It does not make sense to distinguish in the syntax we use to clone such a handle, whether the handle is a transparent Arc, or an opaque struct containing one or more other handles. Forcing Arc::clone to be written as such makes for code churn when a type is changed from Arc<Something> to Something: Clone, or vice versa.
* | dirmgr::Store.expire_all takes configtharvik2022-02-233-26/+47
| |
* | dirmgr: add Store traittharvik2022-02-236-278/+310
|/
* Rename TorConnectionFailed to TorAccessFailedNick Mathewson2022-02-221-1/+1
|
* Rename TorShuttingDown to ArtiShuttingDownNick Mathewson2022-02-221-1/+1
|
* dirclient: Remove HttpStatus error variantNick Mathewson2022-02-171-2/+11
| | | | | | | Getting a non-200 status is no longer a failure condition; it's just a different kind of answer. Closes #349.
* Merge branch 'remaining-errors'Nick Mathewson2022-02-175-59/+169
|\
| * Use TorConnectionFailed for failure to download directory.Nick Mathewson2022-02-171-1/+1
| |
| * tor-dirmgr: Use Bug type for sqlite-detected bugsIan Jackson2022-02-171-1/+9
| | | | | | | | So we get a stack trace
| * tor-dirmgr: Make sqlite_error_kind take rusqlite::ErrorIan Jackson2022-02-171-32/+34
| | | | | | | | | | We're about to reuse this and we'll want it to take the higher-level type. Also it seems more proper like this.
| * dirmgr: Remember where netdocs came from.Nick Mathewson2022-02-164-16/+60
| | | | | | | | | | This isn't complete (see TODO), but it's enough to let us report the right ErrorKind if something fails to parse.
| * dirmgr: eliminate StringParsingError.Nick Mathewson2022-02-164-29/+23
| | | | | | | | | | | | | | | | It had too many possible Kinds depending on what kind of string had failed to parse. I decided to use #[source] here instead of #[from], so that we would have to explicitly convert these errors where they show up.
| * dirmgr: HasKind for internal and sqlite errorsNick Mathewson2022-02-162-13/+54
| | | | | | | | | | At first I had thought that all sqlite errors would be internal, but that's not the case.
| * dirmgr: implement HasKind for the easier variantsNick Mathewson2022-02-161-9/+30
| |
* | arti-client: add ability to automatically bootstrapeta2022-02-161-2/+2
|/ | | | | | | | | | | | | The new `BootstrapBehavior` enum controls whether an unbootstrapped `TorClient` will bootstrap itself automatically (`Ondemand`) when an attempt is made to use it, or whether the user must perform bootstrapping themselves (`Manual`). The `lazy-init` example shows how you could write a simple `get_tor_client()` function that used a global `OnceCell` to share a Tor client across an entire application with this API. closes arti#278
* Merge branch 'warn_not_deny' into 'main'eta2022-02-141-1/+1
|\ | | | | | | | | | | | | Change deny(clippy::all) to warn(clippy::all). Closes #338 See merge request tpo/core/arti!306
| * Change deny(clippy::all) to warn(clippy::all).Nick Mathewson2022-02-141-1/+1
| | | | | | | | Closes #338.