Commit Graph

32 Commits

Author SHA1 Message Date
Nick Mathewson e4373e88e2 proto: new ClientCirc::send_raw_msg function.
Closes #1010.
2023-08-21 09:23:46 -04:00
Gabriela Moldovan 67a77680dd
tor-proto: Make ClientCirc::allow_stream_requests take a HopNum.
For consistency with the other `ClientCirc` APIs,
`ClientCirc::allow_stream_requests` now takes a `HopNum` argument. Upon
receiving an incoming stream request, the reactor now checks if the
request came from the hop specified in `allow_stream_requests` (and if
it came from a different hop, the circuit is closed).

Part of #1009
2023-08-18 12:14:01 +01:00
Nick Mathewson 65a0ac5512 proto: API to expose the `CircuitBinding` type.
Closes #993
2023-08-14 13:15:29 -04:00
Gabriela Moldovan 6073a4f767
tor-proto: Make update_state() and discard() return Result<(), Bug>.
These functions only ever return `Bug` errors.
2023-08-09 13:07:35 +01:00
Gabriela Moldovan a0daa9adb6
tor-proto: Implement IncomingStream::discard(). 2023-08-08 15:25:45 +01:00
Gabriela Moldovan f689e94f0f
tor-proto: allow_stream_requests now waits until the control message is received.
`ClientCirc::allow_stream_requests` is now `async` and waits until the
`AwaitIncomingStream` control message is processed by the reactor.

This guarantees that by the time the `allow_stream_requests` future
resolves, the reactor is ready to process BEGIN/BEGIN_DIR/RESOLVE cells.

Previously, the client tasks from allow_stream_requests tests had to
sleep before sending the BEGIN cell to give the reactor time to process
the `AwaitIncomingStream` control message (which tells the reactor to
expect incoming BEGIN/BEGIN_DIR/RESOLVE cells on the circuit).

Fixes #994
2023-08-04 19:22:45 +01:00
Gabriela Moldovan ed5a051ebe
tor-proto: Add ClientCirc::start_conversation().
This will enable hidden services to send `RENDEZVOUS1` messages to the
`N`th hop of the circuit rather than the `N + 1`th virtual one (which
can only used after the client and service have completed the
introduction handshake).

This also deprecates `start_conversation_last_hop`.

Closes #959
2023-08-04 13:08:31 +01:00
Gabriela Moldovan c23e85270e
tor-proto: Add method for getting the HopNum of the last hop. 2023-08-04 13:07:52 +01:00
Gabriela Moldovan eee3bb8822
tor-proto: Make HopNum public.
`HopNum` will be used in `ClientCirc`'s public API when we refactor
`ClientCirc::start_conversation_last_hop` to use the provided hop rather
than always using the last one.
2023-08-04 10:51:05 +01:00
Gabriela Moldovan 37154dca95
tor-proto: Implement allow_stream_requests. 2023-08-03 16:34:09 +01:00
Gabriela Moldovan f06e0e2df0
tor-proto: Implement IncomingStream::{accept_data, request, reject}. 2023-08-03 16:32:29 +01:00
Nick Mathewson 1e96d1b95a Remove semver.md files now that 1.1.7 is out. 2023-08-01 12:55:52 -04:00
Ian Jackson a97cb2af6a tor-proto conversations: semver 2023-06-30 18:43:20 +01:00
Nick Mathewson 469f62a983 Remove semver.md files from 1.1.5 2023-06-01 14:08:24 -04:00
Nick Mathewson ee390c423e Refactor ClientCirc APIs to use Arc<ClientCirc>.
Now ClientCirc is no longer `Clone`, and the things that need it
to be `Clone` instead return and use an Arc<ClientCirc>
We're doing this so that ClientCirc can participate in the RPC
system, and so that its semantics are more obvious.

Closes #846.

Thanks to the type system, this was a much simpler refactoring than
I had feared it would be.
2023-05-16 09:02:09 -04:00
Nick Mathewson 2ab5348ab2 Remove semver.md files. 2023-03-31 09:24:41 -04:00
Nick Mathewson bb47d42315 proto: Stabilize ClientCirc::n_hops. 2023-03-22 11:52:17 -04:00
Nick Mathewson c42350c6bf Move tor-proto/semver.md to tor-cell
It was erroneously created in the wrong place.
2023-02-01 09:50:02 -05:00
Neel Chauhan e39e39ea27 Add semver.md for (into_)handshake() 2022-12-19 08:25:15 -08:00
Nick Mathewson e0aeda3071 Remove semver.md files now that 1.1.0 is released. 2022-11-30 17:10:29 -05:00
Nick Mathewson 61a33da0ff proto: Make Channel::reparameterize take &self.
Even though channels are practically changeable, they use locks
internally so that you don't need a `&mut Channel` to send or
receive traffic.  It makes sense for reparameterizing the channel to
also use a &self reference.

I'll need this so that I can store channels in an `ByRelayIds<>`
set, and still invoke their reparameterize methods.
2022-10-18 11:49:21 -04:00
Nick Mathewson 96493f427d proto: Implement HasRelayIds for Channel. 2022-10-18 11:49:21 -04:00
Nick Mathewson 34c9178feb tor-proto: Preserve the ChannelMethod, not the SocketAddr 2022-10-06 15:13:05 -04:00
Nick Mathewson a5f704f443 Remove semver.md from arti-1.0.0 2022-09-07 09:17:00 -04:00
Ian Jackson d9338293c8 Add semver notes 2022-08-17 10:54:41 +01:00
Nick Mathewson 2d4507ff35 Final (?) API revisions for tor-linkspec
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.
2022-08-10 10:39:37 -04:00
Nick Mathewson b16c042004 Now that versions have bumped, remove semver.md files. 2022-08-01 10:07:12 -04:00
Nick Mathewson fbb6484025 tor-proto: Stop using write_infallible in handshake code.
This change was a bit annoying, since most of this code _can't_ fail,
and so the only reasonable response is to wrap the input in an
internal error... except for one case where we're actually encoding
a caller-provided message, so we _do_ want to wrap the EncodeError
from tor_bytes.
2022-07-11 11:18:51 -04:00
Nick Mathewson 1dda69af2b Remove semver.md files now that 0.5.0 is out 2022-06-24 13:31:38 -04:00
Ian Jackson 13ca24ba3a tor-proto: err: Provide ChannelClosed as a separate unit error 2022-06-21 19:19:28 +01:00
trinity-1686a e3c9152977 update semver.md 2022-06-08 16:02:22 +01:00
Ian Jackson 8eb215bf81 Document semver changes 2022-06-08 11:24:26 +01:00