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.
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.
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.
This is fairly ugly and I think I'll need to mess around with the
feature configuration a while until we get something that's pleasant
to develop with. This still seems like a good idea, though, since
we _will_ need to be executor-agnostic in the end, or we'll have no
way to handle wasm or embedded environments.
Later down the road, we'll probably want to use futures::Executor or
futures::Spawn more than having global entry points in
tor_rtcompat. That would probably make our feature story simpler.
Tokio is the default now, since tokio seems to be more heavily used
for performance-critical stuff.
This patch breaks tests; the next one will fix them, albeit
questionably.
asynchronous_codec is a fork of futures_codec that is up-to-date on
its dependencies.
This migration allows us to upgrade to the current version of the
bytes crate.
This code deviates from current tor in that it allows missing
sendme authentications only when we know we're talking to an old
relay, or when we don't know the version of the relay we're talking
to.
The protocol is now based around a message-oriented scheme intended
to use futures_codec, which in turn uses BytesMut. The transition
to BytesMut is incomplete, and we're not nearly so zero-copy as
intended. We should think about that.
Arti is a rust tor implementation. It's project I've been working
on for a few months now, in weekends and in spare time. It doesn't
speak the tor protocol yet, and it doesn't connect to the network at
all.
It needs much more documentation and testing, but I'm just about
ready to show it to others. See the README.md for a description of
what is there and what isn't.