summaryrefslogtreecommitdiff
path: root/crates/tor-dirmgr
Commit message (Collapse)AuthorAgeFilesLines
...
* | | 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.
* | | humantime: Update to humantime-serde 1.1.1Ian Jackson2022-03-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This has the humantime_serde::option module, which we have upstreamed and are about to switch to. The remaining dependency with version = "1" is going to be removed in a moment.
* | | 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-114-12/+23
|\ \ \ | | | | | | | | | | | | | | | | Add flatfile DirMgr See merge request tpo/core/arti!318
| * | | Expose APIs for external DirProviderChristian Grigis2022-03-114-12/+23
| |/ /
* | | 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.
* | | Use git source for derive_builder for now, for attrs featureIan Jackson2022-03-071-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | We are going to want to specify custom attributes on fields of the builder struct. This feature was missing from derive_builder. This commitid is the current head of my MR branch https://github.com/colin-kiegel/rust-derive-builder/pull/237 https://github.com/ijackson/rust-derive-builder/tree/builder-field-attrs Using the commitid prevents surprises if that branch is updated. We will require this newer version of derive_builder. The version will need to be bumped again later, assuming the upstream MR is merged and upstream do a release containing the needed changes.
* | 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-043-26/+16
|\ \ \ | |/ / |/| | | | | | | | 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-042-2/+2
| | | | | | | | | | | | | | | | | | | | | 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-022-8/+7
| | |
* | | 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
| | |
* | | Merge branch 'clippy-allow-arc-clone' into 'main'Nick Mathewson2022-03-011-1/+0
|\ \ \ | | | | | | | | | | | | | | | | Disable clippy::clone_on_ref_ptr See merge request tpo/core/arti!352
| * | | 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.
* / | Bump all crates to 0.1.0arti-v0.1.0Nick Mathewson2022-03-011-13/+13
|/ /
* | 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-176-59/+170
|\
| * 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-165-16/+61
| | | | | | | | | | 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.
* | dirmgr: Remove a useless Ok(x?)Nick Mathewson2022-02-141-1/+1
|/ | | | Found by nightly clippy.
* Allow creating unbootstrapped `TorClient`s (and `DirMgr`s)eta2022-02-112-24/+159
| | | | | | | | | | | | | | | This commit changes how the `TorClient` type works, enabling it to be constructed synchronously without initiating the bootstrapping process. Daemon tasks are still started on construction (although some of them won't do anything if the client isn't bootstrapped). The old bootstrap() methods are now reimplemented in terms of the new create_unbootstrapped() and bootstrap_existing() methods. This required refactoring how the `DirMgr` works to enable the same sort of thing there. closes #293
* Make SpawnError wrappers contain a 'spawning' stringNick Mathewson2022-02-042-22/+34
| | | | | (By our convention, these errors should say what we were trying to spawn when the error occurred.)
* Make TorError implement Clone.Nick Mathewson2022-02-041-4/+22
| | | | | This patch makes only minimal changes in lower-level error types: we have more refactoring to do.
* spawn errors: Fix tor-dirmgrIan Jackson2022-02-041-3/+10
|
* tor-error: Add as a ddpendency to many cratesIan Jackson2022-02-041-0/+1
| | | | Doing this here makes it easier when I rebase/reorder things
* Merge branch 'dirclient-testing' into 'main'Nick Mathewson2022-02-031-1/+1
|\ | | | | | | | | dir-client: bug fix and more tests See merge request tpo/core/arti!271
| * Upgrade required version of futures crate to 0.3.14Nick Mathewson2022-02-011-1/+1
| | | | | | | | | | Earlier versions have a bug in UnboundedReceiver that make our new dirclient tests fail.
* | Fix invalid path character on windowsMichael2022-01-311-2/+2
|/