Commit Graph

4689 Commits

Author SHA1 Message Date
Nick Mathewson 60ff67113f Initial error cleanup on streams/circuits 2020-09-25 08:35:48 -04:00
Nick Mathewson f945af0c41 Document private members in most crates 2020-09-24 19:25:37 -04:00
Nick Mathewson 18b13e8cae Migrate ClientMain to byte-oriented API. 2020-09-24 18:56:54 -04:00
Nick Mathewson 50848b8fa0 Try to make a send/receive style API for streams. 2020-09-24 18:03:03 -04:00
Nick Mathewson da3a8fdd50 Add support for RELAY_END cells.
This was a hard one.  I need to make sure that we send an END cell
when the stream is dropped.  But we can't call an .await from inside
the drop() function, since drop() isn't async, and we don't have an
executor.

Fortunately, you can call send() on a oneshot::Sender without having
to await on it, so that's the obvious thing to put in drop().  But
we need some way to make sure that the oneshot::Receiver is given to
the reactor, and is .awaited.  For that, we needed a control
channel.  And the reactor needs to treat the control channel and the
close messages as equally important.

So that's how I wound up with a
  Fuse<Select<mpsc::Receiver<Result<Foo>>,
              SelectAll<Once<oneshot::Receiver<Foo>>>>>.

I doubt that this is actually the best way to handle any of this!
2020-09-24 15:33:54 -04:00
Nick Mathewson 9e8350aea0 as Tor does, skip to random initial stream member. 2020-09-23 19:50:15 -04:00
Nick Mathewson c35477bb3d Fuse input streams on creation. 2020-09-23 19:21:49 -04:00
Nick Mathewson 6492334aff Turn IdMap into an extension trait.
Also, use the "right" (cyclic, potentially expensive) algorithm for
stream IDs.
2020-09-23 17:53:58 -04:00
Nick Mathewson bf7672cb77 A few tests for tor-linkspec 2020-09-23 16:47:37 -04:00
Nick Mathewson 49829b49b7 Tests (and correctness fixes) for protover. 2020-09-22 22:39:01 -04:00
Nick Mathewson 06a39719c5 Add tests for SignatureGated 2020-09-22 20:50:35 -04:00
Nick Mathewson e592fff4a2 Tests for Timerangebound. 2020-09-22 20:37:08 -04:00
Nick Mathewson 7130d87d7c Run cargo fix --edition-idioms 2020-09-21 13:50:47 -04:00
Nick Mathewson 0c131dc080 Run cargo upgrade 2020-09-21 13:45:36 -04:00
Nick Mathewson d96a949cb3 Update documentation 2020-09-21 13:43:58 -04:00
Nick Mathewson d5d11d6923 Update TODO file 2020-09-21 13:14:21 -04:00
Nick Mathewson 3eb087bf16 turn hopnum into a first-class type 2020-09-21 12:56:30 -04:00
Nick Mathewson c276cfcb73 Add is_zero for ID types. 2020-09-21 12:27:45 -04:00
Nick Mathewson fb7703f7e9 Fix some errors; document some places where error handling is bogus 2020-09-21 12:22:35 -04:00
Nick Mathewson 68fc1b0f4d More documentation for channel, circuit, stream. 2020-09-21 12:10:51 -04:00
Nick Mathewson bc00417f01 Start implementing streams and circuit-level reactors.
Also, revise nearly all of the circuit/channel interaction to
actually send relay cells to the right place and do sensible things
with them.
2020-09-21 10:42:36 -04:00
Nick Mathewson 296bfbe57b Add RelayCmd::accepts_streamid_val 2020-09-20 14:09:10 -04:00
Nick Mathewson 9567689a30 Refactor accetps_circid_val to be less wonky. 2020-09-20 14:09:10 -04:00
Nick Mathewson a3384bc126 Move is_recognized function into caret. 2020-09-20 14:09:10 -04:00
Nick Mathewson a547cda19f Rename StreamCmd to RelayCmd 2020-09-20 14:09:10 -04:00
Nick Mathewson c6d403472f Improve shutdown support for channel. No idea if it works. 2020-09-20 14:09:10 -04:00
Nick Mathewson 9c4685968c rename a field in RelayCell 2020-09-20 14:09:10 -04:00
Nick Mathewson 988556dbef Create a StreamID->Stream map type.
Also extract the shared part of CircMap and StreamMap into a new
IdMap type.
2020-09-20 14:09:10 -04:00
Nick Mathewson 0075b784a1 De-parameterize channel and circuit
By putting the cell-sink in a box, we can get rid of the need for
having everything that uses a channel or a circuit know what kind
of underlying TLS implementation it has.
2020-09-19 22:29:18 -04:00
Nick Mathewson 56d8bc1756 Add tests for CREATE_FAST handshake 2020-09-19 13:06:40 -04:00
Nick Mathewson 80d1d27810 Add tests for failing ntor handshakes. 2020-09-19 12:37:17 -04:00
Nick Mathewson 389fc03e1e ntor: test the ClientHandshake/ServerHandshake impl 2020-09-18 21:20:22 -04:00
Nick Mathewson 3907e4a0c9 tests for kdf functions in tor_proto 2020-09-18 20:57:56 -04:00
Nick Mathewson 69e1c91ba1 Add tests for tor_proto::util::ct 2020-09-18 20:00:06 -04:00
Nick Mathewson 5f54be2234 Give up on suppressing that nightly-only clippy warning 2020-09-18 19:28:55 -04:00
Nick Mathewson 5e1e77a363 Make consensus documents valid DistDelay seconds earlier.
This will prevent arti from hitting the same issue as
https://gitlab.torproject.org/tpo/core/tor/-/issues/25756
2020-09-18 19:24:06 -04:00
Nick Mathewson 6a2c803f98 Resolve some nightly-only clippy warnings 2020-09-17 19:13:56 -04:00
Nick Mathewson eb24b6f019 Fix a panic bug in microdesc parsing.
Found by fuzzing!  The issue was that we were relying on the
arguments slice being within the input string, but we were sometimes
using a different _empty_ slice when there were no arguments.

I've noted a better solution in a comment.
2020-09-17 19:07:38 -04:00
Nick Mathewson 91db8ab6fb Add fuzzers for certs, netdoc, and proto.
This was remarkably simple.
2020-09-17 19:06:56 -04:00
Nick Mathewson f256847f82 Sort linkspecs in the same order as tor does 2020-09-17 15:33:18 -04:00
Nick Mathewson ba546a798d use more correct expiration times 2020-09-17 15:19:12 -04:00
Nick Mathewson e3a524a659 More tests for tor_bytes::impl 2020-09-15 11:39:09 -04:00
Nick Mathewson 94792f583b tor_bytes: Remove an extraneous println 2020-09-15 11:26:44 -04:00
Nick Mathewson af7052657e bytes: add tests for impl.rs 2020-09-15 11:06:58 -04:00
Nick Mathewson 054a5e5582 bytes: add tests for Writer trait 2020-09-14 18:25:50 -04:00
Nick Mathewson 294f2a5241 bytes: more test for Reader. 2020-09-14 18:05:47 -04:00
Nick Mathewson 963ab969cf Add test for failing RSA identity construction 2020-09-13 17:44:34 -04:00
Nick Mathewson 41ca4eb154 Add some test vectors for rsa, taken from chutney 2020-09-13 17:39:01 -04:00
Nick Mathewson 9a94f11938 Now that the rsa crate has pkcs1 decoding, use it.
Also, instead of implementing an otherwise-derivable Hash for rsa
public keys, tell clippy not to worry that we're defining
partialeq but not hash.
2020-09-13 17:37:11 -04:00
Nick Mathewson 3d5f8cfec5 update wishlist: the rsa crate now supports oaep 2020-09-13 13:05:07 -04:00