summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/channel
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'relay-channel-fixes' into 'main'David Goulet2026-02-261-0/+4
|\ | | | | | | | | relay: Couple fixes related to channel creation See merge request tpo/core/arti!3726
| * proto: Add 'CreateFast/CreatedFast' to relay message filterSteven Engler2026-02-261-0/+4
| |
* | proto: The AUTHENTICATE cell requires the SHA256 RSA identity digestDavid Goulet2026-02-261-8/+14
|/ | | | | | | Before this commit, we would use the RsaIdentity which is a SHA1 digest. We do the same for the peer RSA key. Signed-off-by: David Goulet <[email protected]>
* tor-proto: improve debug tracing messageSteven Engler2026-02-241-2/+2
| | | | | | | | | | | | | | Before: ```text Completed handshake with Ed25519Identity { ClByyE4zT+p3dudeCVkUfVA1zp2y2sOUe7u/HHLliWU } [(RsaIdentity { $547bb37f9cd8079eaf1cfcb73fff5887d6f58138 }, [9, 111, 131, 62, 212, 144, 149, 88, 211, 87, 175, 114, 18, 111, 189, 36, 205, 21, 66, 205, 217, 176, 139, 130, 70, 211, 40, 130, 79, 29, 144, 179])] ``` After: ```text Completed handshake with ed25519:wo9NA5RXkPAc7sB2301JBpvdk1RvSOGZEzgwuWP/msA [$feebaba2b6faf53ae1dc8dda8681ce026537dfa4] ```
* tor-proto: split field into two fieldsSteven Engler2026-02-241-6/+10
| | | | | These were previously in a single `Option`, but now that the `Option` was removed, I think it's nicer to make these separate fields.
* tor-proto: remove unnecessary `Option`sSteven Engler2026-02-241-14/+8
| | | | | | I don't think that the `Option`s are needed anymore, since unauthenticated channels no longer transition through the `VerifiedChannel` state.
* proto: Filter the IP address in the channel's OwnedChanTargetDavid Goulet2026-02-191-23/+35
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Reuse the RelayIds builder during the handshakeDavid Goulet2026-02-191-18/+11
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Pass PeerAddr at the channel handshake finish for initiatorsDavid Goulet2026-02-191-38/+13
| | | | | | | | | | 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 constructor for PeerInfo instead of BuilderDavid Goulet2026-02-191-15/+10
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Remove Default of PeerInfo/Addr and use const insteadDavid Goulet2026-02-192-9/+25
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Put a PeerInfo in ChannelDavid Goulet2026-02-192-2/+31
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Use the PeerAddr accross channel handshakeDavid Goulet2026-02-191-7/+20
| | | | | | | 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]>
* proto: Channel finish() now handles canonicityDavid Goulet2026-02-122-5/+20
| | | | | | | | | | | | | | All handshake pass the NETINFO cell, the advertised addresses (if any) and the peer address in order to build the Canonicity and build the channel with it. In order to pull this off, the "my_addrs" were added to several object along the NETINFO cell. We also pass the channel method when connecting (initiator) to a relay as we need this for this canonicity build. Signed-off-by: David Goulet <[email protected]>
* Merge branch 'unused-async-lint' into 'main'gabi-2502026-01-281-2/+3
|\ | | | | | | | | | | | | maint/add_warning: Deny clippy::unused_async Closes #2328 See merge request tpo/core/arti!3613
| * proto: Add an exception for clippy::unused_asyncGabriela Moldovan2026-01-271-0/+1
| |
| * proto: Remove unnecessary async in channel reactorGabriela Moldovan2026-01-271-2/+2
| | | | | | | | | | This resolves a warning triggered by the newly-introduced `#[deny(clippy::unused_async)]`.
* | clippy: Fix missing doc for non-Linux buildsClara Engler2026-01-271-0/+1
|/
* proto: Add missing use for testsDavid Goulet2026-01-221-1/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Use the channel codec channel typeDavid Goulet2026-01-223-15/+67
| | | | | | | | | | | | | | | | | Remove the channel type from Unverified and Verified channels and instead use the channel type in the underlying channel codec. The codec requires such type in order to restrict messages sets. Instead of duplicating it, this commit simply makes it that there is now only a single channel type attached to a channel structure. The resulting `struct Channel` in the end gets it copied from the channel codec as the framed_tls gets split and given to the `Reactor`. Down the line, we need a channel type attached to the `Channel` in order to know if it is a client or not and authenticated or not. Signed-off-by: David Goulet <[email protected]>
* proto: Put rsa_id and rsa_cert_digest togetherDavid Goulet2026-01-221-11/+7
| | | | | | Avoid having one None and the other Some which would be a bug. Signed-off-by: David Goulet <[email protected]>
* proto: Remove uneeded code in the unverified inner check()David Goulet2026-01-221-25/+3
| | | | | | | | | | We can't get into the UnverifiedChannel::check() without wanting to verify our identities and authenticate. This validation has moved before calling check() for the relay channel type. Signed-off-by: David Goulet <[email protected]>
* proto: Implement FinalizableChannel for an unverified relay channelDavid Goulet2026-01-221-0/+66
| | | | | | | | | | | | | | | Reason for this is so we can use the type system to enforce that a client/bridge<-> relay channel can never become verified and thus in the code path of authentication. In other words, when check() is called, without an authentication cell, we can't authenticate or even verify the identities so we immediately return "self" which in this case is the UnverifiedRelayChannel. That channel can be finish()-ed to yield a Channel that can never be considered authenticated. Signed-off-by: David Goulet <[email protected]>
* proto: Make CERTS cell optionnable for UnverifiedChannelDavid Goulet2026-01-221-16/+48
| | | | | | | | | | | | | | | This requires to make a series of cert and digest also optionnable in the VerifiedChannel. This change is needed because as a relay responder, you might get the CERTS or not depending on if the other side wants to authenticate. Client and bridges do not authenticate and thus it is expected to not have a CERTS cell. This leads to the UnverifiedChannel::check() function to return early with a VerifiedChannel without any identity attached to it. Signed-off-by: David Goulet <[email protected]>
* proto: Move unit tests and minor fixDavid Goulet2025-12-101-3/+3
| | | | | | Move the client specific unit tests into the client module. Signed-off-by: David Goulet <[email protected]>
* proto: Client circuit reactor now handles AnyChanMsgDavid Goulet2025-12-102-5/+5
| | | | | | | | | | | | | | | This commit removes the CircuitRx* based solely on the client circuit message and moves it into the top level of the crate so all reactors can use them. The client reactor then upon receiving the message, it converts the AnyChanMsg into a ClientCircChanMsg. On error, this leads to a shutdown of the entire reactor due to a fatal error. In order to pull this off, we added a CircuitAction::Shutdown that is handled as a priority. Signed-off-by: David Goulet <[email protected]>
* proto: Move ClientCircChanMsg into client moduleDavid Goulet2025-12-101-2/+1
| | | | | | | | Next commit will also move the Relay specific set into the relay module. These two sets are becoming specific to the reactor as the circuit reactor communication channel will use AnyChanMsg instead. Signed-off-by: David Goulet <[email protected]>
* proto: Remove extra slashes in doc commentsGabriela Moldovan2025-12-011-2/+2
|
* opentelemetry: Instrument a bunch of functions.Wesley Aptekar-Cassels2025-11-241-1/+5
| | | | | These are all aimed at figuring out in more detail what's going on in #2079 and related issues.
* proto: Remove unused code from testDavid Goulet2025-11-191-1/+0
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Remove a .expect() of a digest array conversionDavid Goulet2025-11-191-17/+15
| | | | | | | We know from the start that this is 32 bytes so no reason to hard fail if not, just propagate the right type from the start. Signed-off-by: David Goulet <[email protected]>
* proto: Update generic channel commentsDavid Goulet2025-11-191-9/+12
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Split VerifiedChannel::finish()David Goulet2025-11-191-23/+3
| | | | | | | | | | Move the client specific code into VerifiedClientChannel as in sending the NETINFO cell. The rest is pretty much boiler plate to build a channel reactor. The relay finish() code is coming in a followup commit. Signed-off-by: David Goulet <[email protected]>
* proto: Use the new client specific channelsDavid Goulet2025-11-191-17/+7
| | | | | | | | | By changing the connect() returned object we therefore officially make VerifiedChannel and UnverifiedChannel crate only objects. Thus, this commit changes visibility on most things. Signed-off-by: David Goulet <[email protected]>
* proto: Move client handshake into client channel moduleDavid Goulet2025-11-191-127/+3
| | | | | | | | | | | | | 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]>
* proto: Add UnverifiedRelayChannel implementationDavid Goulet2025-11-191-101/+22
| | | | | | | | | | | | | | 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]>
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-063-3/+3
| | | | Run maint/add_warning
* all: run cargo fmtSteven Engler2025-11-041-1/+1
|
* all: replace all uses of `futures::task::SpawnExt` with `tor_rtcompat::SpawnExt`Steven Engler2025-11-041-1/+1
|
* proto: Remove relay ChannelAuthenticationData builderDavid Goulet2025-10-231-18/+35
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Feature flag some relay specific codeDavid Goulet2025-10-231-8/+14
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Add relay todos for the handshakeDavid Goulet2025-10-231-0/+2
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Use Arc for relay identities objectDavid Goulet2025-10-231-1/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Re-arrange some importsDavid Goulet2025-10-231-3/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Add a note about channel canonicityDavid Goulet2025-10-231-0/+5
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Compute authenticate data after validating certificatesDavid Goulet2025-10-231-5/+50
| | | | | | | | | | | | | | 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]>
* proto: Add the channel authentication dataDavid Goulet2025-10-231-0/+7
| | | | | | | | | | | This commit only adds a struct holding all the authentication data that needs to be built during the verification process after all handshake cells needed for authentication have been sent. It lives in the VerifiedChannel struct so it can be used to build the AUTHENTICATE cell and be sent before the NETINFO. Signed-off-by: David Goulet <[email protected]>
* proto: Add RelayInitiatorHandshakeDavid Goulet2025-10-231-1/+7
| | | | | | | This implements the relay initiator side of the handshake up to the creation of an unverified channel. Signed-off-by: David Goulet <[email protected]>
* proto: Change visibility for some channel objectsDavid Goulet2025-10-231-14/+14
| | | | | | | | | | 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]>
* proto: Move celltypes out of clientGabriela Moldovan2025-10-132-4/+6
| | | | | Some of these are relay-specific, so it makes more sense to pull this into a top-level module.