aboutsummaryrefslogtreecommitdiff
path: root/crates/arti-relay/src/relay.rs
Commit message (Collapse)AuthorAgeFilesLines
* relay: Add needeed changes to dirmirror todo commentDavid Goulet2026-07-281-1/+2
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Move authorities ownership to TorRelayDavid Goulet2026-07-281-3/+12
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Remove runtime from desc task structDavid Goulet2026-07-281-2/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Add crypto task command channelDavid Goulet2026-07-281-6/+6
| | | | | | | | | 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-281-2/+1
| | | | | | | | 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: Pass the dirauth list to the desc taskDavid Goulet2026-07-281-5/+11
| | | | | | | 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/+21
| | | | | | | | | 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]>
* arti-relay: Turn a TODO(relay-tuning) into TODO DIRMIRRORGabriela Moldovan2026-07-221-1/+1
| | | | | Context: https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4222#note_3437336
* arti-relay: Add a TODO from @oparaGabriela Moldovan2026-07-221-0/+5
|
* arti-relay: Spawn a DirMirror::serve() taskGabriela Moldovan2026-07-221-2/+6
|
* arti-relay: Store a DirMirror in TorRelayGabriela Moldovan2026-07-221-0/+15
| | | | | | | | | This will be used shortly, as we need to spawn a `DirMirror::serve()` task from `TorRelay::run()` for handling the incoming directory stream requests. The `DirMirror` is currently built from dummy data because there is no config for it yet.
* arti-relay: Add a task for handling incoming streamsGabriela Moldovan2026-07-221-0/+22
| | | | | This is just the skeleton of the task. The implementation will follow later.
* proto: Return the incoming streams from the create handlerGabriela Moldovan2026-07-221-2/+11
| | | | | | | | | | | 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
* arti-relay: remove `Arc` from around `KeyMgr`Steven Engler2026-07-201-10/+5
| | | | Fixes a TODO.
* proto: Pass the allowed incoming commands to CreateRequestHandlerGabriela Moldovan2026-06-301-0/+6
| | | | | | | | | | | 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-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.
* relay: Recompute valid_until cache in view constructorDavid Goulet2026-05-281-1/+1
| | | | | | | | | | | | | 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: Rename try_generate_keys()David Goulet2026-05-281-3/+2
| | | | | | | | | | 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-23/+19
| | | | | | | | | | | | | | | | | | | 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: Crypto task now listens for new consensusDavid Goulet2026-05-261-0/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Set the FullKeyView in InerTorRelayDavid Goulet2026-05-261-16/+13
| | | | | | | | | | | | | 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: Spawn new crypto reactorDavid Goulet2026-05-261-14/+15
| | | | | | This also remove unused code from this change. Signed-off-by: David Goulet <[email protected]>
* tor-rtcompat+misc: add `NetStreamProvider::ListenOptions`Steven Engler2026-05-071-1/+4
| | | | | | | | | This adds the trait type `ListenOptions` to `NetStreamProvider` and adds this `ListenOptions` as an argument to `NetStreamProvider::listen()`. You probably want to look at the changes in tor-rtcompat first, then the rest of this commit is updating the various places we use `NetStreamProvider`.
* proto: Make the CreateRequestHandler::new() take the ntor keysDavid Goulet2026-04-211-2/+8
| | | | Signed-off-by: David Goulet <[email protected]>
* arti-relays: Pass a CreateRequestHandler to the crypto task (fmt)Gabriela Moldovan2026-04-091-3/+8
|
* arti-relays: Pass a CreateRequestHandler to the crypto taskGabriela Moldovan2026-04-091-1/+2
| | | | This will need to be updated each time the ntor keys change.
* relay: Pass advertise SocketAddr to channel builder instead of IpAddrDavid Goulet2026-04-091-1/+1
| | | | | | | | | | 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]>
* arti-relay: add support for a `CreateRequestHandler`Steven Engler2026-04-081-1/+53
|
* proto: Rename RelayIdentities to RelayChannelAuthMaterialDavid Goulet2026-03-301-5/+5
| | | | | | | | | | | | This object contains a melting pot of public keys, private keys and certificates. Rename it to reflect that it is channel authentication material and not "identities. https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3791#note_3374454 Signed-off-by: David Goulet <[email protected]>
* relay: Make the crypto tasks use the runtime wallclockDavid Goulet2026-03-171-1/+1
| | | | | | This way we can unit tests properly. Signed-off-by: David Goulet <[email protected]>
* Fix windows cargo warningsTobias Stoeckmann2026-03-151-1/+3
| | | | Disable use-statements which are only needed for unix.
* arti-relay: Log relay identitiesSteven Engler2026-03-121-0/+5
|
* tor-basic-utils: move `iter_join` from arti-relaySteven Engler2026-03-031-1/+2
| | | | Will clean this up in the following commit.
* chanmgr: Responder relay channel now use the builder my_addrsDavid Goulet2026-02-241-15/+3
| | | | | | No need to pass from the arti relay binary our addresses when handling an incoming channel, use the one in the channel builder that an initiator channel uses.
* relay: Set ChanMgr with our addressesDavid Goulet2026-02-241-2/+3
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Update ChanMgr on key rotationDavid Goulet2026-02-241-1/+2
| | | | Signed-off-by: David Goulet <[email protected]>
* arti-relay: fix stale commentSteven Engler2026-02-231-1/+1
| | | | This method was renamed previously.
* relay: Get rid of start_task() for readabilityDavid Goulet2026-02-231-5/+9
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Generate relay identities at initDavid Goulet2026-02-231-4/+12
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Remove unused ephemeral keystoreDavid Goulet2026-02-231-5/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Move try_generate_keys() into crypto taskDavid Goulet2026-02-231-34/+2
| | | | | | | Move rotating keys into a function so we can use it in try_generate_keys() that is used at startup. Signed-off-by: David Goulet <[email protected]>
* relay: Add a crypto task for key rotationDavid Goulet2026-02-231-1/+7
| | | | | | | | | | | | | This task crypto module has a rotate key task that is in charge of rotating keys from our KeyMgr based on the valid until. To do so, we add a RotatableKeySpec trait to help us specify our to rotate a specific key. Allows us to have a generic rotate/generate function for all our keys. Task runs every 60 seconds. Taken from C-tor. Signed-off-by: David Goulet <[email protected]>
* relay: Add a TLS acceptor in the ChanBuilderDavid Goulet2026-02-091-7/+10
| | | | | | | | | | | | | | | This requires the `TlsKeyAndCert` so be passed on the TLS acceptor settings. We assume that `RelayIdentities` has this information. The ChanBuilder::new() was getting a bit too convoluted and feature gated to instead we introduce new_client() and new_relay() and remove the need for `with_identities()`. Because of this, the ChanMgr::new() now returns a `Result<>`. Related to #1597 Signed-off-by: David Goulet <[email protected]>
* arti-relay: launch the client's background tasksSteven Engler2026-02-031-6/+19
|
* arti-relay: rename 'bootstrap()' method to 'init()'Steven Engler2026-02-031-6/+7
| | | | This method won't really be used for bootstrapping anymore.
* arti-relay: move code into a "client" objectSteven Engler2026-02-031-64/+17
|
* relay: Pass advertised addresses to the channel handlerDavid Goulet2026-01-221-3/+15
| | | | | | | | | | | We need the advertised addresses for the NETINFO cell when opening a relay channel. Keep them in the TorRelay object so we can pass them to the ChanMgr channel handler. This will also help with config reload where only the local values in TorRelay will need to be updated. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Introduce a ChanMgrConfig structDavid Goulet2026-01-131-2/+2
| | | | | | | | | | | | This struct is used to pass configuration parameters to the ChanMgr when building it. At the moment, it holds the ChannelConfig and RelayIdentities (feature gated) which will be used in subsequent commits. Note that relays do require RelayIdentities to build channels. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Remove KeyMgr from constructorDavid Goulet2026-01-131-1/+0
| | | | | | | We'll rely on a RelayIdentities to pass in the right keys to the ChanMgr instead of the entire KeyMgr. Signed-off-by: David Goulet <[email protected]>
* arti-relay: added more commentsSteven Engler2025-12-181-0/+7
|