summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/client
Commit message (Collapse)AuthorAgeFilesLines
* proto rpc: Turn tunnel paths into a dictNick Mathewson2026-04-282-9/+30
| | | | | | | | | This will make it possible to tell whether a path has been replaced in the tunnel. Since the UniqId type might change its representation in the future, I've documented that we don't guarantee anything about the strings used to distinguish paths.
* proto rpc: Change PathEntry to an enum.Nick Mathewson2026-04-281-28/+30
|
* proto: Add an RPC function to access tunnel and inspect its path.Nick Mathewson2026-04-281-0/+222
| | | | Additionally, allow inspecting tunnel paths directly from streams.
* proto: Allow DataStreamCtrl and ClientTunnel to be RPC objects.Nick Mathewson2026-04-281-0/+5
|
* tor-proto: Simplify a match+if statement.Nick Mathewson2026-04-211-13/+5
|
* proto: Remove re-export of MsgBuf in unit testsDavid Goulet2026-04-141-1/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Add channel relay handshake unit testsDavid Goulet2026-04-141-178/+0
| | | | | | | | | | | | | Instead of copying the client unit tests into the channel module, just make both current unit tests run on a client and relay handshake. This required a bit of trickery with type HandshakeConnectFn but works out in the end. It also adds the RelayMsgBuf that wraps a MsgBuf in order to implement CertifiedConn which is very relay only. Signed-off-by: David Goulet <[email protected]>
* proto: Move channel client handshake tests into client moduleDavid Goulet2026-04-141-0/+225
| | | | | | | | | No behavior change. Make the const cells public as they will be useful for more upcoming unit tests especially on the relay side. Signed-off-by: David Goulet <[email protected]>
* Merge branch 'create-fast' into 'main'opara2026-04-082-10/+10
|\ | | | | | | | | Add support for handling CREATE_FAST cells and launching a circuit reactor See merge request tpo/core/arti!3846
| * tor-{proto,chanmgr}: change how channels accept a CREATE* handlerSteven Engler2026-04-081-2/+4
| | | | | | | | | | | | | | | | | | | | | | Instead of giving the `CreateRequestHandler` to the channel after it's constructed, we integrate it into the handshake so that we can give it to the channel constructor. The `ChannelType` is no longer part of the `Channel`. Some of the tests could be cleaned up slightly now that the channel doesn't need the `ChannelType`, but I don't want to conflict with !3853.
| * tor-proto: small cleanup of legacy codeSteven Engler2026-04-081-6/+1
| | | | | | | | | | | | | | I think it was written like this because earlier versions of rust didn't allow references to temporaries like `&mut rand::rng()` and needed them to be bound to a variable. But this isn't necessary anymore and so the comment doesn't make sense.
| * tor-proto: change channel to use `Runtime`Steven Engler2026-04-081-2/+5
| | | | | | | | | | When used for relay channels, the channel reactor will soon need to spawn relay circuit reactors.
* | tor-proto: lower log level of "removing circuit leg"Steven Engler2026-04-061-1/+1
| | | | | | | | This appears often in the arti logs, but is a normal thing to happen.
* | proto: Take current time as an argument when constructing padder.Nick Mathewson2026-03-312-7/+12
|/ | | | | | | Previously we'd get the time by calling Instant::now, but that would lead to a mismatch with the runtime if we were mocking. Part of #2428.
* proto: Rename many variables with more fine grained namingDavid Goulet2026-03-301-6/+6
| | | | | | | | | | Mostly, identity a `ChanTarget` as a "target" since we juggle with PeerInfo and OwnedChanTarget nowadays. All certificate and keys have very specific names which attempts to match the spec as much as possible. Signed-off-by: David Goulet <[email protected]>
* proto: Add names to ignored variablesDavid Goulet2026-03-301-1/+1
| | | | | | https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3791#note_3374465 Signed-off-by: David Goulet <[email protected]>
* proto: Add AuthLogAction enum helperDavid Goulet2026-03-301-5/+4
| | | | | | | | | We can remove the "/* take_slog */ true" pattern and instead have an explicit type at the callsite for semantic. https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3791#note_3374457 Signed-off-by: David Goulet <[email protected]>
* chanmgr: Always use MaybeSensitive<PeerAddr> when building a channelDavid Goulet2026-03-301-3/+3
| | | | Signed-off-by: David Goulet <[email protected]>
* tor-proto: Port to web-time-compatNick Mathewson2026-03-266-7/+10
|
* proto: Move AllowAllStreamsFilter to crate-pub test moduleGabriela Moldovan2026-03-251-15/+3
| | | | This will soon be used by the relay tests too.
* proto: Add option to create RELAY_EARLY via rmsg_to_ccmsg() (fmt)Gabriela Moldovan2026-03-251-12/+38
|
* proto: Add option to create RELAY_EARLY via rmsg_to_ccmsg()Gabriela Moldovan2026-03-251-36/+39
| | | | This will be needed for the relay circuit reactor tests.
* proto: Move rmsg_to_ccmsg to crate-pub test moduleGabriela Moldovan2026-03-251-10/+1
| | | | We'll soon need this for the relay reactor tests too.
* Fix typosTobias Stoeckmann2026-03-241-1/+1
| | | | Typos found with codespell
* tor-proto: fix the relay initiator's SLOG digestSteven Engler2026-03-191-4/+5
|
* proto: Set the link protocol outside the recv VERSIONS helperDavid Goulet2026-03-191-0/+3
| | | | | | | | | | | | | | | | | | | It used to work for an initiator to set the link protocol once a VERSIONS is received because initiator send their VERSIONS before. This failed with responders because a responder channel sends their VERSIONS after receiving one from the initiator. This reverse logic means that the channel cell handler was transitionned to the Handshake state before a responder was able to send a VERSIONS cell leading to a failure because VERSIONS cell aren't allowed at the Handshake state. To fix this, the send/recv or recv/send is now explicit per channel type and once this is done and successful, the link protocol is set. A `set_link_protocol()` is added to the ChannelBaseHandshake trait so it can be used to set the cell handler. Signed-off-by: David Goulet <[email protected]>
* proto: New UnverifiedInitiatorChannelDavid Goulet2026-03-191-52/+18
| | | | | | | | Both client and relay specialized channel now use it as their inner base channel so they can use the same common verify() function since it is the same validation for both. Signed-off-by: David Goulet <[email protected]>
* proto: Move cert validation per specialized channelDavid Goulet2026-03-191-2/+41
| | | | | | | | | | | | | | | | | | | | | | | | Remove the last part from check_internal() that is specific to an initiator channel. At this commit, all three specialized channel do the verify process within their own verify() function. The client and relay initiator both look at the TLS cert (code duplication unfortunately). And the relay responder looks at the LINK_AUTH cert extracting the peer KP_link_ed key for validation. The CERTS cell is removed from UnverifiedChannel as it is now only useful within the verification process which is now specialized. A series of TODO(relay) is added to point out the current problem and how to fix them. The next step is to create an UnverifiedInitiatorChannel that will hold the verity_tls_cert() function and peer cert information which is only relevant to an initiator. This will remove code duplication. Signed-off-by: David Goulet <[email protected]>
* proto: Use RelayIds in a VerifiedChannelDavid Goulet2026-03-191-1/+1
| | | | | | | | | | | | | | | | In order to pull this off, make UnverifiedChannel::check_relay_identities() to return a RelayIds that it builds after checking if they match the peer we were expecting. This part is moved in this commit so once check_relay_identities() returns, we are certain of the relay identity validity on both "it identified properly" and "it is the right expected relay". This makes it that the check_relay_identities() returns the RelayIds, the signing key and the RSA id digest (which is needed for authentication later). Signed-off-by: David Goulet <[email protected]>
* Fix grammar typosTobias Stoeckmann2026-03-151-2/+2
|
* Fix word duplicate typosTobias Stoeckmann2026-03-154-5/+5
|
* tor-proto: remove `is_expecting_auth_challenge()`Steven Engler2026-03-031-4/+0
| | | | The responder always sends an AUTH_CHALLENGE cell.
* safelog: Rename MaybeSensitive::hidden/visible()David Goulet2026-03-031-1/+1
| | | | | | Rename them to respectively sensitive() and not_sensitive(). Signed-off-by: David Goulet <[email protected]>
* proto: Channel handshake minor cleanupDavid Goulet2026-03-031-3/+1
| | | | | | | | | | To make the code a bit better here. Also, at this commit, the UnverifiedChannel::finish() and VerifiedChannel::finish() are basically the exact same. A refactoring to use a finish() helper would work nicely. Signed-off-by: David Goulet <[email protected]>
* proto: Setup the channel PeerInfo in the specialized finish()David Goulet2026-03-031-5/+9
| | | | | | | | | | | Every specific types know if the peer is sensitive or not so now the finish() of each of these channel types builds the right PeerInfo with MaybeSensitive. This is passed on the Channel so from that point on, the Channel will never leak peer data in the logs. Signed-off-by: David Goulet <[email protected]>
* proto: Make channel PeerAddr sensitiveDavid Goulet2026-03-031-2/+10
| | | | | | | Only the R2R channel that the PeerAddr becomes unsensitive. The rest, we keep it sensitive as it can be a client or a client's guard/bridge. Signed-off-by: David Goulet <[email protected]>
* proto: Pass PeerAddr at the channel handshake finish for initiatorsDavid Goulet2026-02-192-12/+5
| | | | | | | | | | Responder relay handshake requires the peer address at the very start as it sends its NETINFO right away. For initiators, we only need it during the finalization process which is when the NETINFO is sent and the Channel is created. Signed-off-by: David Goulet <[email protected]>
* proto: Use the PeerAddr accross channel handshakeDavid Goulet2026-02-192-25/+13
| | | | | | | This is a large change but it is basically using PeerAddr in the channel builder through the channel handshake code and into the Channel itself. Signed-off-by: David Goulet <[email protected]>
* Merge branch 'circ-sync-view-streams' into 'main'gabi-2502026-02-165-57/+9
|\ | | | | | | | | | | | | proto: Replace circuit-scoped `CircSyncView` with per-hop alternative Closes #2351 See merge request tpo/core/arti!3680
| * proto: Rename CircSyncView to CircHopSyncViewGabriela Moldovan2026-02-162-4/+4
| | | | | | | | And update the docs
| * proto: Remove unused n_open_streams() functionsGabriela Moldovan2026-02-161-17/+0
| |
| * proto: Replace circuit-scoped n_open_streams() with per-hop alternativeGabriela Moldovan2026-02-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `IncomingStreamRequestFilter`s, and `CircSyncView`s, by extension, are used both by old relay implementation and the new one for implementing an out-of-reactor way of deciding how to handle an incoming stream. In the new circuit reactor design, we have a separate stream reactor for each hop. Upon receiving an incoming stream, the stream reactor will need to build one of these `CircSyncView` objects, and then pass it to an externally-provided `IncomingStreamRequestFilter`. Before this change, `CircSyncView::n_open_streams()` returned the total number of open streams, which wouldn't have worked with the new reactor design, because the per-hop stream reactor doesn't have a global view of all the hops, so its `CircSyncView` can't return the total number of streams (at least not without message passing, or sharing state with the other stream reactors).
| * proto: Replace CircSyncView with previously client-only CircSyncViewGabriela Moldovan2026-02-164-36/+1
| | | | | | | | | | | | | | | | | | | | Note: this commit only contains the removal of the old `CircSyncView`, and it of course doens't compile. A future commit will replace the removed file with the `syncview.rs` from the client module. This change is split over two commits because it makes reviewing easier (`git mv`ing the new file over the old results in a confusing diff, because `git` refuses to show it as a move).
| * proto: Adjust visibility in client::reactor::CircSyncViewGabriela Moldovan2026-02-161-3/+3
| | | | | | | | | | This is in preparation for replacing the top-level `CircSyncView` with it.
| * proto: Use absolute path in CircHopList importGabriela Moldovan2026-02-161-1/+1
| | | | | | | | This file will be moved to the top-level `circuit` module soon.
| * proto: Rename ClientCircSyncView to CircSyncViewGabriela Moldovan2026-02-163-6/+5
| | | | | | | | | | This will soon replace `CircSyncView` wholesale. The preliminary renaming will make the future diffs easier to review.
| * proto: Add an accessor for the CircHopOutbound of a CircHopGabriela Moldovan2026-02-161-0/+5
| | | | | | | | This will soon be needed for building a `CircSyncView`.
* | proto: Use is_multiple_of() as suggested by clippyGabriela Moldovan2026-02-161-1/+1
|/
* Merge branch 'early-relay' into 'main'gabi-2502026-02-121-13/+0
|\ | | | | | | | | | | | | proto: Pass *all* cells to handle_forward_cell() Closes #2339 See merge request tpo/core/arti!3674
| * Revert "proto: Add a new ToRelayMsg util"Gabriela Moldovan2026-02-121-13/+0
| | | | | | | | | | | | | | | | | | | | This reverts commit 04ab3cd848d7977baf58dd64ebfcad6aa54ecb17. Reverted because we no longer need to "peek" into the opaque `CircChanMsg` of a circuit reactor: now the implementation-dependent part of the reactor is in charge of handling the channel messages, and extracting `Relay` objects out of RELAY/RELAY_EARLY cells, which then get processed in the base reactor.