Commit Graph

399 Commits

Author SHA1 Message Date
Nick Mathewson 2ab5348ab2 Remove semver.md files. 2023-03-31 09:24:41 -04:00
Nick Mathewson 9ef115a7fb Patchlevel bumps for crates whose dependencies just changed.
These crates had no changes until just a moment ago. But since
we updated the versions on some of their dependents, they have now
changed themselves.  Thus they get patchlevel bumps.

```
tor-rtmock
tor-protover
tor-socksproto
tor-consdiff
tor-chanmgr
tor-dirclient
tor-hsservice
```
2023-03-31 08:30:14 -04:00
Nick Mathewson e208fb15ad Bump crate versions that have breaking changes
These crates have had breaking changes.  They are pre-1.0, so they get
a minor bump.

```
tor-basic-utils
tor-config
```
2023-03-31 08:28:06 -04:00
Nick Mathewson a81ab391ae Bump patchlevel on crates with non-breaking changes
For these crates, the changes are nontrivial, so we
_do_ bump the versions on which their dependent crates depend.

Fortunately, since they are all pre-1.0, we don't need to
distinguish semver-additions from other changes.  (Except for arti,
which _is_ post-1.0, but gets a patchlevel bump anyway.)

These are unstable crates with breaking changes:

```
tor-hscrypto
tor-hsclient
```

These have new or extended APIs:

```
safelog
tor-bytes
tor-cell
tor-linkspec
tor-llcrypto
tor-proto
tor-cert
arti-client
```

These have new unstable APIs or features:
```
tor-netdoc
tor-circmgr (also broke some unstable APIs)
arti (is post-1.0)
```

These have bugfixes only:
```
caret
tor-dirmgr
```
2023-03-31 08:24:39 -04:00
Nick Mathewson a62affd66e Move functionality from tor_basic_utils to tor_async_utils
This commit is mostly code movement; I'd recommend reviewing it
with git's `--color-moved` option.
2023-03-29 13:57:11 -04:00
Ian Jackson 00e522a91a Add some missing imports
Now
  nailing-cargo +stable clippy -p tor-hsclient --all-features --all-targets
actually works.

squash! Add some missing imports
2023-03-28 15:49:45 +01:00
Nick Mathewson a7b238483e Add an experimental circuit accessor to DataStream.
Closes #784.
2023-03-23 09:18:42 -04:00
Ian Jackson b834535347 tor-proto: Feature-conditionalise some enum variants
This avoids some dead code warnings when building without send-control-msg.
2023-03-23 11:50:18 +00:00
Ian Jackson 93809cc594 tor-proto: Split off send-control-msg feature 2023-03-23 11:50:18 +00:00
Nick Mathewson 0521aa855e tor-proto: document deep-copy in ClientCirc::path() 2023-03-22 12:35:41 -04:00
Nick Mathewson bb47d42315 proto: Stabilize ClientCirc::n_hops. 2023-03-22 11:52:17 -04:00
Nick Mathewson 552acbf07f Fix a bunch of needless-conversion warnings.
Apparently 1.68 now warns when you call into_iter() on something
that's already an iterator.  Fair enough.  Let's stop doing that.
2023-03-10 07:09:50 -05:00
Nick Mathewson f3b8f4f73f tor-proto: Document limitation on send_control_message 2023-03-08 14:21:33 -05:00
Nick Mathewson c1b45e1be4 tor-proto: Say "control message" a little more consistently
(I found "user request" in one place, and fixed that.  I am not
currently going to try to unify "control message" and "meta message"
since both terms are misleading and we already have TODOs to try to
merge them into a third better term.)
2023-03-08 14:21:33 -05:00
Nick Mathewson 9c4bdb8d8d tor-proto: Make send_control_message wait for the reactor.
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.
2023-03-08 14:21:33 -05:00
Nick Mathewson fc31bf4e25 tor-proto: Have send_control_message install a handler, not return a stream 2023-03-08 14:21:33 -05:00
Nick Mathewson bc83d1e1de tor-proto: Implement functionality to send a message and accept replies
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.
2023-03-08 14:21:33 -05:00
Nick Mathewson 094fdc0d8d tor-proto: Change semantics of MetaCellHandler
Now, the MetaCellHandler is responsible for consuming the messages
it gets, and reporting status to whatever task is waiting for a
status message.

Additionally, the MetaCellHandler can decide to remain installed or
shut down the circuit after a successful message.  (Previously, it
could only uninstall itself on success and kill the circuit on
failure.)

These changes will enable MetaCellHandlers to be used as the basis
for handling more kinds of message.

(There is some moved and reformatted code here; you may want to
review it with `git {diff or show} --color-moved -b`.)
2023-03-08 14:21:33 -05:00
Nick Mathewson 7108f923e0 tor-proto: Give Path a method to access final hop num. 2023-03-08 14:21:33 -05:00
Nick Mathewson 5586a29f62 tor-proto: Give circ Reactor a constructor, and make its fields private. 2023-03-08 14:21:33 -05:00
Nick Mathewson f41449d0bd Patchlevel bumps for remaining changed crates.
These crates have had small code changes, but no API additions:

tor-config
tor-socksproto
tor-cert
tor-chanmgr
tor-ptmgr
tor-guardmgr
tor-circmgr
tor-dirclient
tor-dirmgr
arti
tor-hsservice
tor-congestion

These crates have had API extensions:

fs-mistrust
tor-llcrypto
tor-bytes
tor-checkable
tor-linkspec
tor-netdoc
tor-persist
arti-client
2023-02-28 07:13:27 -05:00
Nick Mathewson 3e1ae65212 Bump tor-units version for breaking change.
(The breaking change was removing `as_days()` from IntegerMinutes.)

We are _not_ calling this a downstream-api breaking change, per
discussion at
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1012?commit_id=bb2ab7c2a3e0994bb438188511688b5b039cae29#note_2876819
2023-02-28 07:10:00 -05:00
Nick Mathewson 3e257a7cb5 Bump minor versions for significant breaking changes.
This includes tor-cell, tor-proto, and tor-netdir.
2023-02-28 07:05:15 -05:00
Ian Jackson f63c7c48af Rename onion-* cargo features to hs-* in tor-* crates
Fixes #756
2023-02-28 11:10:17 +00:00
Nick Mathewson 07473ed1fc proto: Tweak documentation and names around CmdChecker. 2023-02-27 08:14:15 -05:00
Nick Mathewson 814563dfd6 tor-proto: Rename end_received.
It can now indicate _any_ cell that means we can forget about a stream.
2023-02-17 11:56:53 -05:00
Nick Mathewson d81a9c9aad Use CmdChecker in our stream handling code.
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.
2023-02-17 11:52:09 -05:00
Nick Mathewson c5be3c089e tor-proto: Introduce CmdChecker, and define it for our streams.
The role of CmdChecker is to verify that messages are arriving at
the appropriate sequence on a stream, with respect to the other
messages that have been received.  Once the stream becomes
half-closed, the CmdChecker is also in charge of consuming incoming
messages on the stream and making sure that they are well-formed.
2023-02-17 11:50:27 -05:00
Nick Mathewson 19c0dd153a tor-proto: Add a TODO about simplifying a common pattern. 2023-02-15 10:51:03 -05:00
Nick Mathewson 1ee6bfa59c tor-proto: note implications for future HS work 2023-02-15 10:48:19 -05:00
Nick Mathewson 41b50b6c56 tor-proto: Push stream message parsing into the stream objects.
This closes #525, and ensures, at last, that we don't parse any
message that we wouldn't accept.
2023-02-15 10:48:19 -05:00
Nick Mathewson 58c3b8276c tor-proto: Defer parsing of messages send to half-closed streams
This includes a partial solution for #769, but also turned up
another bug (#774) while I was working on it.  I'll close them both
once I have a real solution.
2023-02-15 10:48:19 -05:00
Nick Mathewson bd0f6f5adf tor-proto: stop reactor (and kill circuit) if meta handler fails
If the meta handler reports an error, then the circuit has violated
its protocol, and needs to be shut down.

Fixes #773.
2023-02-15 10:48:19 -05:00
Nick Mathewson 2e483124cb tor-proto: defer meta-cell parsing to the last moment. 2023-02-15 10:48:19 -05:00
Nick Mathewson 0765243f5e tor-proto: Use UnparsedRelayCell to start deferring cell processing.
In general, we want to avoid parsing these cells until we are
fairly sure that they are something we would accept.
2023-02-15 10:48:19 -05:00
Nick Mathewson ca3b33a1af tor-cell: Refactor relay cells to copy much less
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.
2023-02-15 10:48:19 -05:00
Nick Mathewson 0d772e5bed Rename OpenClientChan{Msg,Cell} => OpenChan{Msg,Cell}S2C 2023-02-09 10:20:31 -05:00
Nick Mathewson b7490ce374 tor-proto: Do not parse forbidden commands on inbound cells.
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.
2023-02-09 10:20:31 -05:00
Nick Mathewson b49bd3b121 tor-proto: only parse allowed ChanMsg types during handshake. 2023-02-09 10:20:31 -05:00
Nick Mathewson 16b9d23a7c tor-cell: Make RelayEarly a separate type.
This allows us to remove a shenanigan from `restricted_msg!{}`.
2023-02-09 10:20:28 -05:00
Nick Mathewson e832cbd29c tor-cell: Have restrict_msg add conversion functions.
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.
2023-02-09 10:20:11 -05:00
Nick Mathewson d63d7926bd tor-cell: Rename RelayMsg and RelayCell-related types.
Thanks to rust-analyzer for making this simple.
2023-02-07 16:03:14 -05:00
Nick Mathewson d99c130679 tor-cell: Rename ChanMsg and ChanCell-related types. 2023-02-07 16:03:14 -05:00
Nick Mathewson c529bb9c30 tor-cell: Remove RelayMsg methods that are duplicated in RelayMsgClass. 2023-02-07 16:03:14 -05:00
Nick Mathewson 3c7aea723b tor-cell: Remove ChanMsg methods that are duplicated in ChanMsgClass. 2023-02-07 16:03:14 -05:00
Nick Mathewson 71445f7ace tor-cell: Use macro to generate ChanMsg too. 2023-02-07 16:03:14 -05:00
Nick Mathewson ffb443709b tor-cell: Change all variants of RelayMsg to have a body.
Previously, there were some unit variants, but that makes things
quite awkward for #525.
2023-02-07 16:03:14 -05:00
Nick Mathewson a2b1f20216 Bump minor version of tor-cell.
In !948 we renamed a couple of accessor functions, which is a
breaking change in `tor-cell`'s API.

In retrospect, perhaps we should have deprecated the old names and
added the new ones, so we wouldn't have to break the API.  (This is
the only API break AFAICT since 1.1.0.)
2023-02-01 10:42:58 -05:00
Nick Mathewson 7c1b6a5a81 Bump the patch version of every crate that had API additions
These crates had API or behavior changes that may affect downstream
crates. Fortunately, they're all version 0.x, and don't need minor
bumps for this.
2023-02-01 10:36:29 -05:00
Nick Mathewson 66f594a4b6 Bump the patch-level version of crates with _minor_ changes.
These changes influence behavior, but not effect compatibility.
(If I messed up, and any crate except for `arti` has non-breaking
API changes, that's still fine, since they are all version
0.x.)
2023-02-01 10:23:58 -05:00