summaryrefslogtreecommitdiff
path: root/crates/tor-rtmock/src/net.rs
Commit message (Collapse)AuthorAgeFilesLines
* rtmock: Implement server support.Nick Mathewson2026-01-291-10/+44
|
* rtcompat: new server-related members on TlsProvider trait.Nick Mathewson2026-01-291-1/+6
| | | | | These are as yet unimplemented; there's a stub type for the providers (nativetls) that won't actually have them.
* rtcompat: new own_certificate method on CertifiedConn traitNick Mathewson2026-01-291-0/+6
|
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* 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.
* *: use std::io::Error::other in many placesNick Mathewson2025-05-151-4/+1
| | | | | | | 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.
* tor-rtcompat: Rename UnsupportedStreamOps to NoOpStreamOpsHandle.Gabriela Moldovan2025-01-151-1/+1
| | | | | This renames UnsupportedStreamOpsHandle to NoOpStreamOpsHandle for clarity (the old name kind of sounded like the name of an error type).
* tor-rtmock: Implement StreamOps for MockTlsStream (fmt).Gabriela Moldovan2025-01-151-1/+3
|
* tor-rtmock: Implement StreamOps for MockTlsStream.Gabriela Moldovan2025-01-151-1/+14
| | | | | We're about to add a trait bound that forces `MockTlsStream` to impl `StreamOps`.
* tor-rtmock: Provide and use an mpsc::channel wrapper in tor-rtmockIan Jackson2024-10-151-1/+2
|
* tor-rtmock: Simplify two cfgIan Jackson2024-10-081-1/+0
| | | | | | Discussion here https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2502#note_3090554 https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2502#note_3090556
* tor-rtmock: miri: disable tests that use wallclock timeIan Jackson2024-10-081-0/+3
|
* rtcompat: remove async_trait from NetStreamListener.Nick Mathewson2024-09-241-1/+0
| | | | (The trait no longer has any async methods.)
* Documentation updates for "NetStreamProvider" renameNick Mathewson2024-09-241-2/+3
| | | | | | 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-7/+7
| | | | | | | | | | | | | | (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-15/+7
| | | | | | | | | | 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/+12
| | | | | | | | | | | | | 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]>
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* clippy: Use Result::cloned in several placesIan Jackson2024-01-311-1/+1
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Add exceptions for some cases of diverging_sub_expressionNick Mathewson2023-07-101-0/+1
| | | | | | | | See here for documentation on the lint: https://rust-lang.github.io/rust-clippy/master/index.html#/diverging_sub_expression The issue here, from what I can tell, is that the lint triggers whenever you use a diverging expression as a function body within an
* tor-rtmock: Net: Make UDP sockets un-constructableIan Jackson2023-07-061-14/+15
| | | | | | | | This will hopefully mean anyone trying to use this will notice that it's not implemented. Prompted by: https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1375#note_2919925
* tor-rtmock: impl Default for MockNetProviderIan Jackson2023-07-061-0/+6
|
* tor-rtmock: impl Default for MockNetProvider (prep)Ian Jackson2023-07-061-3/+2
| | | | | | We want MockNetProvider to be Default. In this commit: impl Default for MockNetwork and use it in new().
* tor-rtmock: net: "Provide" a UDP "implementation" which doesn't workIan Jackson2023-07-061-0/+44
| | | | | | | | | | 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.
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+8
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* Improve documentation around Cargo features; make Runtime require Debugeta2022-05-111-0/+8
| | | | | | | | | | | | | | - 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
* rtmock: add the ability to make a connection time out.Nick Mathewson2022-04-021-6/+29
|
* Make test_with_all_runtimes cover _all_ the runtimes.Nick Mathewson2022-01-261-8/+10
| | | | | | | | | | | This took some refactoring, so that I wouldn't need to define 9 different versions of the function. It also required that we change the behavior of test_with_all_runtimes slightly, so that it asserts on _any_ failure rather than asserting on most but returning Err() for others. That in turn required changes to a few of its callers. There's probably a better way to do all of this macro business, but this is the best I could find.
* Make TlsConnector wrap TCP connections, not create its owneta2021-12-071-40/+25
| | | | | | | | | | | | | | | | | | | | `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.
* Resolve roughly half of the XXXXs.Nick Mathewson2021-12-061-2/+3
| | | | | | | | We want to only use TODO in the codebase for non-blockers, and open tickets for anything that is a bigger blocker than a TODO. These XXXXs seem like definite non-blockers to me. Part of arti#231.
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-0/+1
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+660
This will cause some pain for now, but now is really the best time to do this kind of thing.