aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/relay/channel/create_handler.rs
Commit message (Collapse)AuthorAgeFilesLines
* proto: Update create handler tests to no longer expect DESTROYGabriela Moldovan8 days1-18/+6
| | | | | Now that we no longer respond to DESTROY by sending a DESTROY ourselves, these tests need to be updated.
* tor-proto: make `CreateRequestHandler` methods asyncSteven Engler2026-08-121-18/+26
|
* tor-proto: use `CgoRelayCrypto`/`Tor1RelayCrypto` aliasesSteven Engler2026-08-121-8/+7
|
* tor-proto: change `TryFrom<_> for HandshakeSubprotocols` to a dedicated ↵Steven Engler2026-08-121-1/+1
| | | | | | constructor Replaces `TryFrom<SubprotocolRequest> for HandshakeSubprotocols`.
* tor-proto: check the handshake type in the ntor testSteven Engler2026-08-121-8/+12
|
* tor-proto: implement the ntor-v3 handshakeSteven Engler2026-08-121-9/+199
|
* Merge branch 'mock-net' into 'main'David Goulet2026-07-301-20/+43
|\ | | | | | | | | tor-proto: Small improvements to circuit handshake tests See merge request tpo/core/arti!4254
| * tor-proto: reuse existing channels in ntor testSteven Engler2026-07-301-8/+5
| | | | | | | | | | Now that we read all of the cells from the connection inspector, we can reuse the existing channel objects.
| * tor-proto: extend circ handshake tests to close the circuitSteven Engler2026-07-301-2/+28
| |
| * tor-proto: rename some methods on test `ConnInspector`Steven Engler2026-07-301-6/+6
| |
| * tor-proto: reword some TODOsSteven Engler2026-07-301-2/+2
| | | | | | | | These TODOs are for client issues, not relay isues.
| * tor-proto: don't drop stream rx in testsSteven Engler2026-07-301-3/+3
| | | | | | | | Otherwise the new circuit gets closed immediately by the relay.
* | Merge branch 'create-fast' into 'main'opara2026-07-301-3/+2
|\ \ | |/ |/| | | | | tor-protover,tor-proto: Add and use a new `subprotocol_restricted_set` macro See merge request tpo/core/arti!4241
| * tor-proto: use `subprotocol_restricted_set` macroSteven Engler2026-07-301-3/+2
| |
* | tor-proto: add unit tests for some circuit handshakesSteven Engler2026-07-291-0/+130
| |
* | tor-proto: build crypt state after building hop settingsSteven Engler2026-07-271-10/+10
| | | | | | | | | | | | `HopSettings::from_handshake_params()` checks that the parameters are correct, so if there are invalid parameters we should fail early before we initialize the `CryptStatePair`.
* | tor-proto: move where we split 'crypt' in CREATE_FAST handshakeSteven Engler2026-07-271-2/+2
| | | | | | | | This is just to make ntor and CREATE_FAST handshakes consistent.
* | tor-proto: add some log messages after circuit handshakeSteven Engler2026-07-271-0/+5
|/
* tor-proto: add `HandshakeSubprotocols`Steven Engler2026-07-271-3/+9
| | | | | | The advantage of this over using a `SubprotocolRequest` is that we can use the type system to ensure it only has subprotocols that are allowed during a handshake.
* tor-proto: remove `CircNetParameters::extend_by_ed25519_id`Steven Engler2026-07-271-3/+0
| | | | | We never used this, it was just needed because we used to convert to a `CircParameters` which required this.
* tor-proto: add `HopSettings::from_handshake_params()`Steven Engler2026-07-271-70/+24
| | | | | | | | | | | | | | | ... and also remove `CircNetParameters::as_circ_parameters()`. We used to call `HopSettings::from_params_and_caps()` when handling incoming circuit requests, but this didn't really make sense because we already know exactly what settings we want. The new `HopSettings::from_handshake_params()` takes the exact settings we want, which means we can also skip constructing a `CircParameters` and use the raw consensus `CircNetParameters`. Most of the code in `CircNetParameters::as_circ_parameters()` has been migrated in some form to `HopSettings::from_handshake_params()`.
* proto: Remove misleading comment about CircuitIncomingStreamReceiverGabriela Moldovan2026-07-221-3/+0
|
* proto: Update CreateRequestHandler::new() docsGabriela Moldovan2026-07-221-1/+2
| | | | | As suggested in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4222#note_3437129
* proto: Reword CircuitIncomingStreamReceiver docs for clarityGabriela Moldovan2026-07-221-1/+2
| | | | Applies @opara's suggested rephrasing.
* proto: Return the incoming streams from the create handler (fmt)Gabriela Moldovan2026-07-221-8/+10
|
* proto: Return the incoming streams from the create handlerGabriela Moldovan2026-07-221-9/+56
| | | | | | | | | | | We need to return the "futures::Stream of Tor streams" from the CREATE handler, because these need to be handled from `arti-relay`, as per `doc/dev/notes/relay-streams.md` This commit is intentionally (slightly) misformatted to make reviewing a bit easier (the next commit will rustfmt everything). Part of #2612
* proto: Add newtype wrapper for incoming stream receiverGabriela Moldovan2026-07-221-0/+41
| | | | | The inner type is an eyesore, and doesn't really need to be exposed outside of tor-proto (we might even replace it at some point).
* proto: Pass the allowed incoming commands to the relay reactorGabriela Moldovan2026-06-301-0/+1
| | | | | | | | The `CreateRequestHandler` now passes the list of allowed "incoming stream request" commands (i.e. BEGIN, BEGIN_DIR, or RESOLVE) to the reactor, replacing the hard-coded command list. Closes #2606
* proto: Pass the allowed incoming commands to CreateRequestHandlerGabriela Moldovan2026-06-301-0/+11
| | | | | | | | | | | This enables us to make these configurable: any relays that are not configured to be an exit will exclude BEGIN and RESOLVE from their list of allowed commands, causing exit and DNS streams to be rejected as soon as the BEGIN/RESOLVE cell is received in the circuit reactor. Context: https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4145#note_3430345 Part of #2606
* proto: Pass an IncomingStreamRequestFilter factory to the create handlerGabriela Moldovan2026-06-291-3/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements what we discussed in `doc/dev/notes/relay-streams.md` (lines 218-234): > Currently, to allow incoming stream requests on a circuit, > you first need to call `RelayCirc::allow_stream_requests()` > to install a `CmdChecker` and `IncomingStreamRequestFilter`. > This is not ideal, because `allow_stream_requests()` will need to be > called unconditionally, on each `RelayCirc`, > right after it's created in the `CreateHandler` impl > (which in turn, would mean making `handle_create()` async too, > because `allow_stream_requests()` is async, which wouldn't be great). > > So, the first step here is to rework the `RelayCirc` API to make relay circuits > be constructable with a list of allowed `RelayCmd`s and `IncomingStreamRequestFilter` > from the get-go ([#2582]), and to get rid of `allow_stream_requests()`, > which will enable the `CREATE*` handler to remain non-`async`. > > In any case, the `CREATE*` handler will still require some changes, > because it needs to be initialized with an `IncomingStreamRequestFilter`, I am not sure using an `IncomingStreamRequestFilter` "factory" is necessarily the right approach here, but the circuit `Reactor`'s constructor needs to take an `IncomingStreamRequestFilter`, and `IncomingStreamRequestFilter` is not `Clone` (and FWIW, I think it's better if we don't make it `Clone`). One obvious limitation is that the `IncomingStreamRequestFilter` of the circuit reactor is fixed for the entire lifetime of the circuit. In practice, I don't think this is going to be a problem, because the arti-relay `IncomingStreamRequestFilter` is only going be used for * preventing single-hop exit streams * per-circuit rate-limiting. Both of these checks will require the filter to have access to a recent `NetDir`, which is straightforward if the filter has an Arc<dyn NetDirProvider> (as mentioned in doc/dev/notes/relay-streams.md, `NetDirProvider` has a handy non-async `timely_netdir()` function we can use). And since these checks are based on consensus params, we don't really need to ever update an already-built circuit with a new `IncomingStreamRequestFilter` (because all `IncomingStreamRequestFilter` will have the ability to obtain a fresh `NetDir` as needed). Nevertheless, I left a TODO about this, because I expect this type to change once we figure out all the other pieces needed for #1448.
* proto: Return IncomingStreams stream from relay reactor constructorGabriela Moldovan2026-06-291-2/+5
| | | | Part of #2582
* proto: Support passing a stream request filter to the reactorGabriela Moldovan2026-06-291-0/+3
| | | | | | | | | Relay circuits always need a filter, so it's best to set it via the constructor. Part of #2582 Closes #2577
* tor-proto: add some comments about handshake server argumentsSteven Engler2026-06-251-0/+5
|
* tor-proto: implement the ntor (non-v3) handshakeSteven Engler2026-06-241-5/+65
|
* tor-proto: update a comment in `CreateRequestHandler`Steven Engler2026-06-241-4/+2
|
* tor-proto: move `RelayLayer` split into helperSteven Engler2026-06-241-4/+21
|
* tor-proto: prepare for ntor handshakesSteven Engler2026-06-241-9/+34
|
* tor-proto: circ handshake now always uses NONE destroy reasonSteven Engler2026-06-121-15/+5
|
* proto: Replace CircuitRx{Sender,Receiver} with new channel typeGabriela Moldovan2026-06-081-0/+1
| | | | | | | | | | This is needed for relays as part of #2490. Note that changing this type affects the client implementation too (i.e. clients will start prioritizing inbound DESTROY, discarding any queued data without forwarding it to their local streams). But that's okay, because it will generally only affect misbehaving clients, and clients unlucky enough to encounter a hibernating relay.
* proto: Make the CreateRequestHandler::new() take the ntor keysDavid Goulet2026-04-211-14/+4
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Use the new RelayNtorKeys for the create handlerDavid Goulet2026-04-211-9/+5
| | | | Signed-off-by: David Goulet <[email protected]>
* tor-proto: give our rsa ident to the channel reactorSteven Engler2026-04-161-1/+5
| | | | This will be needed for ntor handshakes.
* proto: Add a test helper function for building a CircNetParametersDavid Goulet2026-04-141-0/+14
| | | | | | | | | We can't access `NetParameters` in this crate to build from consensus default value so instead add a `defaults_for_tests()` gated function for each parameters object which puts in the defaults from the spec. We'll need CircNetParameters in order to build create request handler for unit tests hence why it is in src/circuit.rs.
* tor-proto: give our ed ident to the channel reactorSteven Engler2026-04-091-1/+17
| | | | This will be needed for ntor handshakes.
* proto: Apply deferred rustfmtGabriela Moldovan2026-04-091-1/+1
|
* proto: Add method for installing ntor keys in the create handlerGabriela Moldovan2026-04-091-2/+27
| | | | | This also updates the key rotation task to call the setter whenever the ntor keys get updated.
* arti-relays: Pass a CreateRequestHandler to the crypto taskGabriela Moldovan2026-04-091-0/+1
| | | | This will need to be updated each time the ntor keys change.
* tor-proto: take `CreateRequest` message by referenceSteven Engler2026-04-081-5/+4
| | | | | Clippy has started warning about this since we moved the CREATE_FAST handling to a helper, so this resolves that.
* tor-proto: move a TODOSteven Engler2026-04-081-2/+1
|
* tor-proto: remove old TODOSteven Engler2026-04-081-4/+1
|