summaryrefslogtreecommitdiff
path: root/crates/tor-rtcompat/src/impls
Commit message (Collapse)AuthorAgeFilesLines
* opentelemetry: Add some instrument macros.Wesley Aptekar-Cassels2025-09-242-0/+4
| | | | | I've added these in places that are useful for the debugging that I've been doing.
* Merge branch 'smol-add-impl-in-tor-rtcompat' into 'main'opara2025-08-213-2/+262
|\ | | | | | | | | smol: Implement smol in tor-rtcompat See merge request tpo/core/arti!2986
| * smol: Implement smol in tor-rtcompatNiel Duysters2025-08-213-2/+262
| |
* | Document why we are using ring with rustlsNick Mathewson2025-08-191-3/+21
|/ | | | See #1977, #2122.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-2/+2
| | | | | | | | | | | | | | 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.
* Merge branch 'windows_warnings' into 'main'opara2025-08-052-0/+3
|\ | | | | | | | | Fix Windows compile warnings See merge request tpo/core/arti!3114
| * Fix Windows compile warningsTobias Stoeckmann2025-08-052-0/+3
| | | | | | | | | | Use unix-specific crates only if needed and suppress clippy warnings of unused variables if their usage is unix-specific.
* | Fix errors from rustdoc nightly.Nick Mathewson2025-08-051-1/+1
|/
* tor-rtcompat: Remove rustls dependency in favor of futures-rustlsparazyd2025-06-061-1/+1
| | | | | | | | | | futures-rustls provides and re-exports rustls and thus the rustls dependency is redundant. Additionally, this removes `aws-lc-rs` and its inherent dependencies from `Cargo.lock` and the entire project since they've been included because the rustls dependency did not use `default-features = false` and rustls by default now depends on `aws-lc-rs` as its crypto engine.
* rtcompat: remove Letsencrypt/Rustls kludgeretort-dev2025-05-203-48/+13
|
* *: use std::io::Error::other in many placesNick Mathewson2025-05-152-7/+4
| | | | | | | The `IoError::other` function is an easier way to say `IoError::new(IoErrorKind::Other, ...)`. It's been around since 1.74, but clippy started warning about the more verbose version in 1.87.
* Allow StreamOps import to be unusedNick Mathewson2025-04-091-0/+1
| | | | | This comes up on OSX; I hadn't seen it before, so I assume it is new with Rust 1.86.
* AF_UNIX terminology: Rename two error structsIan Jackson2025-03-242-5/+5
| | | | | | 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.
* Fix AF_UNIX terminology in docs, comments, and error messagesIan Jackson2025-03-241-1/+1
|
* Merge branch 'x509-signature-yeet' into 'main'Nick Mathewson2025-03-054-117/+97
|\ | | | | | | | | | | | | Switch from x509-signature to rustls-webpki when using rustls. Closes #1824 and #1854 See merge request tpo/core/arti!2816
| * rustls: move provider-installer to its own function.Nick Mathewson2025-03-041-13/+21
| | | | | | | | | | We do this so that we can make sure there's a provider installed when we run the tests.
| * rustls.rs: Replace x509-signature with rustls-webpkiNick Mathewson2025-03-044-101/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The x509-signature crate is archived, and won't see any more releases. Using it is tying us to ring 0.16 internally, which means we depend on two ring versions. Fortunately, rustls-webpki relaxes some of the earlier restrictions from the vanilla webpki crate, which means that its certificate parser now accepts C tor's oddball x509 certificates as valid. With this change, we can delegate to rustls's built-in signature-checking code, and we only have to override its certificate validation. (We still override it with a pile of comments about how we don't validate link certificates much.) I've had to include a few certificates: two are for tests, but one is needed as a placeholder, since we can't construct a rustls certificate validator without a root cert, even if we'll never use it. Closes #1824. Closes #1854.
| * rtcompat: Un-rename CertificateDer type.Nick Mathewson2025-03-041-6/+8
| | | | | | | | (We had added this rename when rustls renamed it originally.)
* | tor-rtcompat: Rename spawn_thread to spawn_blockingIan Jackson2025-03-042-2/+2
| | | | | | | | Let's use Tokio terminology here.
* | tor-rtcompat: Provide Blocking::blocking_ioIan Jackson2025-03-041-0/+10
| | | | | | | | | | | | | | | | | | This was referenced and explained from the docs, but didn't exist yet. Here it is. Everyone except the Tokio glue, and the CompoundRuntime, just use the default implementation in terms of spawn_thread. spawn_thread has a more relaxed contract, so this is correct.
* | tor-rtcompat: Provide a new function for executor re-entryIan Jackson2025-03-042-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-042-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-042-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: Fix doc warning.Gabriela Moldovan2025-01-151-1/+1
|
* tor-rtcompat: Big invasive change adding StreamOps bound everywhere.Gabriela Moldovan2025-01-152-4/+4
| | | | | | This is unfortunately necessary, because after the channel handshake, we need to give the channel reactor a `StreamOps` handle to the underlying stream.
* tor-rtcompat: Implement StreamOps for TLS stream types.Gabriela Moldovan2025-01-152-1/+22
|
* tor-rtcompat: Implement new_handle() using TcpSockFd.Gabriela Moldovan2025-01-152-1/+7
|
* tor-rtcompat: Add the ability to get a StreamOps handle.Gabriela Moldovan2025-01-152-1/+42
| | | | | | | | | | | | | | | | | | | | | | | 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: Use GAT instead of RPIT in SpawnBlocking trait.Wesley Aptekar-Cassels2025-01-072-2/+6
| | | | 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-072-0/+21
| | | | | This adds a new SpawnBlocking trait, which exposes the spawn_blocking function that tokio, async-std, and other runtimes have.
* streamops: Resolve unused-variable warnings.Nick Mathewson2024-12-121-1/+1
|
* tor-rtcompat: Replace bad_api_usage with UnsupportedStreamOp (fmt).Gabriela Moldovan2024-12-103-5/+17
|
* tor-rtcompat: Replace bad_api_usage with UnsupportedStreamOp.Gabriela Moldovan2024-12-103-17/+6
|
* tor-rtcompat: Add tests for set_tcp_notsent_lowat.Gabriela Moldovan2024-12-101-0/+60
|
* tor-rtcompat: Implement StreamOps for all the stream types.Gabriela Moldovan2024-12-103-4/+81
| | | | Part of #1769
* Remove re-export of "unix" from tor_rtcompat.Nick Mathewson2024-10-292-10/+13
|
* rtcompat: Expose FakeStream and friends; fix compilation in tor-rtmockNick Mathewson2024-09-241-76/+0
| | | | | It turns out that these types are generally useful, and that they are in fact needed for tor-rtmock to compile without a PreferredRuntime.
* rtcompat: Fix some rustdoc links.Nick Mathewson2024-09-241-2/+1
|
* rtcompat: remove async_trait from NetStreamListener.Nick Mathewson2024-09-242-2/+0
| | | | (The trait no longer has any async methods.)
* rtcompat: Require Sync and 'static for NetStreamListener::IncomingNick Mathewson2024-09-241-1/+1
|
* rtcompat: NetStreamProvider<unix::SocketAddr> for non-unix platformsNick Mathewson2024-09-243-0/+83
| | | | | | | Since there is no way to construct a unix::SocketAddr on these platforms, it's harmless to provide an implementation for NetStreamProvider. What's more, doing so greatly simplifies our AbstractAddr implementation.
* Implement NetStramProvider<Unix> for async_std.Nick Mathewson2024-09-241-0/+23
|
* async_std: Perpare macro for use with Unix streams.Nick Mathewson2024-09-241-33/+33
|
* async_std: start a macro to implement wrappers for stream typeNick Mathewson2024-09-241-71/+79
| | | | | As before, this commit does nothing interesting: it's a separate commit because it reindents a lot of code.
* rtcompat: Implement NetStreamProvider<Unix> for tokio.Nick Mathewson2024-09-241-4/+60
|
* tokio: Perpare macro for use with Unix streams.Nick Mathewson2024-09-241-24/+31
|
* tokio: start a macro to implement wrappers for stream typeNick Mathewson2024-09-241-67/+74
| | | | | This commit does nothing interesting yet: it's a separate commit because it reindents a lot of code.
* rtcompat: Rename TcpProvider to NetStreamProvider.Nick Mathewson2024-09-242-14/+14
| | | | | | | | | | | | | | (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-242-7/+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.
* tls: Support export keying material (RFC 5705)David Goulet2024-06-182-0/+32
| | | | | | | | | | | | | 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]>