Commit Graph

46 Commits

Author SHA1 Message Date
Ian Jackson 473447a82e Run maint/add_warning to actually apply new lint allows 2023-07-10 13:49:51 +01:00
trinity-1686a 02a82ad748 make snowflake example feature-gated 2023-06-14 18:13:57 +00:00
Nick Mathewson b19eb8648f Merge branch 'pt-snowflake' into 'main'
add documentation for configuring snowflake pt

Closes #879 and #875

See merge request tpo/core/arti!1216
2023-06-11 20:59:31 +00:00
trinity-1686a b7fd5a6778 change path to snowflake client 2023-06-08 20:19:59 +02:00
Saksham Mittal 724cab8a28
Add separate example with Report 2023-06-08 10:26:38 +05:30
trinity-1686a 73b0bc3561 remove forgoten debug line 2023-06-08 01:29:33 +02:00
trinity-1686a 9c3c7f4bc3 add anchor to amp-cache link 2023-06-08 00:28:58 +02:00
trinity-1686a 925ac7f9d7 complement general documentation on bridges and pt 2023-06-07 23:59:03 +02:00
trinity-1686a 4632d4ff44 move snowflake example to dedicated file and comment it more 2023-06-07 23:59:03 +02:00
Nick Mathewson a6dd92843e Allow clippy::unchecked_duration_subtraction in tests
This panics on error, and we're fine with a panic on misbehavior in
tests.
2023-01-27 08:28:02 -05:00
Nick Mathewson bf04641c68 Disable clippy::unlinlined-format-args
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.
2023-01-27 08:27:47 -05:00
Nick Mathewson b295518a42 Spelling fixes and normalizations on some high-level crates 2022-11-07 10:21:58 -05:00
Ian Jackson 82ad9eea5f Allow "clippy::single_char_pattern" in tests.
This lint exists for perf reasons, and this is rarely relevant in
tests.

Using double quoted str is generally cognitively less burdensome.
2022-10-12 13:50:29 +01:00
Ian Jackson 23c352b96b clippy: Consolidate many lints in maint/add_warning
Found these by disabling the nightly dbg macro special case.  Now, we
have a mechanism for globally adding suppressions to tests, we can use
that instead.
2022-06-24 14:23:38 +01:00
Ian Jackson d965dc3f70 clippy: Add standard test lint block to several examples 2022-06-24 14:23:38 +01:00
Ian Jackson 3ba3b26842 rt-compat: Make all the individual runtime traits Clone+Send etc.
This will make it much more convenient for code that only wants one of
these traits (or a subset of them).  This is a good thing to support
because it will allow us to use a ZST in places that do not need an
actual async runtime handle (typically, the runtime handle is needed
only for spawn).
2022-06-08 11:24:26 +01:00
Nick Mathewson 92f0f97fe8 Merge branch 'isolation-example' into 'main'
add example for Isolation

Closes #414

See merge request tpo/core/arti!524
2022-05-24 19:34:14 +00:00
trinity-1686a 78b815e0d3 mention isolation is an advanced topic and most usage don't require implementing the trait 2022-05-24 18:25:32 +02:00
trinity-1686a b279b09b0c add example for Isolation 2022-05-23 22:40:08 +02:00
Nick Mathewson 546ae3000e Resolve the new `derive_partial_eq_without_eq` lint.
It's a little overzealous sometimes, but it's mostly to the good.
2022-05-23 12:55:37 -04:00
trinity-1686a 4a44ef56c0 add udp to runtime 2022-03-14 20:59:33 +01:00
eta 13ba0ea005 arti-client: use PreferredRuntime by default, doc cleanups
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
2022-02-28 16:41:13 +00:00
trinity-1686a f633276a91 use runtime TlsProvider in tcp-hook example 2022-02-25 13:42:14 +01:00
eta d9df4d647d Merge branch 'http-layer' into 'main'
Initial cut of hyper bindings as a library crate

See merge request tpo/core/arti!342
2022-02-24 19:48:35 +00:00
Dimitris Apostolou a3c1ba4b1a
Fix typos 2022-02-23 21:07:05 +02:00
eta 8603a90fb2 Merge branch 'custom-tcp-hook' into 'main'
add example of tcp hook

See merge request tpo/core/arti!341
2022-02-23 18:02:08 +00:00
trinity-1686a 078a91c591 add one more comment to hook-tcp 2022-02-23 18:00:35 +01:00
eta 9960064720 examples/hook-tcp: add some comments, rework lifetimes a bit
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.
2022-02-23 13:59:03 +00:00
Ian Jackson 0cf9751d7f arti-hyper: Move hyper example from arti-client
Code motion and consequential dependency adjustments.
2022-02-23 13:55:17 +00:00
trinity-1686a ce679ad72a implement correct handling of connection close and add comment explaining goal of the example 2022-02-23 13:29:37 +00:00
trinity-1686a b5707a98e7 add drop on CustomTcpStream to catch disconnection without close 2022-02-23 13:29:37 +00:00
trinity-1686a 81d7747d7b add example of tcp hook
this required to make additional types public
2022-02-23 13:29:37 +00:00
Nick Mathewson c910226b55 Make a TorClientBuilder API.
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
2022-02-18 15:28:31 -05:00
eta 790ea4af4b arti-client: add ability to automatically bootstrap
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
2022-02-16 19:29:16 +00:00
eta 882e75cd28 Allow creating unbootstrapped `TorClient`s (and `DirMgr`s)
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
2022-02-11 16:42:19 +00:00
Nick Mathewson 6f29d485e4 Make current/create functions into runtime member functions.
This should help avoid some amount of temptation towards API
proliferation.
2022-01-26 14:06:58 -05:00
Nick Mathewson 2333d0466e Rename FooRuntime to FooNativeTlsRuntime for consistency. 2022-01-26 14:06:58 -05:00
Nick Mathewson 668364d75d Unify TokioRuntime and TokioRuntimeHandle
Having separate types here doesn't justify the (very limited)
benefit of distinguishing between the case where we have created an
executor that we own and the case where we have a handle to an
already-running tokio executor.

Part of #301.
2022-01-26 14:06:58 -05:00
Neel Chauhan 439b8b3e64 Use *_with_prefs() for Option<ConnectPrefs> callers in TorClient::connect 2022-01-08 13:36:49 -08:00
Nick Mathewson 3b072c5420 Merge branch 'readme_fixes' 2021-11-30 09:12:51 -05:00
dagon 0162ea8210 Example needs to be the same as the readme 2021-11-30 09:09:42 -05:00
dagon bd1c37fe8a MR review feedback 2021-11-30 09:09:42 -05:00
Nick Mathewson f107794b74 Change sane_defaults() and with_directories()
The sane_defaults() call is now the same as you get from a default
builder: by convention, we just call that method Default::default().

The with_directories() constructor makes more sense as a constructor
for the TorClientConfigBuilder than for TorClientConfig.
2021-11-29 14:20:34 -05:00
Nick Mathewson a7f5b9aefe Allow type-complexity in hyper.rs example
This isn't the prettiest, but suppressing the warning does make
the example warning free.
2021-11-21 10:53:06 -05:00
eta dcdd8c59df Improve top-level arti-client documentation, add example code
This overhauls the top-level `arti-client` documentation significantly:

- the "Using arti-client" section walks the user through all of the
  necessary steps to initiate a Torified TCP connection, and then
  provides a code example
  - this example is also available as `examples/readme.rs`; it's not run
    as a doctest, since it involves connecting to Tor
  - a "More advanced usage" subheading provides information about stream
    isolation (and can potentially be used for other interesting
    features once we get them).
- a new "Multiple runtime support" section was added to explain the
  purpose and usage of the `tor-rtcompat` crate
- the section on design and privacy considerations was removed; this is
  probably okay to keep in a README, but users of the crate aren't going
  to be interested in this (at least I don't think)

(also, the doc comment for `arti_client::Error` was fixed to make actual
sense)
2021-10-28 19:20:42 +01:00
Nick Mathewson 7c7a388e28 Rename tor_client/arti_tor_client to arti_client.
Solves a name conflict with the existing tor_client create.

Closes #130.
2021-10-21 14:22:11 -04:00