summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src
Commit message (Collapse)AuthorAgeFilesLines
* proto rpc: Turn tunnel paths into a dictNick Mathewson2026-04-283-9/+40
| | | | | | | | | 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-282-0/+225
| | | | Additionally, allow inspecting tunnel paths directly from streams.
* proto: Allow DataStreamCtrl and ClientTunnel to be RPC objects.Nick Mathewson2026-04-282-0/+10
|
* proto: Wrap PeerInfo in Arc<>Gabriela Moldovan2026-04-233-9/+9
| | | | | | 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: Apply deferred rustfmtGabriela Moldovan2026-04-231-5/+2
|
* proto: Remove expect(unused) from channel PeerInfoGabriela Moldovan2026-04-231-1/+0
| | | | This is used in the relay circuit reactor.
* proto: Build the PeerInfo from the dummy target in the testsGabriela Moldovan2026-04-231-5/+14
| | | | | The new relay circuit reactor test expect the `PeerInfo` to be populated with the identity keys of the peer, and won't work without this change.
* 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 an accessor for the PeerInfo of a channelGabriela Moldovan2026-04-231-0/+6
|
* 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`.
* relay: Modify RelayNtorKeys to use a constructorDavid Goulet2026-04-211-7/+5
| | | | | | | | | | | | Because of the sorting requirement and the fact that a `KeyMgr` can have multiple Ntor keys, the caller now explicitly extract the two Ntor keys it wants from the `KeyMgr` and then creates a `RelayNtorKeys` object with them. Future changes (#2495) will move this into a view and warn if there are more than 2 keys. Signed-off-by: David Goulet <[email protected]>
* proto: Make the CreateRequestHandler::new() take the ntor keysDavid Goulet2026-04-212-14/+20
| | | | 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 'rust-1.95-warnings' into 'main'Nick Mathewson2026-04-211-13/+5
|\ | | | | | | | | Fix new warnings from Rust 1.95 See merge request tpo/core/arti!3902
| * tor-proto: Simplify a match+if statement.Nick Mathewson2026-04-211-13/+5
| |
* | Merge branch 'stream-close' into 'main'opara2026-04-201-6/+9
|\ \ | | | | | | | | | | | | tor-proto: Small comment and variable name changes See merge request tpo/core/arti!3865
| * | tor-proto: small comment and variable name changesSteven Engler2026-04-071-6/+9
| | | | | | | | | | | | I think this makes the code a little easier to follow.
* | | 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-166-5/+31
|/ / | | | | | | This will be needed for ntor handshakes.
* | proto: Remove unused imports in unit testsDavid Goulet2026-04-141-1/+1
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | proto: Fix relay unit tests with new CreateRequestHandlerDavid Goulet2026-04-141-1/+13
| | | | | | | | | | | | | | The CreateRequestHandler was introduced prior to the relay handshake unit tests so fix them now that we have a way to build one. Signed-off-by: David Goulet <[email protected]>
* | proto: Add a test helper function for building a CircNetParametersDavid Goulet2026-04-143-0/+86
| | | | | | | | | | | | | | | | | | 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-143-5/+3
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | proto: Add channel relay handshake unit testsDavid Goulet2026-04-144-182/+430
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 test certs module at the topDavid Goulet2026-04-141-31/+31
| | | | | | | | | | | | | | | | | | Just for mental sanity to have all const at the same place and easily readable. No behavior change. Signed-off-by: David Goulet <[email protected]>
* | proto: Move channel client handshake tests into client moduleDavid Goulet2026-04-143-218/+237
| | | | | | | | | | | | | | | | | | 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]>
* | tor-proto: handle a div-by-zero case that should never happenSteven Engler2026-04-131-3/+7
| | | | | | | | | | If this is zero, then it means that the consensus had bad values. But may as well check it anyways.
* | tor-proto: fix flow control side channel checksSteven Engler2026-04-131-35/+47
| |
* | tor-proto: change flow control `bytes_sent_total` to `u64`Steven Engler2026-04-131-9/+9
| |
* | tor-proto: add more tests for flow controlSteven Engler2026-04-131-0/+16
| |
* | Merge branch 'id-logging' into 'main'Jim Newsome2026-04-131-2/+2
|\ \ | | | | | | | | | | | | Tweak TunnelId and TunnelScopedCircId Display impls See merge request tpo/core/arti!3875
| * | Tweak Display for TunnelScopedCircIdJim Newsome2026-04-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Circuit IDs (UniqId) are displayed as "Circ <x>.<y>". Prior to this MR, these TunnelScopedCircId's were displayed as "Circ <t>.<x>.<y>" where t is the integer tunnel ID. This made corresponding logs a bit confusing as to why some "Circ" identifiers had two parts and some have three, and didn't make clear that the "<x>.<y>" part of the latter were comparable with the two-part UniqIds. The previous commit effectively changes the latter to "Circ Tunnel <t>.<x>.<y>", which is still a bit confusing. This commit changes the display of TunnelScopedCircId's to "Circ <x>.<y> (Tunnel <t>)", which makes the distinction between the circuit and tunnel IDs clearer.
| * | Tunnel ID: included "Tunnel" type-specifier in DisplayJim Newsome2026-04-091-1/+1
| | | | | | | | | | | | | | | | | | This is akin to how circuit `UniqId`'s are prefixed with "Circ", and helps clarify logs where it isn't always clear from context whether a tunnel ID or circuit ID is being displayed.
* | | tor-proto: small comment improvementSteven Engler2026-04-091-1/+2
| | |
* | | tor-proto: replace a tuple with a dedicated structSteven Engler2026-04-092-18/+29
| | |
* | | tor-proto: give our ed ident to the channel reactorSteven Engler2026-04-096-5/+48
| | | | | | | | | | | | 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-092-56/+71
|\ \ | | | | | | | | | | | | tor-proto: Move CREATE_FAST handling to a helper See merge request tpo/core/arti!3869