aboutsummaryrefslogtreecommitdiff
path: root/crates/arti-client/examples
Commit message (Collapse)AuthorAgeFilesLines
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-096-0/+6
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* tor-rtcompat+misc: add `NetStreamProvider::ConnectOptions`Steven Engler2026-06-081-6/+9
| | | | | | | | | This adds the trait type `ConnectOptions` to `NetStreamProvider` and adds this `ConnectOptions` as an argument to `NetStreamProvider::connect()`. You probably want to look at the changes in tor-rtcompat first, then the rest of this commit is updating the various places we use `NetStreamProvider`.
* client: Factor out the "running a client" code into an inner typestateNick Mathewson2026-05-261-4/+3
| | | | | | We'll use this to distinguish "not running" from "running", in order to make it easier to be sure that non-bootstrapping clients will definitely not try to connect to the network.
* Merge branch 'socket-buf-size' into 'main'opara2026-05-211-6/+9
|\ | | | | | | | | | | | | Set socket buffer sizes (`SO_SNDBUF` and `SO_RCVBUF`) for proxy sockets Closes #2500 See merge request tpo/core/arti!3957
| * tor-rtcompat+misc: add `NetStreamProvider::ListenOptions`Steven Engler2026-05-071-6/+9
| | | | | | | | | | | | | | | | | | This adds the trait type `ListenOptions` to `NetStreamProvider` and adds this `ListenOptions` as an argument to `NetStreamProvider::listen()`. You probably want to look at the changes in tor-rtcompat first, then the rest of this commit is updating the various places we use `NetStreamProvider`.
* | Make all TorClient constructors wrap the TorClient in an Arc.Nick Mathewson2026-05-131-3/+4
|/ | | | | | This is part of rationalizing the structure of TorClient so we can refactor startup logic, and so that RPC code can reason about object identity. See #2469.
* arti-client: Allow collapsible_if in examplesGabriela Moldovan2026-02-161-0/+1
|
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-066-6/+6
| | | | Run maint/add_warning
* arti-client: Modified MSRV TODO for `once_cell` removalhashcatHitman2025-08-201-7/+1
| | | | | | | | | - Shortened the TODO added in a42413626abb57ad5610c8a73bfdd09ac68ac472 in the style of [this maintainer request] for consistency. [this maintainer request]: https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2953#note_3197719 Signed-off-by: hashcatHitman <[email protected]>
* arti-client example: Write rather than hide an elided lifetimeIan Jackson2025-08-111-1/+1
| | | | | | | | | | | | | | | | | | Fixes this warning. Not sure why it's not showing up in CI. --> crates/arti-client/examples/one_hop_circuit.rs:16:35 | 16 | fn find_one_hop_dir_cache(netdir: &NetDir) -> Option<Relay> { | ^^^^^^^ ----- the same lifetime is hidden here | | | the lifetime is elided here | = help: the same lifetime is referred to in inconsistent ways, making the signature confusing = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default help: use `'_` for type paths | 16 | fn find_one_hop_dir_cache(netdir: &NetDir) -> Option<Relay<'_>> { | ++++
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-1/+1
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* Clippy 1.88 fix: reformat some debug prints.Nick Mathewson2025-07-031-2/+2
|
* arti-client: Added TODO about replacing OnceCellhashcatHitman2025-04-171-0/+7
| | | | | - [`once_cell::sync::OnceCell`] should be replaced by [`std::sync::OnceLock`] once the blocking methods are stabilized and within our MSRV.
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-1/+1
| | | | - `rand::thread_rng()` has been deprecated and renamed to `rand::rng()`
* tor-rtcompat: Add the ability to get a StreamOps handle.Gabriela Moldovan2025-01-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | Needed for cases where we wrap an object that implements `StreamOps` in an external type, thereby losing access to the `StreamOps` functionality. For example, during the channel handshake, we `.split()` the stream that implements `StreamOps`, which leaves us with a `SplitSink` and a `SplitStream`, neither of which implement `StreamOps`. Getting a handle to the underlying object that implements `StreamOps` (for example, a file handle) *before* the stream is `.split()` enables us to use `StreamOps` to manipulate the underlying split stream. This commit also introduces a special `UnsupportedStreamOpsHandle`, which is a type that implements `StreamOps`, but always returns an error. This type is meant to simplify error handling and usage, and is meant to be used in cases where `StreamOps` is not supported. TODO: the name of this type is pretty confusing (it's very similar to `UnsupportedStreamOp`, which is an error type), and should probably be renamed to something else (`NoOpStreamOpsHandle`, `BrokenStreamOpsHandle`, `DummyStreamOpsHandle` come to mind...). Note: this changes the `StreamOps` trait to be slightly different from what I originally envisioned in !2660 and #1769
* tor-rtcompat: Require NetStream{Listener,Provider} streams to impl StreamOps ↵Gabriela Moldovan2024-12-101-2/+6
| | | | (fmt).
* tor-rtcompat: Require NetStream{Listener,Provider} streams to impl StreamOps.Gabriela Moldovan2024-12-101-1/+8
| | | | Part of #1769
* Disable a lot of dead code warningsIan Jackson2024-10-171-0/+3
| | | | | | | Now cargo check --workspace --no-default-features --all-targets cargo build -p arti --no-default-features --features=memquota,tokio,native-tls are both clean.
* Documentation updates for "NetStreamProvider" renameNick Mathewson2024-09-241-2/+2
| | | | | | Stop referring to TCP streams in its documentation; update other documentation to refer to NetStreamProvider rather than TcpProvider.
* rtcompat: Rename TcpProvider to NetStreamProvider.Nick Mathewson2024-09-241-10/+10
| | | | | | | | | | | | | | (And similarly rename TcpListener to NetStreamListener, along with their TcpStream/TcpListener associated types.) These types are about to become generic over addresses, and therefore shouldn't be named after TCP. Renaming was done mostly with Rust Analyzer, except for some macros that needed to be hand-edited. (I'll revise the comments in the next commit; this one is all about renaming.)
* rtcompat: Remove accept() from TcpListenerNick Mathewson2024-09-241-33/+0
| | | | | | | | | | It's redundant with the incoming() method (which turns the TcpListener into a Stream of connections), and nothing actually used it outside of tests. Removing this method allows us to simplify our TcpListener code a good deal, as can be seen by some of the implementations we removed from our example and testing code.
* rtcompat: Add an extension trait for building modified RuntimesNick Mathewson2024-09-241-2/+2
| | | | | | | With this extension trait, we no longer need to construct `CompoundRuntime` directly outside of tor-rtcompat. This in turn will make it a little less painful when we have to add more generics to CompoundRuntime.
* Fix typosDimitris Apostolou2024-09-031-1/+1
|
* arti-client: Add one-hop circuit examplejuga2024-05-151-0/+65
| | | | Co-authored-by: gabi-250 <[email protected]>
* Adjust examples lints using add_warningNick Mathewson2024-05-076-18/+18
|
* tor-rtcompat: CompoundRuntime: Add a CoarseTimeProvider, and implIan Jackson2024-03-251-1/+1
| | | | | | In all the uses in-crate, this is just a RealCoarseTimeProvider. Now all the compound runtimes impl CoarseTimeProvider.
* Rename ManagedTransportConfig to TransportConfig.Nick Mathewson2024-03-141-2/+2
| | | | We're going to start using this type for _every_ kind of transport.
* Add unknown-lints exception to examplesNick Mathewson2024-03-136-1/+6
| | | | | We need this to avoid warnings when runnning non-nightly clippy on these examples.
* Run maint/add_warning.Nick Mathewson2024-03-136-0/+6
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-236-0/+6
|
* arti-client: fix conditional unused_import and dead_code warningsNick Mathewson2023-08-161-2/+2
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-106-0/+6
|
* make snowflake example feature-gatedtrinity-1686a2023-06-141-5/+13
|
* Merge branch 'pt-snowflake' into 'main'Nick Mathewson2023-06-111-0/+100
|\ | | | | | | | | | | | | add documentation for configuring snowflake pt Closes #879 and #875 See merge request tpo/core/arti!1216
| * change path to snowflake clienttrinity-1686a2023-06-081-1/+2
| |
| * remove forgoten debug linetrinity-1686a2023-06-081-1/+0
| |
| * add anchor to amp-cache linktrinity-1686a2023-06-081-1/+1
| |
| * complement general documentation on bridges and pttrinity-1686a2023-06-071-0/+2
| |
| * move snowflake example to dedicated file and comment it moretrinity-1686a2023-06-071-0/+98
| |
* | Add separate example with ReportSaksham Mittal2023-06-081-0/+67
|/
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-274-0/+4
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* Disable clippy::unlinlined-format-argsNick Mathewson2023-01-272-8/+4
| | | | | | | | 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.
* Spelling fixes and normalizations on some high-level cratesNick Mathewson2022-11-071-2/+2
|
* Allow "clippy::single_char_pattern" in tests.Ian Jackson2022-10-124-0/+4
| | | | | | | This lint exists for perf reasons, and this is rarely relevant in tests. Using double quoted str is generally cognitively less burdensome.
* clippy: Consolidate many lints in maint/add_warningIan Jackson2022-06-244-0/+12
| | | | | | 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.
* clippy: Add standard test lint block to several examplesIan Jackson2022-06-244-0/+24
|
* rt-compat: Make all the individual runtime traits Clone+Send etc.Ian Jackson2022-06-081-0/+1
| | | | | | | | 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).
* Merge branch 'isolation-example' into 'main'Nick Mathewson2022-05-241-0/+198
|\ | | | | | | | | | | | | add example for Isolation Closes #414 See merge request tpo/core/arti!524
| * mention isolation is an advanced topic and most usage don't require ↵trinity-1686a2022-05-241-0/+3
| | | | | | | | implementing the trait
| * add example for Isolationtrinity-1686a2022-05-231-0/+195
| |