| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The codebase uses `r` sometimes and `b` at other times.
Making this consistent makes widespread changes easier, and is
clearer for humans.
I think `b` is better than `r` because `r` might be "return".
It is indeed used that way in a couple of places in reader.rs, even.
I haven't changed *everywhere*, just Readable impls (where `r` is
particularly likely to be "return value") and occurrences in
tor-bytes.
No functional change.
|
| |
|
|
|
|
| |
The old code produced a warning from clippy nightly; we may as well
update to use the new associated consts. (They've been there since
Rust 1.4x.)
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
When using the `arti-client` crate in other contexes, the Rust compiler
sometimes has difficulties with determining the current type in this
particular case, due to a collision with the popular serde json crate,
which also provides an implementation for converting u8.
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
This changes the internal representation to be `NonZeroU32` instead of
just `u32`.
Various places where a circuit ID is optional now use `Option<CircId>`.
Fixes a bug in `CircIdRange::sample` that would previously return a
circuit ID of 0, when the rng returned 0x8000_0000 for a low range.
|
| | |
|
| | |
|
| |
|
|
| |
Closes #872
|
| | |
|
| |
|
|
|
| |
This will make it ergonomic to decode a single body type without
having to declare a variant that accepts only a single message.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
Actually, to avoid making a breaking change, I'm deprecating
BadMessage and creating a new InvalidMessage variant that takes a
Cow. This way I don't need to track every crate that re-exposes
tor_bytes::Error and call this a breaking change in those.
Making this change will allow tor_bytes errors to be much more
helpful.
|
| |
|
|
|
| |
It's now redundant, since `restricted_msg!` defines From and Into
for us.
|
| |
|
|
| |
This allows us to remove a shenanigan from `restricted_msg!{}`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Every FooMsg type now implements Into<AnyFooMsg>, and
TryFrom<FooMsg>.
Additionally, it now implements From<X> for every distinct type that
it supports. This last part lets us discard a bunch of code.
Unfortunately, I needed some downright hackish trickery in order to
get these macros to avoid generating `From<AnyFooMsg> for AnyFooMsg`
and conflicting with the blanket implementation.
The trickery to deal with RelayEarly and Relay being the same type
was not necessarily worth it; I will be separating them and removing
said trickery in the next commit.
|
| |
|
|
|
|
|
| |
This change lets us use ChannelCodec to encode and decode any
restricted channel message type we want. (Later on, we'll turn the
related Codec class in tor-proto into a more type-restricted version
of this.)
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
Doing this will make it much easier to implement a macro that
generates restricted instances of the Msg types (for #525).
The Body change is a breaking change. I don't think anybody else
implements Body, but in theory they could.
|
| |
|
|
|
|
|
| |
These are generalizations of RelayCell and ChanCell respectively,
that allow using an arbitrary message type in place of the fully
general RelayMsg and ChanMsg types. Doing this is a prerequisite
for usefully implementing arti#525.
|
| |
|
|
|
| |
This panics on error, and we're fine with a panic on misbehavior in
tests.
|
| |\
| |
| |
| |
| | |
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.
|
| |/ |
|
| | |
|
| |\
| |
| |
| |
| | |
tor-cell: Rename for_client and for_relay
See merge request tpo/core/arti!793
|
| | |
| |
| |
| |
| |
| |
| | |
This commit renames the for_client and for_relay functions to
from_client and from_relay respectively, in order to indicate their
origin, as the term "for" is more likely to indicate a destination,
which is not true in that situation.
|
| |\ \
| | |
| | |
| | |
| | | |
tor-cell: Fix typos in msg.rs
See merge request tpo/core/arti!788
|
| | |/ |
|
| |\ \
| | |
| | |
| | |
| | | |
tor-cell: Remove redundant match clauses
See merge request tpo/core/arti!792
|
| | |/
| |
| |
| |
| | |
This commit removes two redundant match clauses inside the
take_one_netinfo_addr function found inside msg.rs.
|
| |\ \
| | |
| | |
| | |
| | | |
tor-cell: Make historical comments more concrete
See merge request tpo/core/arti!787
|
| | |/
| |
| |
| |
| | |
This commit extends comments that make references to historical protocol
versions of Tor, by adding the concrete protocol version numbers.
|
| |\ \
| | |
| | |
| | |
| | | |
tor-cell: Avoid redundant pointer copy
See merge request tpo/core/arti!791
|
| | |/
| |
| |
| |
| |
| | |
This commit changes an iteration by copying a u16 (which is 2 bytes)
instead of a pointer address, which is most likely 8 bytes on most
machines.
|
| |\ \
| | |
| | |
| | |
| | | |
tor-cell: Avoid redundant allocation
See merge request tpo/core/arti!790
|
| | |/
| |
| |
| |
| |
| | |
This commit changes the way how a vector with a known sized gets
allocated, by using Vec::with_capacity() instead of Vec::new().
It will eventually avoid an allocation of more memory than required.
|
| |/
|
|
|
|
| |
This commit renames the fixed_len! macro to fixed_len_handshake!, in
order to indicate, that this macro is only suited for cells with
commands related to handshaking.
|
| | |
|
| | |
|
| |
|
|
|
| |
These have the unit in the type. Putting that in the field name too
is otiose.
|
| |
|
|
|
| |
This allows test cases to describe precisely the contents of the
negotiation cell ought to be generated.
|
| |
|
|
|
| |
As proposed in
https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/77
|
| |
|
|
|
| |
This gets rid of some random hardcoded literals. We're going to want
to reuse this, too.
|
| |
|
|
|
|
|
|
| |
We don't really want the caller to pass ignored timeout parameters.
And this makes more semantic sense.
The stop constructor uses zero, which is what C Tor does. See
https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/76
|
| |
|
|
|
|
|
|
| |
This will be convenient for managing when to send these negotiation
messages.
While we're here, edit the comment to explain how this is (going to
be) used.
|