| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
This is a workaround for an issue that I'm about to encounter
somewhere in our pile of dependencies as I add arti-rpcserver, and
somehow make serde_json visible in this test code thereby, making
the PartialEq method resolution ambiguous.
|
| |
|
|
| |
Closes #784.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
This way we don't need to worry about race conditions that happen if
the caller thinks that the handler is installed before it really is.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
This new function combines "sending a message" and "accepting
replies in a stream" into a single call, so that there is no gap
between when the message is sent and the replies are available.
There are a number of compromises here, in order to avoid API
proliferation. I've tried to contain them as best I can.
See comments for additional design discussion.
|
| | |
|
| | |
|
| |
|
|
| |
Fixes #756
|
| |
|
|
|
|
|
|
|
|
| |
This change makes sure that open streams and half-closed streams
have the same stream-type-dependent state machines with respect to
which cells are acceptable.
Fixes #774.
Fixes #769.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
We now manipulate raw relay cell bodies as (an alias for)
`Box<[u8;509]>` rather than as (an alias for) `[u8;509]`. This
enables us to do much less copying. It will become more important
soon, as we defer parsing relay cell bodies even longer.
Related to #7.
We also use SliceWriter to avoid allocating a Vec<> for every relay
message we want to encode, and instead encode directly into the
cell.
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
Unlike C tor, we treat unrecognized commands as reason to kill off
the connection entirely. That's fine; if we need to add an
unrecognized command in the future, we can use VERSIONS to negotiate
it.
Also, if someday we want this code to support relay channels as
well, we can use some type trickery to have that work too.
|
| |
|
|
| |
Thanks to rust-analyzer for making this simple.
|
| | |
|
| |
|
|
|
| |
Previously, there were some unit variants, but that makes things
quite awkward for #525.
|
| |
|
|
|
| |
This panics on error, and we're fine with a panic on misbehavior in
tests.
|
| | |
|
| |
|
|
| |
Onion services (and later, exits and caches) will need this.
|
| |
|
|
|
|
| |
This is a little tricky, but I think that we're not actually
exposing too much here. I expect we'll need to tweak this stuff
between now and our final version.
|
| |
|
|
|
| |
We will need these for onion services, to send and receive messages
of types not handled directly by the tor-proto crate.
|
| |
|
|
|
| |
The debug impl prints the handshake challenge, which we should
probably treat as sensitive.
|
| |\
| |
| |
| |
| | |
Add test lint blocks to all "mod test"
See merge request tpo/core/arti!937
|
| | |
| |
| |
| |
| | |
This is precisely the result of running the rune in
maint/adhoc-add-lint-blocks.
|
| |/ |
|
| |
|
|
| |
These are now builders.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this change, each individual identity type becomes optional.
The functions that expose them unconditionally are now in a "legacy"
trait that only some downstream types are expected to implement.
There are new convenience APIs in HasRelayIds:
* to return Option<&keytype>,
* to see if one identity-set contains another.
This commit will break several downstream crates! For the
reviewer's convenience, I will put the fixes for those crates into a
series of squash! commits on this one.
tor-netdir
----------
Revise tor-netdir to accept optional identities. This required some
caveats and workarounds about the cases where we have to deal with a
key type that the tor-netdir code does not currently recognize at
all. If we start to add more identity types in the future, we may
well want more internal indices in this code.
tor-proto
---------
In order to make tor-proto support optional identities, there were
fewer changes than I thought. Some "check" functions needed to start
looking at "all the ids we want" rather than at "the two known IDs";
they also needed to accommodate that case where we don't have an ID
that we demand.
This change will also help with bridges, since we want to be able to
connect to a bridge without knowing all of its IDs up front.
The protocol currently _requires_ the two current ID types in some
places. To deal with that, I added a new `MissingId` error.
I also removed a couple of unconditional identity accessors for
chanmgr; code should use `target().identity(...)` instead.
tor-chanmgr
-----------
This is an incomplete conversion: it does not at all handle channel
targets without Ed25519 identities yet. It still uses those
identities to index its internal map from identity to channel; but
it gives a new `MissingId` error type if it's given a channel target
that doesn't have one.
We'll want to revise the map type again down the road when we
implement bridges, but I'd rather not step on the channel-padding
work in progress right now.
tor-guardmgr
------------
This change is mostly a matter of constructing owned identity types
more sensibly, rather than unwrapping them directly.
There are some places marked with TODOs where we still depend on
particular identity types, because of how the directory protocol
works. This will need revisiting when we add bridge support here.
tor-circmgr
-----------
These changes are just relatively simple API changes in the tests.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
We want the set of identities supported by a relay to be extensible
in the future with minimal fuss; we'd also like to make working
with these ID sets more convenient. To handle that, this commit
adds a new trait for "Something that has the same IDs as a relay"
and a new object for "an owned representation of a relay's IDs."
This commit introduces a similar trait for "Something with a list of
SocketAddr, like a relay has." There's no owned equivelent for
that, since Vec<SocketAddr> is already a thing.
Closes #428.
|
| |
|
|
| |
These predate OwnedChanTarget, and are no longer needed.
|
| |
|
|
|
|
| |
Failing to encode is fundamentally different from failing to
decode. We now treat those separately, and describe _what_ we failed
to encode or decode.
|
| |
|
|
|
| |
This avoids adding additional information for now; that will come on
the next commits.
|
| | |
|
| |\
| |
| |
| |
| | |
Plumb a SleepProvider (now Clone + ....) into Channel
See merge request tpo/core/arti!569
|
| | |
| |
| |
| |
| | |
The channel reactor is going to want to be able to sleep so that it
can do padding, so it needs a SleepProvider.
|
| |/
|
|
|
|
| |
This only affects uses of thread_rng(), and affects them all more or
less indiscriminately. One test does not work with
ARTI_TEST_PRNG=deterministic; the next commit will fix it.
|
| |
|
|
|
| |
I need this so that I can expose the skew time for the directory
that a circuit will use, when I only have the circuit.
|
| |
|
|
|
| |
Remove all `use` statements for `TryFrom` and `TryInto`. These are
now redundant in Rust 2021.
|
| |
|
|
| |
Closes #415
|
| |
|
|
|
|
|
|
|
| |
Each channel now remembers an OwnedChanTarget.
Each circuit now remembers a vector of OwnedChanTarget to represent
the path that it was constructed for.
Part of #415.
|
| |
|
|
| |
This will help with #415
|
| |
|
|
| |
(We'll have a BadChanHandshake soon.)
|
| | |
|
| |
|
|
|
|
| |
This took some refactoring, and gave an opportunity to notice
a few error variants that weren't being used, or didn't mean
what they said on the tin.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
Additionally, refactor the IoError out of tor_cell::Error:
nothing in TorCell created this; it was only used by tor_proto.
This required refactoring in tor_proto to use a new error type. Here I
decided to use a new CodecError for now, though we may refactor that
away soon too.
|