summaryrefslogtreecommitdiff
path: root/crates/arti-relay
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'version-bumps'Nick Mathewson2026-06-301-29/+30
|\
| * Version bumps for 2.5.0Nick Mathewson2026-06-301-29/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | Closes #2617. We've lucked out this time, and it turns out that every one of our published crates gets a minor bump. So this was generated with: ``` for cr in $(./maint/list-crates); do cargo set-version -p $cr --bump minor done ```
* | Run cargo sort in arti-relay.Nick Mathewson2026-06-301-4/+3
| |
* | arti-relay: Make "metrics" experimentalNick Mathewson2026-06-301-2/+0
| | | | | | | | | | It was both in "metrics" and in "experimental"; I think the latter was intended.
* | Run "fixup-features".Nick Mathewson2026-06-301-0/+2
|/
* arti-relay: Link IncomingStreamRequestFilter in RequestFilterGabriela Moldovan2026-06-291-1/+2
| | | | | Suggested by opara in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4145#note_3430815
* proto: Pass an IncomingStreamRequestFilter factory to the create handlerGabriela Moldovan2026-06-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* arti-relay: Add an unimplemented stream request filterGabriela Moldovan2026-06-292-0/+24
| | | | | | This is currently just a placeholder that accepts all stream requests. It will be fleshed out later, as part of #1448
* Bump MSRV to 1.91Clara Engler2026-06-151-1/+1
| | | | | | | | | | | | | | | | | | | This commit bumps the MSRV to 1.91 which was released on 2025-10-30. The Cargo.toml files were updated as follows: ```sh git ls-files | \ grep ".*Cargo\.toml$" | \ xargs sed -i '' 's/^rust-version = "1\.89"$/rust-version = "1\.91"/g' ``` The following files were updated manually: ``` modified: .gitlab-ci.yml modified: README.md modified: flake.nix modified: maint/docker-android/Dockerfile ```
* Merge branch 'clippy-string-slice' into 'main'Nick Mathewson2026-06-107-0/+7
|\ | | | | | | | | Lint for clippy::string_slice See merge request tpo/core/arti!4086
| * maint: Run maint/add_warning to deny string slicesClara Engler2026-06-097-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* | Bump derive-deftly to 1.11.3Ian Jackson2026-06-091-1/+1
|/ | | | New beta semver policy means we should pin the patchlevel.
* Upgrade tokio to LTS 1.47.1Neel Chauhan2026-06-031-1/+1
| | | | Closes #2137.
* tor-chanmgr: Add metrics.Wesley Aptekar-Cassels2026-06-021-1/+6
| | | | | | This adds a structure to initialize metrics when the `ChanMgr` is created, and adds a counter for the total number of channels built, broken down by success and failure.
* Bump all the unstable tor- and arti- crates to 0.43.0Gabriela Moldovan2026-06-011-26/+26
| | | | | | | | | | Done using: ``` for crate in $(./maint/list-crates | rg '^(tor|arti-)'); do cargo set-version -p $crate 0.43.0 done ```
* Bump the versions of the non-{arti-,tor-} cratesGabriela Moldovan2026-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The non-{arti-,tor-} crates are: ``` ./maint/list-crates | rg -v '^(tor|arti)' oneshot-fused-workaround web-time-compat slotmap-careful test-temp-dir fslock-guard hashx equix caret fs-mistrust safelog retry-error futures-copy ``` We split them in the following categories: * crates with no changes (no version bumps): ``` oneshot-fused-workaround: No change. web-time-compat: No change. slotmap-careful: No change. test-temp-dir: No change. caret: No change. safelog: No change. retry-error: No change. futures-copy: No change. ``` Obtained with: ``` maint/changed-crates -v "arti-v$LAST_VERSION" 2>&1 >/dev/null | grep -i "no change" | grep -v '\(tor\|arti\)-' ``` * crates that only have non-functional changes (bump the patch version, but not the dependend-on version): - equix * crates where functional changes were made, but no APIs were broken (bump patch): - fs-mistrust * crates where APIs were broken (bump minor): - hashx - fslock-guard The bumps from this commit were created using this script: ``` PATCH_NF=( equix ) PATCH=" fs-mistrust " MINOR=" hashx fslock-guard " ./maint/bump-nodep "${PATCH_NF[@]}" for crate in $PATCH; do cargo set-version --bump patch -p $crate; done for crate in $MINOR; do cargo set-version --bump minor -p $crate; done ```
* arti-relay: Make the metrics feature non-experimentalGabriela Moldovan2026-06-011-6/+1
| | | | | | | | | `maint/fixup-features` was complaining that `metrics` was reachable from `full` and also `__is_experimental`. I'm making `metrics` a non-experimental feature, because the whole of `arti-relay` is experimental (so there is really no need mark any of its individual features as experimental right now).
* relay: Remove docs type link that are outside scopeDavid Goulet2026-05-281-5/+5
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Recompute valid_until cache in view constructorDavid Goulet2026-05-283-15/+17
| | | | | | | | | | | | | The recompute of the valid_until cache is done now in the constructor of FullKeyView so the view is directly usable once built. Else, the caller always need to call the recompute function which is error prone especially when used as a throwaway view. Also, without this change, building the view and then attempting to log the public keys would fail. Signed-off-by: David Goulet <[email protected]>
* relay: Introduce src/task/crypto/keys.rsDavid Goulet2026-05-283-694/+745
| | | | | | | | | | | Move all key related action function to keys.rs in order to alleviate crypto.rs. The Reactor will get more functionnalities soon so cleanup. No behavior change, just code movement. Related to #2548
* relay: Rename try_rotate_keys_no_lock()David Goulet2026-05-281-11/+14
| | | | | | Remove the _no_lock() since no more locks now. Signed-off-by: David Goulet <[email protected]>
* relay: Make FullKeyView pub(super)David Goulet2026-05-282-13/+10
| | | | | | Now, the FullKeyView is officially only seen by the crypto task. Signed-off-by: David Goulet <[email protected]>
* relay: Remove locking of FullKeyViewDavid Goulet2026-05-282-114/+60
| | | | | | | | | | | | | | | | No need for the valid_until cache locking that used to ensure coherent view accross tasks. As we move towards having the FullKeyView be solely owned by the crypto task, no need for locking. Future commit will introduce a control command channel which will be used to get keys for other tasks. The valid_until cache is kept though because it helps with key lookups to avoid walking all keys each time. Signed-off-by: David Goulet <[email protected]>
* relay: Rename try_generate_keys()David Goulet2026-05-282-7/+7
| | | | | | | | | | Rename it to init_keys() so it capture the semantic of initialization especially that now it returns a InitKeyMaterial. This is so we don't use this function outside initialization in the future. Signed-off-by: David Goulet <[email protected]>
* relay: Make FullKewView solely owned by the crypto taskDavid Goulet2026-05-283-61/+71
| | | | | | | | | | | | | | | | | | | This moves commit makes it that FullKewView is not visible outside the crypto task. For this, we need to keep the KeyMgr in the inert tor relay struct until it is passed to the crypto task. The public keys logging is moved to the run() function of the crypto task and the try_generate_keys() now returns an InitKeyMaterial struct which contains the channel authentication key material (for ChanMgr) and the Ntor keys for the CREATE2 handler. This way, we cut the need of the FullKeyView in the main thread. Related to #2548 Signed-off-by: David Goulet <[email protected]>
* arti-relay: fix `unused_variables` warningSteven Engler2026-05-271-0/+1
|
* relay: Use futures::select instead of tokioDavid Goulet2026-05-262-5/+5
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Avoid using super::super:: and instead importDavid Goulet2026-05-261-14/+14
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Use a struct for key valid_until cacheDavid Goulet2026-05-262-88/+83
| | | | | | | | | Instead of a HashMap, use a struct that contains explicit valid_until value per key type as those won't change anytime soon. This is to have a smaller memory footprint and simpler design. Signed-off-by: David Goulet <[email protected]>
* relay: Rename crypto task reconcile() to recompute_valid_until()David Goulet2026-05-262-9/+9
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: .expect() on mutex lock failureDavid Goulet2026-05-262-26/+20
| | | | | | | This change made it that we don't need Result<> to be returned for two functions therefore affecting the callsites. Signed-off-by: David Goulet <[email protected]>
* relay: Small move of imports (fmt)David Goulet2026-05-261-5/+5
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Crypto task now listens for new consensusDavid Goulet2026-05-262-42/+99
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Add unit test for key view reconcile()David Goulet2026-05-262-1/+152
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Fix unit tests after crypto task rewriteDavid Goulet2026-05-261-56/+21
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Crypto task removal of get_ntor_keys()David Goulet2026-05-262-48/+2
| | | | | | | | | | This is the last piece that needed to be removed since we can use the view to get those keys. This also allows us to remove the temporary FullKeyView::keymgr() function and instead keep the keymgr access strictly to the view guard. Signed-off-by: David Goulet <[email protected]>
* relay: Set the FullKeyView in InerTorRelayDavid Goulet2026-05-264-105/+37
| | | | | | | | | | | | | This is so we early set the FullKeyView and we use it accross the code from initialization. The try_generate_keys() now takes a view and locks it to make its changes. And we also make build_proto_relay_auth_material() use a view to simplify its code and also stop relying on the KeyMgr for key accessors. Signed-off-by: David Goulet <[email protected]>
* relay: Crypto task uses the key view reconcile()David Goulet2026-05-261-38/+28
| | | | | | | This effectively removes KeyChange and use the returned set of key types that were rotated. Signed-off-by: David Goulet <[email protected]>
* relay: Add key view reconcile() for the valid_until cacheDavid Goulet2026-05-261-4/+72
| | | | | | | | | Rebuild the valid_until cache from the key manager and return which key has changed. Function is not used in this commit. Signed-off-by: David Goulet <[email protected]>
* relay: Unify crypto task try_rotate_keys()David Goulet2026-05-261-32/+20
| | | | | | | | | | | | | Rename the try_rotate_keys() to be explicit about no locking and use it in the Reactor. We need this try_rotate_keys() independent function so our first generate all keys can call it which is done before the reactor starts. Because we need crypto material in order to initialize the ChanMgr, we have to generate keys before spawning the task. Signed-off-by: David Goulet <[email protected]>
* relay: Spawn new crypto reactorDavid Goulet2026-05-262-59/+24
| | | | | | This also remove unused code from this change. Signed-off-by: David Goulet <[email protected]>
* relay: Crypto task try_generate_all is simplifiedDavid Goulet2026-05-261-28/+20
| | | | | | | | | | Like previous commit, we only care now if a generate has been done. It is enough of a signal to rebuild our channel auth material and set ntor keys. Part of the refactoring into phases. Signed-off-by: David Goulet <[email protected]>
* relay: Simplify the remove expired keys processDavid Goulet2026-05-261-37/+16
| | | | | | | | | | | | | | | | | The crypto task remove_expired_keys() only returns the next minimum expiry time of all keys it looked at if any remains. This is part of a broad refactoring of the task so we get to have three phases at each run that is: 1. Expire, 2. Rotate, 3. Reconcille With that design, we only need to know if a rotation happened and if so, we can signal other task that we did and rebuild the channel auth key material and ntor keys. The reconcille phase will be in charge of rebuilding the valid_until task of the view. Signed-off-by: David Goulet <[email protected]>
* relay: Fix race between key view and keymgr updateDavid Goulet2026-05-261-1/+10
| | | | | | | | | | The race will appear once we start using the FullKeyView accross the code in the next commit(s). This is also neat because it will enforce that the keymgr is only accessed with the write lock held. Signed-off-by: David Goulet <[email protected]>
* relay: Copy try_rotate_keys() into crypto reactorDavid Goulet2026-05-261-1/+25
| | | | | | | | | | This is a full copy without change (except the keymgr access) so that function becomes a Reactor function. Future commit will cleanup the original copy when the crypto reactor replaces the current task. Signed-off-by: David Goulet <[email protected]>
* relay: Implement new crypto reactor run_once()David Goulet2026-05-262-13/+60
| | | | | | | | | This basically copies the code from rotate_keys_task() and puts it in the run_once(). Cleanup will follow in the next commits to lock step changes. Signed-off-by: David Goulet <[email protected]>
* relay: Crypto new reactor scaffoldingDavid Goulet2026-05-262-1/+35
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Add FullKeyView in the crypto task moduleDavid Goulet2026-05-262-0/+191
| | | | | | | | | | | | | | This object wraps the `KeyMgr` and provide getters for all specific relay key types. That view is meant to access all keys a relay has. Upcoming restricted views will wrap that object to offer a limited view that is more domain specific. A valid_until cache is kept for all expirable keys so all get() of those keys always return the same one. Signed-off-by: David Goulet <[email protected]>
* relay: Don't error when metrics is configured but disabled.Wesley Aptekar-Cassels2026-05-261-4/+2
| | | | | This is not likely to cause any major problem, so just warning should be fine.
* arti-relay: Add metrics exporter.Wesley Aptekar-Cassels2026-05-263-1/+46
| | | | | | | | | This currently does not actually export any metrics, but puts the infrastructure in place to do so. This adds the `experimental`, `__is_experimental`, etc features to arti-relay. I presume we want to do that in the long term, but I'm not 100% sure on that.