aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/client
Commit message (Collapse)AuthorAgeFilesLines
...
* proto: Move CircPaddingDisposition to a new moduleGabriela Moldovan2026-01-291-13/+1
| | | | Relays will need to use it too.
* proto: Add a new ToRelayMsg utilGabriela Moldovan2026-01-291-0/+13
| | | | | | | | | This will be used in a future commit, inside the new generic circuit reactor. We need it because RELAY cells are handled very similarly, so we need some way of finding out if a given generic chancell is actually a RELAY cell that we can handle in an implementation-agnostic way.
* proto: Move TimeoutEstimator to utilGabriela Moldovan2026-01-293-14/+7
| | | | | This will be used in the stream reactor too (and the stream reactor will eventually replace the corresponding client impl).
* proto: Use the channel codec channel typeDavid Goulet2026-01-221-1/+0
| | | | | | | | | | | | | | | | | 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: Remove async for VerifiableChannel::check()David Goulet2026-01-221-2/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Make VerifiableChannel::check() asyncDavid Goulet2026-01-221-1/+2
| | | | | | | | | Relay initiator needs to send CERTS and AUTHENTICATE in that function after verifiying the channel. And thus require to be async. Signed-off-by: David Goulet <[email protected]>
* proto: Make CERTS cell optionnable for UnverifiedChannelDavid Goulet2026-01-221-1/+1
| | | | | | | | | | | | | | | 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]>
* Merge branch 'ticket1599_02' into 'main'David Goulet2026-01-132-44/+37
|\ | | | | | | | | chanmgr: Ability for the ChanMgr to be channel type specific and launch relay channels See merge request tpo/core/arti!3563
| * proto: Seal the VerifiableChannel and FinalizableChannel traitsDavid Goulet2026-01-131-0/+14
| | | | | | | | | | | | They are public but avoid anyone outside implementing them. Signed-off-by: David Goulet <[email protected]>
| * proto: Add link_protocol() to VerifiableChannel traitDavid Goulet2026-01-131-12/+6
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
| * proto: Add traits for public channel viewsDavid Goulet2026-01-132-48/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add traits that will be returned outside tor-proto allowing us to not expose client and relay specific channels. The goal is for the tor-chanmgr to get those objects implementing those traits and can build and run the reactor without knowing the specific underlying type. This allows us to have less code duplication and less client/relay distinction in the chanmgr. Signed-off-by: David Goulet <[email protected]>
* | proto: Dedupe IncomingStreamRequestHandlerGabriela Moldovan2026-01-123-30/+13
|/
* proto: Add an immediate order for client CircuitEvent orderingDavid Goulet2025-12-101-4/+7
| | | | | | | With a protocol violation, we have to immediately deal with such event before emitting anything on the wire. Signed-off-by: David Goulet <[email protected]>
* proto: Rename CircuitAction and cie to CircuitEventDavid Goulet2025-12-102-75/+67
| | | | | | | | | | This mirrors also the relay reactor. We've introduced the ProtoViolation into a previous commit which is not an action but rather an "event" that happened on a circuit. And so, better semantic. No behavior change. Signed-off-by: David Goulet <[email protected]>
* proto: Rename Circuit{Action/Event}::Shutdown to ProtoViolationDavid Goulet2025-12-102-6/+7
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Add TODO in client reactor for bad cellDavid Goulet2025-12-101-0/+6
| | | | | | Because of https://gitlab.torproject.org/tpo/core/torspec/-/issues/385 Signed-off-by: David Goulet <[email protected]>
* proto: Make ClientCircChanMsg pub(super)David Goulet2025-12-101-1/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Move unit tests and minor fixDavid Goulet2025-12-101-0/+20
| | | | | | 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-104-27/+32
| | | | | | | | | | | | | | | 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-103-5/+25
| | | | | | | | 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]>
* Merge branch 'fix-relay-compile' into 'main'David Goulet2025-12-091-1/+1
|\ | | | | | | | | proto: Fix relay/hs-service feature gating See merge request tpo/core/arti!3534
| * proto: Fix relay/hs-service feature gatingGabriela Moldovan2025-12-081-1/+1
| | | | | | | | | | Without this, `tor-proto` doesn't compile if you enable the `relay` feature but not `hs-service`.
* | Remove unnecessary `doc(cfg(...))` attributesNeel Chauhan2025-12-043-4/+0
|/ | | | | | | | | Fixes part of #2193. (Edits from nickm: I selected the cases here that I could verify were correct from immediate context.) Edited-by: Nick Mathewson <[email protected]>
* proto: Add comment about create_firsthop_fastNick Mathewson2025-12-031-1/+2
|
* Merge branch 'relay-streams2' into 'main'David Goulet2025-12-026-566/+32
|\ | | | | | | | | proto: Start handling incoming streams in the relay reactor See merge request tpo/core/arti!3487
| * proto: Appropriately gate STREAM_READER_BUFFER to satisfy clippyGabriela Moldovan2025-11-241-1/+4
| |
| * proto: Deduplicate msg_streamid()Gabriela Moldovan2025-11-241-19/+1
| | | | | | | | | | | | | | | | | | | | Initially I wanted to turn `msg_streamid()` into a method on `UnparsedRelayMsg`, but I ultimately decided against it, because it feels like it doesn't belong there (even though intuitively, I would've expected it to handle the mismatch between stream ID and cell command internally). This is because all the `UnparsedRelayMsg` methods return `tor_bytes::Result`, and do not actually do any validation beyond some length checks on the various fields.
| * proto: Remove crate-level STREAM_READER_BUFFER reexportGabriela Moldovan2025-11-241-2/+0
| | | | | | | | All this indirection is making me dizzy.
| * proto: Move a couple of stream-related constants to stream modGabriela Moldovan2025-11-242-13/+2
| |
| * proto: Add a Tunnel::Relay variant for StreamTargetGabriela Moldovan2025-11-241-5/+13
| |
| * proto: Move raw under top-level stream modGabriela Moldovan2025-11-242-170/+1
| |
| * proto: Move StreamTarget to stream moduleGabriela Moldovan2025-11-241-1/+2
| |
| * proto: Move StreamReqInfo to stream moduleGabriela Moldovan2025-11-241-50/+6
| |
| * proto: Make the hop in StreamReqInfo optionalGabriela Moldovan2025-11-242-5/+2
| | | | | | | | We are about to use `StreamReqInfo` for exit streams too.
| * proto: Move IncomingStream* types to shared moduleGabriela Moldovan2025-11-242-304/+5
| |
* | proto: Allow unstable_name_collisions in several placesGabriela Moldovan2025-12-012-0/+10
| |
* | opentelemetry: Instrument a bunch of functions.Wesley Aptekar-Cassels2025-11-244-3/+22
|/ | | | | These are all aimed at figuring out in more detail what's going on in #2079 and related issues.
* proto: Remove unused function from ClientChannelBuilderDavid Goulet2025-11-191-7/+0
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Make cargo doc happyDavid Goulet2025-11-191-1/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Split VerifiedChannel::finish()David Goulet2025-11-191-2/+17
| | | | | | | | | | 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-11/+19
| | | | | | | | | 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: Add client specific handshake channel structsDavid Goulet2025-11-192-6/+90
| | | | | | | | | | | | | | This adds the UnverifiedClientChannel and VerifiedClientChannel mirroring the relay API for channels. It plainly uses the generic object underneath as for now those objects are client only. Followup commits will make things more client specific. No behavior change. Signed-off-by: David Goulet <[email protected]>
* proto: Move client handshake into client channel moduleDavid Goulet2025-11-192-0/+209
| | | | | | | | | | | | | 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: Fix up doc links post-refactoringGabriela Moldovan2025-11-171-2/+2
|
* proto: Make cc state shared between CircHop{Inbound,Outbound}Gabriela Moldovan2025-11-172-13/+10
| | | | | | | | | | | | | The relay reactor needs the cc state to be shared between the inbound and outbound components (i.e. the forward and backward reactors), so we need to put the cc state behind a mutex. There will never be any contention on this mutex in the client impl, because the client reactor doesn't split the `CircHop` into `CircHopInbound` and `CircHopOutbound`. In the future, we should work on trying to reduce the number of locks in the `CircHop` states.
* proto: Move CircHop{Inbound,Outbound} out of the client module.Gabriela Moldovan2025-11-171-573/+9
| | | | These will be soon used by relays too.
* proto: Add constructors for CircHop{Inbound,Outbound}Gabriela Moldovan2025-11-171-19/+46
|
* proto: Move some of CircHop's impl to CircHop{Inbound,Outbound}Gabriela Moldovan2025-11-171-141/+340
| | | | | The Inbound/Outbound CircHop states will be used in the relay reactor, so it's helpful to move some of the `CircHop` impl there.
* proto: Make the hop in SendRelayCell optional (fmt)Gabriela Moldovan2025-11-171-1/+5
|
* proto: Make the hop in SendRelayCell optionalGabriela Moldovan2025-11-176-18/+20
|