summaryrefslogtreecommitdiff
path: root/crates/tor-rtcompat/src/traits.rs
Commit message (Collapse)AuthorAgeFilesLines
* Remove re-export of "unix" from tor_rtcompat.Nick Mathewson2024-10-291-1/+1
|
* rtcompat: Fix some rustdoc links.Nick Mathewson2024-09-241-1/+1
|
* rtcompat: remove async_trait from NetStreamListener.Nick Mathewson2024-09-241-2/+0
| | | | (The trait no longer has any async methods.)
* Make Runtime require NetStreamProvider<unix::SocketAddr>Nick Mathewson2024-09-241-4/+7
|
* rtcompat: Require Sync and 'static for NetStreamListener::IncomingNick Mathewson2024-09-241-1/+5
|
* rtcompat: Add ADDR parameter to NetStream{Provider,Listener}Nick Mathewson2024-09-241-11/+11
| | | | | | | | | This change will let us make a NetStreamProvider that works for AF_UNIX addresses, and for "abstract" addresses. I've decided to let this parameter have a default value of `std::net::SocketAddr` for now. We can remove the default later if we decide it's confusing.
* Documentation updates for "NetStreamProvider" renameNick Mathewson2024-09-241-15/+16
| | | | | | 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-12/+12
| | | | | | | | | | | | | | (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-3/+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-181-0/+10
| | | | | | | | | | | | | 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]>
* tor-rtcompat: Add CoarseTimeProvider to docs for Runtime traitIan Jackson2024-04-151-0/+1
| | | | I overlooked this, apparently.
* tor-rtcompat: Rename coarsetime module to coarse_timeIan Jackson2024-03-251-1/+1
| | | | | Modules with the same name as external crates don't work well with our MSRV.
* tor-rtcompat: Make Runtime imply CoarseTimeProvider, etc.Ian Jackson2024-03-251-0/+2
| | | | We must also impl CoarseTimeProvider for mocked runtimes.
* tor-rtcompat: Provide coarsetime APIs and RealCoarseTimeProviderIan Jackson2024-03-251-0/+13
|
* Fix typosDimitris Apostolou2022-12-091-1/+1
|
* tor-rtcompat: Require that TcpStream be SendIan Jackson2022-08-151-1/+1
| | | | The lack of this seems to have been an oversight.
* rt-compat: Make all the individual runtime traits Clone+Send etc.Ian Jackson2022-06-081-5/+5
| | | | | | | | 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).
* Improve documentation around Cargo features; make Runtime require Debugeta2022-05-111-0/+3
| | | | | | | | | | | | | | - arti#445 highlighted the lack of good documentation around Arti's multiple runtime support, as well as it being difficult to determine what runtime was actually in use. - Improve the documentation to solve the first problem. - To solve the second problem, make Runtime require Debug (which is arguably a good idea anyway, since it makes them easier to embed in things), and print out the current runtime's Debug information when arti is invoked with `--version`. - (It also prints out other Cargo features, too!) fixes arti#445
* Remove allow(clippy::disallowed_methods) lint.Nick Mathewson2022-03-301-1/+0
|
* Merge branch 'no-system-time' into 'main'eta2022-03-301-0/+1
|\ | | | | | | | | | | | | Don't use SystemTime::now() Closes #306 See merge request tpo/core/arti!365
| * remove most usage of SystemTime::nowtrinity-1686a2022-02-251-0/+1
| |
* | UdpSocket: remove support for connect().Nick Mathewson2022-03-181-7/+4
| | | | | | | | | | | | | | | | Currently, Arti doesn't need this. But once it does, it will be way better to have a separate type for connected sockets, rather than having to error-check every time somebody gives us a socket. Part of #410
* | add simple unit test on UDPtrinity-1686a2022-03-141-0/+2
| |
* | fix typos and minor issuestrinity-1686a2022-03-141-1/+1
| |
* | add skeleton for DNS handlingtrinity-1686a2022-03-141-2/+5
| |
* | add udp to runtimetrinity-1686a2022-03-141-0/+27
|/
* Fix rustdoc "skip this" markupIan Jackson2022-02-241-1/+1
|
* tor-rtcompat: Provide TLS wrapping for all streamsIan Jackson2022-02-241-0/+18
| | | | | | | | Now all of the runtime types we provide all impl<S> TlsProvider<S> where S: ... rather than merely TlsProvider<Self::TcpStream>. And we document and intent to perhaps require this in the future.
* Rename `SpawnBlocking` trait to `BlockOn`.Nick Mathewson2022-01-261-4/+4
| | | | | This avoids a future confusion with the new `SpawnBlocking` trait in async_executors v0.5, and better describes what the trait provides.
* More comments on the limitations of tor-rtcompat's TLS APINick Mathewson2022-01-251-3/+26
| | | | | Also, more comments on why these limitations are safe within the context of Tor, but you wouldn't want to use them elsewhere.
* Comment-only: document sni_hostname more.Nick Mathewson2022-01-251-3/+5
| | | | | Previously we expected the reader to automatically know why it was called "SNI", which really isn't fair.
* Make TlsConnector wrap TCP connections, not create its owneta2021-12-071-14/+19
| | | | | | | | | | | | | | | | | | | | `tor-rtcompat`'s `TlsConnector` trait previously included a method to create a TLS-over-TCP connection, which implied creating a TCP stream inside that method. This commit changes that, and makes the function wrap a TCP stream, as returned from the runtime's `TcpProvider` trait implementation, instead. This means you can actually override `TcpProvider` and have it apply to *all* connections Arti makes, which is useful for issues like arti#235 and other cases where you want to have a custom TCP stream implementation. This required updating the mock TCP/TLS types in `tor-rtmock` slightly; due to the change in API, we now store whether a `LocalStream` should actually be a TLS stream inside the stream itself, and check this property on reads/writes in order to detect misuse. The fake TLS wrapper checks this property and removes it in order to "wrap" the stream, making reads and writes work again.
* Improve some documentation linksNick Mathewson2021-10-291-2/+3
| | | | | | | | | Instead of putting a fully qualified name in the text, in most cases we should just use the short name of the type or function we're referring to. In other words, instead of saying [`crate::module::Foo`], we should typically say [`Foo`](crate::module::Foo).
* Clarify that new SleepProvider methods are testing-only.Nick Mathewson2021-10-261-0/+9
|
* Overhaul the way WaitFor and the MockSleepProvider worketa2021-10-261-0/+16
| | | | | | | | | | | | | | | | | | | | | Instead of racily advancing time forward, this commit attempts to rework how WaitFor works, such that it makes advances when all sleeper futures that have been created have been polled (by handing the MockSleepRuntime a Waker with which to wake up the WaitFor). The above described mechanics work well enough for the double timeout test, but fail in the presence of code that spawns asynchronous / background tasks that must make progress before time is advanced for the test to work properly. In order to deal with these cases, a set of APIs are introduced in order to block time from being advanced until some code has run, and a carveout added in order to permit small advances in time where required. (In some cases, code needed to be hacked up a bit in order to be made properly testable using these APIs; the `MockablePlan` trait included in here is somewhat unfortunate.) This should fix arti#149.
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+176
This will cause some pain for now, but now is really the best time to do this kind of thing.