aboutsummaryrefslogtreecommitdiff
path: root/crates/arti-relay/src/tasks
Commit message (Collapse)AuthorAgeFilesLines
* relay: Keep desc publisher idle until encoding is implementedDavid Goulet2026-07-281-1/+2
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Make build_descriptor() return Arc<str>David Goulet2026-07-281-9/+2
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Get rid of our custom relay desc uploaderDavid Goulet2026-07-281-51/+20
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Use mpsc_channel_no_memquota for tasks' queueDavid Goulet2026-07-282-4/+5
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Adjust the try_send() error messageDavid Goulet2026-07-282-3/+6
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Use warn_report on crypto task command failureDavid Goulet2026-07-281-1/+2
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Use DirectHttpUploader for the desc taskDavid Goulet2026-07-281-31/+12
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Return bug error if dir authority has no address(es)David Goulet2026-07-281-3/+4
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Make compute_targets() not return an OptionDavid Goulet2026-07-281-10/+10
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Remove runtime from desc task structDavid Goulet2026-07-281-11/+5
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Add crypto task command channelDavid Goulet2026-07-282-6/+89
| | | | | | | | | Give a tx to the descriptor task so it can request the keys when building a new descriptor. Implement the crypto task handling of that command channel. Signed-off-by: David Goulet <[email protected]>
* relay: Pass the desc task TX to the crypto taskDavid Goulet2026-07-283-4/+27
| | | | | | | | The crypto task can now signal the descriptor task that the keys have changed related to the relay descriptor (signing key and ntor keys) so a new descriptor can be built and uploaded. Signed-off-by: David Goulet <[email protected]>
* relay: Implement descriptor upload in desc taskDavid Goulet2026-07-281-10/+29
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Pass the dirauth list to the desc taskDavid Goulet2026-07-281-6/+25
| | | | | | | Config reload is not fully supported just yet but when that comes, we'll need to make a task command for new targets. Signed-off-by: David Goulet <[email protected]>
* relay: Initial skeleton of the descriptor upload taskDavid Goulet2026-07-281-0/+254
| | | | | | | | | This is the basics, with many TODO(relay), for a relay descriptor upload task which uses tor-dirpublish::Publisher. Future commits will implement the several todo!(). Signed-off-by: David Goulet <[email protected]>
* tor-proto: remove `CircNetParameters::extend_by_ed25519_id`Steven Engler2026-07-271-4/+1
| | | | | We never used this, it was just needed because we used to convert to a `CircParameters` which required this.
* arti-relay: simplify tests by removing some `Arc`sSteven Engler2026-07-203-14/+10
|
* arti-relay: remove `Arc` from around `KeyMgr`Steven Engler2026-07-201-7/+7
| | | | Fixes a TODO.
* arti-relay: make `FullKeyView` generic over a `Borrow<KeyMgr>`Steven Engler2026-07-203-8/+19
| | | | Now it can be used with `KeyMgr` and `&KeyMgr`, not only `Arc<KeyMgr>`.
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-093-0/+3
| | | | | | | | | | | | 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.
* 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-282-14/+16
| | | | | | | | | | | | | 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-281-4/+5
| | | | | | | | | | 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-281-10/+52
| | | | | | | | | | | | | | | | | | | 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]>
* relay: Use futures::select instead of tokioDavid Goulet2026-05-261-4/+4
| | | | 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-261-42/+98
| | | | 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-262-45/+17
| | | | | | | | | | | | | 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-261-45/+9
| | | | | | 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-261-0/+34
| | | | 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]>