Commit Graph

1107 Commits

Author SHA1 Message Date
Nick Mathewson 80e9785fa3 Use interned PortPolicy objects in RouterDescs too. 2021-03-29 11:11:01 -04:00
Nick Mathewson 9e0e2475b5 Netdoc: Add support for interned PortPolicy objects in MicroDescs
In C tor, this saved a whole lot of RAM.
2021-03-29 11:07:27 -04:00
Nick Mathewson 9155ac5155 Allow HS* protover names, since these are from our standard. 2021-03-29 09:58:11 -04:00
Nick Mathewson 6e5c056c6c Use Arc::clone() explicitly with port policies 2021-03-29 09:43:28 -04:00
George Kadianakis 508f4c4f39 Don't copy exit policies around; instead use Arc. 2021-03-29 09:41:18 -04:00
Nick Mathewson 2dce8fda0b Check for channel match in create_firsthop_ntor().
This way we won't even try sending the CREATE2 cell unless the
Ed25519 identity we know for the channel matches the provided
CircTarget.
2021-03-24 15:29:52 -04:00
Nick Mathewson 570840c7e1 Refactor errors in tor-decompress and tor-dirclient.
This lets us reinstate the code in dirclient that retired circuits
depending on the error type.
2021-03-24 15:14:44 -04:00
Nick Mathewson d235971ef7 dirclient: add a function to download over a stream.
Also, remove references to DataStream, and comment on the future of
the module.
2021-03-24 13:55:12 -04:00
Nick Mathewson 3a8fccf94f Add a "this crate has no timeouts" comment to tor-proto. 2021-03-24 11:18:27 -04:00
Nick Mathewson 3833ca2665 Move stream timeout logic into tor-client.
This is consistent with the other pieces of tor-proto, which do not
handle timeouts on their own.  It also lets us remove tor-rtcompat
as a dependency from tor-proto, and simplify some of the test cases
to use async_test.

This commit unindents a lot of test code; use git's "-b" flag to
read the parts that matter.
2021-03-24 11:14:07 -04:00
Nick Mathewson 06d5988cdc upgrade to newer version of config crate. 2021-03-24 09:44:31 -04:00
Nick Mathewson d073f24138 Move responsibility for knowing about TLS into tor_rtcompat.
Now we don't need runtime-specific stuff in tor-chanmgr.
2021-03-23 15:59:39 -04:00
Nick Mathewson 68f18d4fe3 Refactor tokio implpementation in tor-rtcompat.
Now other crates don't need any 'ifdef tokio' code, since there
are wrappers that implement 'futures' right.

Technically, the 'futures' traits are in some ways less good than
the tokio ones, but we need a consistent API if we want to support
WASM someday and keep support for async_std.  I'd rather hold out
hope for a future version of futures::io working like tokio than to
fix ourselves into the tokioverse forever.
2021-03-23 11:00:09 -04:00
Nick Mathewson 886788860a Add tests for correct incoming sendme handling.
At this point I'm going to pause writing tor-proto tests for a
little while and think about refactoring that could make these tests
simpler.  I'm doing way too much copy-paste here.
2021-03-22 11:50:41 -04:00
Nick Mathewson ffb4723986 Extend the begindir test to exchange data on the stream. 2021-03-19 15:12:50 -04:00
Nick Mathewson 3587809944 Introduce a helper to tor_proto::circuit tests 2021-03-19 14:47:57 -04:00
Nick Mathewson 603b0436e0 Add a compatibility layer so we can upgrade rand_core.
dalek-crypto is stuck on rand_core 0.5.1, so we've been stuck too.
This commit introduces a compatibility module so that we can wrap
new rand_core instances to make them backward compatible.
2021-03-18 13:16:32 -04:00
Nick Mathewson c2db961424 Move our command-line interface into a new crate called "arti".
Closes #106
2021-03-17 15:14:32 -04:00
Nick Mathewson a4e0dde4da Add appropriate categories to some Cargo.toml files. 2021-03-17 14:51:18 -04:00
Nick Mathewson 6daf57957d Add the tor project as an author. 2021-03-17 14:43:40 -04:00
Nick Mathewson ba14d43be4 Add keywords to each Cargo.toml 2021-03-17 14:41:02 -04:00
Nick Mathewson c8481a9354 Add a description field to all our Cargo.toml files 2021-03-17 14:31:59 -04:00
Nick Mathewson 58d8472ea0 Give it a homepage everyplace. 2021-03-17 14:13:26 -04:00
Nick Mathewson 9e28e4e7a9 Resolve unwrap() instances in tor-netdir.
This includes revising the pick_weighted() function to not panic
if its inputs are above 2^64 in total.
2021-03-16 15:00:14 -04:00
Nick Mathewson ec6ef97fc6 Change an unwrap() in llcrypto to an expect(). 2021-03-16 14:15:44 -04:00
Nick Mathewson c51a947d04 circuit: Add a test for a bad crypto handshake. 2021-03-16 14:02:48 -04:00
Nick Mathewson 83c294a90f circuit: tests for different undesired responses to EXTEND. 2021-03-16 11:50:52 -04:00
Nick Mathewson 3fb69e4a01 circuit: improve errors on bad extended2 2021-03-16 11:50:33 -04:00
Nick Mathewson 964274c9b0 Refactor circuit reactor for testing. 2021-03-16 11:49:34 -04:00
Nick Mathewson ed84f938ea Test for Channel::check_match 2021-03-16 10:41:19 -04:00
Nick Mathewson 4818d57ed7 Bump a couple of deps 2021-03-13 17:25:05 -05:00
Nick Mathewson 9f4341bbf9 Merge remote-tracking branch 'origin/mr/21' 2021-03-12 15:21:31 -05:00
George Kadianakis 97f7bc7232 Avoid a slice copy in send_relay_cell().
Convert slice to array in the parent function instead of copying.
2021-03-12 21:32:04 +02:00
Nick Mathewson 442d3d7f89 Allow spaces in command-line arguments again 2021-03-12 13:21:44 -05:00
Nick Mathewson e2ed031dfe Improve implementation of copy_interactive
Previously we'd flush after every write.  Now we only flush when the
reader has nothing more to tell us.  This way we can be sure that we're
sending out the data as soon as we can, without leaving any cells
partially filled unnecessarily.
2021-03-12 13:15:52 -05:00
Nick Mathewson a1036b01cd Remove a couple of unused deps from tor-llcrypto. 2021-03-10 16:10:56 -05:00
Nick Mathewson 49b508e5cc Avoid most regex features. 2021-03-10 16:05:33 -05:00
Nick Mathewson 9d07f4160f Only enable the `config` features we are using.
This saves us from a lot of extra backends, including an entire
extra version of serde (!).
2021-03-10 15:46:06 -05:00
Nick Mathewson 7dd92e3808 Cut down on tokio features. 2021-03-10 15:42:26 -05:00
Nick Mathewson 7b4ca6d954 Better management for END cells in streams. 2021-03-10 15:02:34 -05:00
Nick Mathewson 310f779e52 Box the buffer in DataWriterImpl. 2021-03-10 14:32:15 -05:00
Nick Mathewson 0e015675c1 Remove now-unused methods from DataStream and its allies. 2021-03-10 14:29:30 -05:00
Nick Mathewson 988dababf9 Use AsyncRead and AsyncWrite in tor-dirclient 2021-03-10 14:26:01 -05:00
Nick Mathewson 0c34badb81 Treat StreamClosed as indicating no error.
This is wrong, but less wrong than the other way around.
2021-03-10 14:25:15 -05:00
Nick Mathewson a8b158b2a6 Use AsyncRead and AsyncWrite in our proxy implementation 2021-03-10 14:16:50 -05:00
Nick Mathewson ab4c8a4df0 Make DataStream implement AsyncRead and AsyncWrite. 2021-03-10 13:06:13 -05:00
Nick Mathewson f5279b8ee4 Implement AsyncWrite for DataWriter. 2021-03-10 12:53:32 -05:00
Nick Mathewson 6a97e3ba08 Revise DataReader to implement AsyncRead.
The tricks I needed here turned out to be:

  * I needed to store the future returned by read_cell() while it is
    returning Poll::Pending.

  * Since the type of that future is secret, I needed to put it in a
    Box<dyn Future>.

  * But since that future holds a reference to the DataReader, that
    would create a self-referential structure if we tried to store
    the DataReader and the future at the same time.  So instead, I
    had to make an enum() that either holds a DataReader directly,
    or holds the future that will give us back the DataReader when
    it's done.  (I also had to change the read_cell() function so
    that it takes ownership of the DataReader, and returns it when
    it's finished.)  (Daniel Franke explained how to do this.)

  * Finally, I couldn't figure out how to change the enum's type
    in-place, so I had to wrap it in an Option<>.  (Daniel Franke
    says this isn't actually necessary.)

I've noted a couple of places in the read code where I want to
handle errors and closes more carefully.
2021-03-10 10:39:56 -05:00
Nick Mathewson 25cafff23d Rearrange DataStream code a bit and add an internal layer of indirection 2021-03-10 09:36:53 -05:00
Nick Mathewson 05aaecf2f8 Make note_ended private on RawCellStream. 2021-03-10 09:30:54 -05:00