summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/relay
Commit message (Collapse)AuthorAgeFilesLines
* proto: Remove TODOs about flushing pending dataGabriela Moldovan2026-05-262-8/+0
| | | | | | We decided the reactor is the wrong place to handle this. See discussion in #2490
* proto: Remove unused asyncGabriela Moldovan2026-05-201-3/+2
|
* proto: Make TRUNCATE trigger a proto violationGabriela Moldovan2026-05-202-5/+25
|
* proto: Add some tests for DESTROY handlingGabriela Moldovan2026-05-201-1/+60
|
* proto: Make do_create2_handshake() check EXTENDED2 was sentGabriela Moldovan2026-05-201-1/+19
| | | | | | | | | | | | | | This adds an extra assertion that ensures the relay reactor does in fact send an EXTENDED2 on its towards-the-client channel after receiving the CREATED2 response from the fake hop. This check is nice to have in general, but the main reason I'm doing this now is because for the DESTROY tests I'm about to add, I need the inbound MPSC queue (towards the client) drained of these handshake messages in order to check that the "next" cell we've sent is a destroy. I could've added some custom code to drain it just for the purposes of that test, but I think it's better to have `do_create2_handshake()` take care of it.
* proto: Extend helper to check that DESTROY was sent in both directionsGabriela Moldovan2026-05-201-7/+21
|
* proto: Rename a test helper and adjust its docsGabriela Moldovan2026-05-201-7/+6
| | | | | | | | The new name is (hopefully) a bit more descriptive. I'm planning on extending this function soon to support checking if a DESTROY has been sent on the outbound channel too, so I'm tweaking the docs a bit in preparation for that.
* proto: Return the CircId from test handshake helperGabriela Moldovan2026-05-201-2/+4
| | | | I'll soon need this for a DESTROY test.
* proto: Add test helper for sending AnyChanMsgsGabriela Moldovan2026-05-201-0/+5
|
* proto: Add a comment clarifying why we don't need to propagate DESTROYGabriela Moldovan2026-05-201-0/+7
|
* proto: Adjust DESTROY-related logs in the backward reactorGabriela Moldovan2026-05-201-2/+6
| | | | | | | This changes a debug log to have the same format as the corresponding DESTROY-related log from the forward reactor. Part of #2490
* proto: Pass the cell by reference to resolve a warningGabriela Moldovan2026-05-201-3/+2
|
* proto: Log a message when a forward DESTROY comes alongGabriela Moldovan2026-05-201-3/+15
| | | | Part of #2490
* Upgrade rand crates to 0.10.Wesley Aptekar-Cassels2026-05-122-2/+2
| | | | | | | | | | | When the circ-padding feature is enabled, we use maybenot, which does not yet support rand 0.10. In the meantime, enabling this feature pulls in rand 0.9. This is not ideal, but should be okay as a temporary situation. This also replaces the use of ReseedingRng (which was removed in 0.10) with the reseeding_rng crate. This is somewhat less performant, but it should be okay.
* proto: Wrap PeerInfo in Arc<>Gabriela Moldovan2026-04-232-4/+4
| | | | | | To avoid copying the same information for every circuit, as suggested by @opara in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3906#note_3399497
* proto: Avoid collecting the chan identities in RelayIdSetGabriela Moldovan2026-04-231-10/+2
| | | | | It doesn't make sense to do so, as pointed out by @opara in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3906#note_3398956
* proto: Use PeerInfo in the extend handlerGabriela Moldovan2026-04-232-3/+4
| | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3906#note_3397922
* proto: Add test ensuring we won't extend to the previous hopGabriela Moldovan2026-04-231-1/+43
|
* proto: Reject EXTEND2 targeting the previous hop in the circuitGabriela Moldovan2026-04-231-1/+13
| | | | | | | The relay reactor will now reject any EXTEND2 that tries to extend the circuit to a hop that shares any identities with our previous hop. Closes #2415
* proto: Give the ExtendRequestHandler a copy of the inbound peer infoGabriela Moldovan2026-04-233-1/+8
| | | | | This will soon be used for preventing the circuit from being extended to the previous hop (#2415).
* proto: Fix broken doc link in extend handlerGabriela Moldovan2026-04-231-1/+3
|
* proto: Extract EXTEND2 handling into a new moduleGabriela Moldovan2026-04-232-200/+254
| | | | | | | | | The EXTEND2 handling logic is fairly self-contained, so I'm moving it outside of the `Forward` handler. This refactoring enables us to add more context to the handler (i.e. the inbound channel identities needed for #2415) without cluttering the `Forward` implementation. I recommend reviewing this commit with `git diff --color-moved`.
* 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]>
* Merge branch 'rm-var-suffix' into 'main'David Goulet2026-04-201-4/+4
|\ | | | | | | | | proto: Remove dummy suffixes from variable name See merge request tpo/core/arti!3903
| * proto: Remove dummy suffixes from variable nameGabriela Moldovan2026-04-201-4/+4
| | | | | | | | | | | | | | | | I used these `_foo` suffixes to make sense of things during development: at the time, I had multiple "forward" and "backward" types, and I needed to distinguish them without spending too much time thinking of a provisory name. I meant to remove them before upstreaming my branch, but I forgot...
* | proto: Remove unnecessary clippy allowGabriela Moldovan2026-04-201-2/+0
| | | | | | | | | | I'm removing this so that we don't accidentally suppress new instances of this warning.
* | tor-proto: give our rsa ident to the channel reactorSteven Engler2026-04-164-3/+21
|/ | | | 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.
* proto: Move DummyChan/DummyChanProvider to relay channel.rsDavid Goulet2026-04-142-64/+77
| | | | | | | | | From the reactor.rs to channel.rs, makes more sense and we'll need it in the handshake tests. No behavior change, just code movement and a function rename. Signed-off-by: David Goulet <[email protected]>
* 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-142-0/+162
| | | | | | | | | | | | | 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]>
* tor-proto: give our ed ident to the channel reactorSteven Engler2026-04-094-1/+31
| | | | 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.
* relay: Pass advertise SocketAddr to channel builder instead of IpAddrDavid Goulet2026-04-092-8/+8
| | | | | | | | | | This trickles down to the tor-proto channel handshake code. But, the real need is in the channel builder in order to validate the outbound channel target. Fixes #2440 Signed-off-by: David Goulet <[email protected]>
* Merge branch 'create-fast' into 'main'gabi-2502026-04-091-55/+70
|\ | | | | | | | | tor-proto: Move CREATE_FAST handling to a helper See merge request tpo/core/arti!3869
| * 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
| |
| * tor-proto: rustfmtSteven Engler2026-04-081-6/+3
| | | | | | | | Fix formatting from previous code movement.
| * tor-proto: move CREATE_FAST handlingSteven Engler2026-04-081-45/+43
| | | | | | | | | | This moves the code, changes the indentation, and wraps the result in an `Ok()`.
| * tor-proto: prepare to move CREATE_FAST handling to a helperSteven Engler2026-04-081-8/+34
| |
| * tor-proto: remove old TODOSteven Engler2026-04-081-1/+0
| | | | | | | | This had already been resolved.
* | proto: Bring back AuthLogDigest and explicitly convert to SLOG/CLOGDavid Goulet2026-04-082-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | From opara's comment: https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3844#note_3388789 Keep the low level AuthLogDigest type alias and return it. The callsite is the one deciding if the returned digest is a Clog or a Slog. Related to #2441 Signed-off-by: David Goulet <[email protected]>
* | proto: Add ClogDigest and SlogDigest typesDavid Goulet2026-04-084-21/+28
|/ | | | | | | | | Introduce those types in order to avoid mixing them up as the previous AuthLogDigest was just a type alias over [u8; 32] Fixes #2441 Signed-off-by: David Goulet <[email protected]>
* tor-proto: replace use of `ChannelDirection` with `CircIdRange`Steven Engler2026-04-082-5/+7
|
* tor-{proto,chanmgr}: change how channels accept a CREATE* handlerSteven Engler2026-04-084-5/+54
| | | | | | | | | | | 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: simplify error handling in `CreateRequestHandler::handle_create()`Steven Engler2026-04-081-71/+85
|