| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add traits that will be returned outside tor-proto allowing us to not
expose client and relay specific channels.
The goal is for the tor-chanmgr to get those objects implementing those
traits and can build and run the reactor without knowing the specific
underlying type.
This allows us to have less code duplication and less client/relay
distinction in the chanmgr.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
| |
These are all aimed at figuring out in more detail what's going on
in #2079 and related issues.
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds the UnverifiedClientChannel and VerifiedClientChannel
mirroring the relay API for channels.
It plainly uses the generic object underneath as for now those objects
are client only.
Followup commits will make things more client specific.
No behavior change.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This only moves code from src/channel to src/client/channel.
It introduces a ClientChanBuilder that is used to launch client specific
channel by the public ChanBuilder.
The followup commits will add a VerifiedClientChannel and
UnverifiedClientChannel in order to again decouple client and relay code
from the generic objects.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
| |
Add the finish() function that for now simply calls the generic
finish(). There is a bunch of TODO in the code in this commit explaining
why we haven't made the implementation relay specific just yet.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commits takes out the relay specific code out of UnverifiedChannel
and puts it in UnverifiedRelayChannel.
In order to pull this off, we added some fiels to the VerifiedChannel
struct so the relay code get back generated data from the
UnverifiedChannel::check() in order to do its validation work and yield
a VerifiedRelayChannel.
This also lead to a cleanup of expect() and ChannelType::is_initiator().
Signed-off-by: David Goulet <[email protected]>
|
| | |
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is only done if we kept the AUTH_CHALLENGE cell and we have relay
identities. In other words, this is only when the UnverifiedChannel was
created from a RelayInitiatorHandshake.
Note: The check_internal() function is too large and should be
refactored in smaller pieces.
Note: It is also likely that we need to split UnverifiedChannel and
VerifiedChannel as it is getting client or relay members. Not great.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
| |
This implements the relay initiator side of the handshake up to the
creation of an unverified channel.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
Upcoming code for relay channels are put in the src/relay module and
thus we need visibility into some channel generic things.
Turns out also we don't need to re-export publicly UnverifiedChannel and
VerifiedChannel.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
| |
Some of these are relay-specific, so it makes more sense to pull this
into a top-level module.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
We'll need it to tell the channel padder when padding is queued.
|
| | |
|
| |\
| |
| |
| |
| |
| |
| | |
proto: Remove half-streams when they expire.
Closes #264
See merge request tpo/core/arti!3267
|
| | | |
|
| | |
| |
| |
| |
| | |
This enables us to read the CBT estimates from the circuit reactor (we
need these to compute the half-stream timeouts for #264).
|
| | | |
|
| | |
| |
| |
| |
| | |
These have all become false, except for the one about being
client-only, which is recapitulated at the crate level.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
When we want to send Replace padding (that is, padding that should
only be sent if nothing else is queued) to hop 1, we can allow it to
be replaced by cells from _any_ circuit being sent over the same
channel. (Nobody but hop 1 can tell the difference.)
Closes #2169
|
| |/
|
|
| |
We'll use this to implement `replace` for padding to the first hop.
|
| |
|
|
|
| |
This requires some annoying plumbing to make sure that the right
types wind up in the right places.
|
| |
|
|
|
|
|
|
| |
We'll need this so that we can tell the right padding machine(s)
which of them just had a queue flush.
This is not yet 100% done; the unfinished parts are marked with
XXXXs.
|
| |
|
|
|
|
|
| |
This is just code motion (I suggest reviewing with `--color-moved`).
This also moves the implementation-agnostic parts from
`tor_proto::client::circuit` to a new `tor_proto::circuit` module.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The AUTHORIZE cell command is simply reserved but not defined. The tor
specification, at this point in time, is allowing such cell before the
handshake starts but it is very unclear on what ordering is allowed nor
how many can are allowed.
C-tor silents drop them like VPADDING and so clearly unused. Instead of
dealing with it, simply remove its support but keeping its reserved
number.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Use the specification terminology which is also the same for
ChannelType.
Part of #1597
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use the ChannelFrame<> for the entirety of the outbound client handshake
that is the ClientInitiator channel type.
With this change, the codec.rs code is not needed anymore along its
CodecError as well which has been normalized onto the crate::Error
instead in order to simplify error handling and avoid duplication of
error types.
Unit tests have been modified to reflect this change of what can be done
with a channel frame. Also renamed to focus on client behavior.
Part of #1597
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
This type and functions will be used in the handshake process in future
commits.
Part of #1597
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The handler.rs file contains a generic "ChannelCellHandler" which is
split into three different handler depending of the channel state (new,
handshaking or open).
These handlers implement Encoder/Decoder so we can give a
ChannelCellHandler to a asynchronous_codec::Framed along a TLS stream.
That cell handler is also in charge of tracking the CLOG/SLOG (see
tor-spec), running digest of cells seen, which is used to authenticate a
channel for the Relay <-> Relay case.
This ChannelCellHandler auto transitions as the setters function are
used. The handshake code will use this to advance the handler. Each
handler uses a MessageFilter from msg.rs in order to allow or not to
return the message.
A keen eye will notice that we can avoid encoding a message if we don't
need but we will decode all possible messages and only then allow it or
not.
The channel cell handler is not used at this commit.
Part of #1597
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add the msg.rs file containing all the allowed message sets based on the
channel type and direction. They are also namespaced by link protocol
version.
Unused at this commit. They will be used by the channel reactor along
the channel type and link protocol version in order to know if the
message is allowed or not. See is_allowed() helper function in this
commit.
Part of #1597
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ChannelType indicates the type of channel in order to dictate which
message is allowed on it. The value use the Initiator and Responder
terminology from tor-spec documents.
At this commit, we only have client channel meaning the
"ClientInitiator" type.
In future commits, the channel type will be used by the channel reactor
to restrict which message is allowed or not.
Part of #1597
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
| |
The implementation from `tunnel` is client-specific, so we are renaming
the module accordingly. The more generic parts will be pulled into a
separate module in a future commit.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. Run cargo fix --edition
2. Selectively revert the "if let"->"match" changes.
These changes are meant to protect us from the lifetime changes
for "if let" bindings in Rust 2024.
But we're not actually relying on the old lifetime rules
anywhere, and the match syntax here is quite ugly.
3. Automatically revert `$pat:expr_2021` to `$pat:expr`.
(We don't actually want to restrict the expression syntax
that our macros accept).
Done with
`git grep -l expr_2021 | xargs perl -i -pe 's/expr_2021/expr/g;'`
4. Run cargo fmt.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
In order to pull this off, the Arc requirement needs to go away because
the Arc<ClientCirc> is now within the ClientTunnel.
This commit also has a rename of the CircuitBuilder to TunnelBuilder in
order to reflect the change that it now builds a ClientTunnel.
There is a slight rename in tor-proto as well just for accuracy.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
| |
And rename it in the process to "PendingClientTunnel".
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes the `tor-proto` logs to not be prefixed with a
channel/circuit/stream ID, but rather to have these IDs attached to the
log as structured fields.
This change is in preparation for the switch to using `TunnelId`s in the
tunnel reactor instead of circuit `UniqId`s. The reason for the change
to use structured fields is because future logs will likely need to log
the `UniqId`s of the circuits in a tunnel, which will need to either be
formatted somehow in the logs, or logged as a structured field (the
latter seems like the better option, hence this preparatory change).
IMO we should favor structured fields over formatted strings in the
logs in general, but that is a bigger project, so I am only doing a
spot fix for now.
|
| |
|
|
|
| |
We will need this to implement conflux handshake timeouts,
and to get the current time for RTT calculations.
|
| |
|
|
|
|
|
| |
The constructor for rand::distr::Uniform is now fallible,
so it makes sense to bubble up its restrictions.
This is a breaking change.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Move StreamTarget to the tunnel module and the circuit module.
From now on streams will be implemented on tunnels, not circuits.
This moves `StreamTarget` to the tunnel module. A future change will
replace `ClientCirc` with `ClientTunnel` inside `StreamTarget`.
This is mostly code motion, best reviewed with `--color-moved`.
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
| |
Closes #1690.
|