aboutsummaryrefslogtreecommitdiff
path: root/crates/arti-client
Commit message (Collapse)AuthorAgeFilesLines
* 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-10/+10
| |
* | Update README.md files from rustdoc.Nick Mathewson2022-03-011-79/+99
| |
* | Fix rustdoc errors.Nick Mathewson2022-03-011-8/+9
| |
* | Run rustfmt.Nick Mathewson2022-03-011-1/+0
| |
* | Merge remote-tracking branch 'origin/mr/371'Nick Mathewson2022-03-011-0/+9
|\ \
| * | arti-client: Add stability warning to config moduleIan Jackson2022-03-011-0/+9
| | |
* | | Merge branch '010_docs'Nick Mathewson2022-03-012-7/+20
|\| |
| * | Update our stability warning on arti-client.Nick Mathewson2022-02-281-5/+12
| | |
| * | Add warnings about configuration stability.Nick Mathewson2022-02-281-2/+8
| | |
* | | Merge branch 'main'Ian Jackson2022-03-012-3/+9
|\| | | | | | | | | | | | | | | | | | | | Fixed conflict in crates/arti-client/src/lib.rs as per tree from https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/364/#note_2782166 ie 13e55b8d7c22c26e55ba75823409b477f1bce66b
| * | Split "static" into sqlite and native-tls features.Nick Mathewson2022-02-252-5/+22
| | | | | | | | | | | | | | | | | | | | | Otherwise, it's impossible to get a static sqlite linkage without also getting native-tls, even if you wanted rustls. Closes #302.
* | | arti-client: use PreferredRuntime by default, doc cleanupseta2022-02-285-125/+131
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes using the `PreferredRuntime` the first-class option inside `arti-client`, freeing users who don't want to think about runtimes from having to do so. `TorClient::create_unbootstrapped` and `builder` now automatically use this runtime, leaving only `builder_custom` for users who wish to manually specify a runtime. This lets us clean up the docs a lot: mentions of using custom runtimes are now relegated to nearer the end of the crate-level documentation, and we mostly just link to `tor_rtcompat`'s docs to explain more there. Instead, we take some more time to explain how you use the builder API to create clients synchronously. Other doc cleanups included getting rid of the explanation of `TorAddr` in the main crate-level doc; this is already well-documented elsewhere, and is something users should discover organically later. fixes arti#326
* | Merge branch 'upgrade-dependencies' into 'main'Nick Mathewson2022-02-251-2/+2
|\ \ | | | | | | | | | | | | Upgrade a few dependencies to newer versions See merge request tpo/core/arti!357
| * | Bump minimum tokio to 1.7, since tokio-util now needs that.Nick Mathewson2022-02-251-1/+1
| | |
| * | Upgrade dependency to new version of tokio-util.Nick Mathewson2022-02-251-1/+1
| | |
* | | Merge branch 'tcp-hook-new-tls' into 'main'eta2022-02-251-2/+1
|\ \ \ | |/ / |/| | | | | | | | use runtime TlsProvider in tcp-hook example See merge request tpo/core/arti!356
| * | use runtime TlsProvider in tcp-hook exampletrinity-1686a2022-02-251-2/+1
| | |
* | | Merge branch 'get-runtime' into 'main'Ian Jackson2022-02-251-0/+11
|\ \ \ | |/ / |/| | | | | | | | TorClient: Add get_runtime() convenience method See merge request tpo/core/arti!350
| * | TorClient:runtime(): rename from get_runtimeIan Jackson2022-02-251-1/+1
| | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/350#note_2781368
| * | TorClient: Add get_runtime() convenience methodIan Jackson2022-02-241-0/+11
| | |
* | | arti-client: Unlock the state manager on failure to bootstrapeta2022-02-243-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `StateMgr` got a new `unlock()` method that does what it says on the tin. We now call it from `bootstrap()` using the new `util::StateMgrUnlockGuard`, which works in a manner similar to the `BoolResetter` from `tor_dirmgr`. (A decent small little task in future might be to unify these types in some sort of general arti utility crate?) closes arti#335
* | | Merge branch 'http-layer' into 'main'eta2022-02-244-161/+10
|\ \ \ | |_|/ |/| | | | | | | | Initial cut of hyper bindings as a library crate See merge request tpo/core/arti!342
| * | impl From<TorAddrError> for tor_error::ErrorIan Jackson2022-02-231-0/+8
| | | | | | | | | | | | | | | It auto-converts to ErrorDetail but add this for convenience of callers which don't want to look into that unstable API.
| * | arti-hyper: Move hyper example from arti-clientIan Jackson2022-02-232-161/+0
| | | | | | | | | | | | Code motion and consequential dependency adjustments.
| * | Add missing documentation for TLS features to two readmesIan Jackson2022-02-231-0/+2
| |/
* | Fix typosDimitris Apostolou2022-02-231-3/+3
| |
* | Merge branch 'custom-tcp-hook' into 'main'eta2022-02-231-0/+339
|\ \ | | | | | | | | | | | | add example of tcp hook See merge request tpo/core/arti!341
| * | add one more comment to hook-tcptrinity-1686a2022-02-231-0/+1
| | |
| * | examples/hook-tcp: add some comments, rework lifetimes a biteta2022-02-231-28/+73
| | | | | | | | | | | | | | | | | | Try to make the `hook-tcp` example a bit easier to read by adding/changing comments, and renaming the lifetimes for `async_trait`-generated trait methods.
| * | implement correct handling of connection close and add comment explaining ↵trinity-1686a2022-02-231-9/+54
| | | | | | | | | | | | goal of the example
| * | add drop on CustomTcpStream to catch disconnection without closetrinity-1686a2022-02-231-0/+13
| | |
| * | add example of tcp hooktrinity-1686a2022-02-231-0/+235
| | | | | | | | | | | | this required to make additional types public
* | | Merge branch 'client_builder' into 'main'Nick Mathewson2022-02-234-50/+113
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | Make a TorClientBuilder API. Closes #350 See merge request tpo/core/arti!337
| * | Documentation suggestion from review.Ian Jackson2022-02-231-1/+1
| | |
| * | Make a TorClientBuilder API.Nick Mathewson2022-02-184-50/+113
| |/ | | | | | | | | | | | | | | This is a defensive API choice to protect against the possibility that we'll want to add a bunch of other non-config options in the future. Closes #350
* / Bump anyhow minimal version to 1.0.23Ian Jackson2022-02-181-1/+1
|/ | | | | | | | | | | | | This is the first one where anyhow::Error impl AsRef<dyn StdError> We want this because we want to add error reporting functionality which works with all kinds of errors, which means we need an anyhow::Error which can be vieweed as a StdError. (The alternative would be to deref at the call sites of report_and_exit, making it less ergonomic.) anyhow 1.0.23 is from November 2019.
* Merge branch 'remaining-errors'Nick Mathewson2022-02-171-2/+11
|\
| * Rename ExitTimeout to RemoteNetworkTimeout.Nick Mathewson2022-02-171-1/+1
| |
| * arti_client: provide Kinds for all errors.Nick Mathewson2022-02-161-1/+10
| |
* | Merge branch 'eta/lazy-init' into 'main'eta2022-02-164-14/+153
|\ \ | |/ |/| | | | | | | | | arti-client: add ability to automatically bootstrap Closes #278 See merge request tpo/core/arti!322
| * arti-client: add ability to automatically bootstrapeta2022-02-164-14/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Move persistent state flush from client to circmgrYuan Lyu2022-02-151-14/+0
|/
* Merge branch 'explain_into_tor_addr' into 'main'Nick Mathewson2022-02-141-4/+25
|\ | | | | | | | | | | | | More docs for IntoTorAddr Closes #253 See merge request tpo/core/arti!305
| * More docs for IntoTorAddrNick Mathewson2022-02-141-4/+25
| |
* | Merge branch 'ticket_337' into 'main'eta2022-02-142-38/+11
|\ \ | | | | | | | | | | | | | | | | | | Simplify wait_for_bootstrap to use a Mutex. Closes #337 See merge request tpo/core/arti!308
| * | Simplify wait_for_bootstrap to use a Mutex.Nick Mathewson2022-02-142-38/+11
| |/ | | | | | | | | | | | | | | Since the only purpose of this function is to make sure that no bootstrapping task is running, a simple futures::lock::Mutex should do the job just fine. Closes #337.
* / Change deny(clippy::all) to warn(clippy::all).Nick Mathewson2022-02-141-1/+1
|/ | | | Closes #338.
* Rename bootstrap_existing to bootstrap.Nick Mathewson2022-02-112-12/+10
| | | | (Looks like this one got missed.)