summaryrefslogtreecommitdiff
path: root/crates/tor-rtmock/src/util.rs
Commit message (Collapse)AuthorAgeFilesLines
* rtcompat: new server-related members on TlsProvider trait.Nick Mathewson2026-01-291-0/+10
| | | | | These are as yet unimplemented; there's a stub type for the providers (nativetls) that won't actually have them.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-3/+3
| | | | | | | | | | | | | | 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.
* tor-rtcompat, tor-rtmock: Allow unused functions.Gabriela Moldovan2025-07-071-0/+1
| | | | These only serve as a compile-time check.
* tor-rtcompat: BlockOn: relax bounds on reenter_block_onIan Jackson2025-04-091-1/+1
| | | | The future no longer needs to be `Send + 'static`.
* AF_UNIX terminology: Rename two error structsIan Jackson2025-03-241-2/+2
| | | | | | We change `NoUnixAddressSupport` to `NoAfUnixSocketSupport` because it doesn't make much sense to talk about support for the addresses separately from support for the sockets.
* tor-rtcompat: Rename spawn_thread to spawn_blockingIan Jackson2025-03-041-2/+2
| | | | Let's use Tokio terminology here.
* tor-rt*: Apply deferred formatting churnIan Jackson2025-03-041-2/+2
| | | | rustfmt.
* tor-rtcompat: Remove ToplevelBlockon from RuntimeIan Jackson2025-03-041-2/+13
| | | | | | | | Introduce ToplevelRuntime as an alias, and use it in the top-level programs. Now none of the principal protocol implementation code has access to the executor's toplevel entrypoint, and can't call it by mistake.
* tor-rtcompat: Provide a new function for executor re-entryIan Jackson2025-03-041-0/+8
| | | | | | | | | | | | | | | Forbid re-entering the executor using ToplevelBlockOn::block_on. This was always forbidden in the case of MockExecutor, but that meant that tests using MockExecutor would malfunction if the code under test needed to re-enter the executor from sync code (since the code under test would have to use block_on, which wrong). See #1835. Provide a function which *can* do this, reenter_block_on. The MockExecutor needs to know the difference, and other runtimes may too. They are conceptually quite different operations. Introduce ToplevelRuntime as a convenience alias.
* tor-rtcompat: New plan for blocking interaction, Blocking traitIan Jackson2025-03-041-5/+5
| | | | | | | | | | | | | | | * Document the new plan for blocking interaction in the trait-level docs for the Blocking trait (used to be SpawnBlocking). Add cross-references (in some cases to not-yet-existing pieces). * Rename: spawn_blocking to spawn_thread. We're going to distinguish thread-creation (relatively expensive) from brief entry to sync code (relatively cheap, but more restricted). * Rename the SpawnBlocking trait to Blocking, and its ThreadHandle to ThreadHandle. This trait is going to gain more functionality. * Add the missing mention of `Blocking` to the docs for `Runtime`.
* tor-rtcompat: Rename BlockOn to ToplevelBlockOnIan Jackson2025-03-041-2/+2
| | | | | | | | | | We're going to distinguish top-level runtime entry, from *re*-entry to an existing executor. It is most convenient to rename this trait first. Documentation of the distinction will come later. (We're going to retain the function name `block_on`, but we want the trait to be more obviously a top-level only thing, though, so we give it a name that will hopefully avoid it peroulating throughout the codebase..)
* tor-rtcompat: Use GAT instead of RPIT in SpawnBlocking trait.Wesley Aptekar-Cassels2025-01-071-1/+3
| | | | Due to the limitations on RPIT, it's better to use a GAT for now.
* tor-rtcompat: Add spawn_blocking to Runtime trait.Wesley Aptekar-Cassels2025-01-071-1/+10
| | | | | This adds a new SpawnBlocking trait, which exposes the spawn_blocking function that tokio, async-std, and other runtimes have.
* Remove re-export of "unix" from tor_rtcompat.Nick Mathewson2024-10-291-6/+6
|
* tor-rtmock: Provide and use an mpsc::channel wrapper in tor-rtmockIan Jackson2024-10-151-0/+12
|
* rtcompat: Expose FakeStream and friends; fix compilation in tor-rtmockNick Mathewson2024-09-241-7/+4
| | | | | It turns out that these types are generally useful, and that they are in fact needed for tor-rtmock to compile without a PreferredRuntime.
* Make Runtime require NetStreamProvider<unix::SocketAddr>Nick Mathewson2024-09-241-0/+16
|
* rtcompat: Rename TcpProvider to NetStreamProvider.Nick Mathewson2024-09-241-9/+9
| | | | | | | | | | | | | | (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.)
* tls: Support export keying material (RFC 5705)David Goulet2024-06-181-0/+3
| | | | | | | | | | | | | Add a function to get the keying material as detailed by RFC 5705. Because native-tls doesn't have such support, there is a place holder panic!() for now. This means that for the forseable future, relay would only work with rustls until we figure out a solution for native-tls. Closes #1432 Signed-off-by: David Goulet <[email protected]>
* Change deftly syntax to post 0.12.1 versionIan Jackson2024-06-171-1/+1
| | | | | | | | | | | * Change `pub` to `export` * Change the `=` in define to `:` * Change `pub_template_semver_check` to `template_export_semver_check` Right now, 0.12.1 supports both syntaxes. I have verified this branch also compiles with https://gitlab.torproject.org/Diziet/rust-derive-deftly/-/merge_requests/402 ee171ffaf56d7dcb7d75584054921153fe19b222
* tor-rtmock: Remove a todo commentIan Jackson2024-04-031-5/+0
| | | | derive-deftly 0.10.x rejects unrecognised `#[deftly]` attributes.
* Switch to derive-deftlyIan Jackson2024-04-031-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the combination of a number of separate commits, many of which were generated by seddery, and then rebased and squashed. Cargo.toml perl -i~ -pe 's{^derive-adhoc}{derive-deftly = "0.10"}' crates/*/Cargo.toml (not regenerated during rebase) update Cargo.lock `cargo fetch` without --locked (regenerated during rebase) seddery git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{^use derive_adhoc}{use derive_deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bdefine_derive_adhoc\b}{define_derive_deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bAdhoc\b}{Deftly}g if m{derive}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\#\[derive_adhoc\b}{#[derive_deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{use derive_adhoc}{use derive_deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc\b}{derive_deftly_adhoc} if m{use.*deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc!}{derive_deftly_adhoc!}' (not regenerated during rebase) Manually add `#[derive_deftly_adhoc]` where needed. seddery git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\#\[adhoc\b}{#[deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc_template}{derive_deftly_template}' (not regenerated during rebase) Manually fix up an import Manually update some builder attrs Manually fix up tor_rtmock::time_core This was missed in my seddery, due to me rebasing the branch and not redoing the seddery.
* tor-rtcompat: Make Runtime imply CoarseTimeProvider, etc. (fmt)Ian Jackson2024-03-251-2/+2
|
* tor-rtcompat: Make Runtime imply CoarseTimeProvider, etc.Ian Jackson2024-03-251-0/+8
| | | | We must also impl CoarseTimeProvider for mocked runtimes.
* tor-rtmock: Use derive-adhoc for composite runtimesIan Jackson2023-07-071-48/+59
|
* tor-rtmock: statically assert that the macro makes a Runtime implIan Jackson2023-07-061-0/+6
|
* tor-rtmock: Use the same specified field for BlockOn and SpawnIan Jackson2023-07-061-4/+5
| | | | These are always the same and probably always will be.
* tor-rtmock: net: "Provide" a UDP "implementation" which doesn't workIan Jackson2023-07-061-3/+2
| | | | | | | | | | Nothing in our tree actually *uses* the UDP in tests. We want a mock UDP provider that isn't part of a real runtime, so that we can make a totally-mock runtime for properly controlled testing. It seems best to make this part of MockNetProvider rather than a separate type.
* tor-rtmock: Introduce impl_runtime_prelude (fmt)Ian Jackson2023-07-061-1/+3
|
* tor-rtmock: Introduce impl_runtime_preludeIan Jackson2023-07-061-0/+20
| | | | | This deduplicates some imports, which would otherwise be about to become triplicated.
* tor-rtmock: Introduce impl_runtime! macroIan Jackson2023-07-061-0/+98
This deduplicates some trait delegation. We want this now because we're about to introduce a third mock runtime, so this would become triplication otherwise.