summaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr/src/builder.rs
Commit message (Collapse)AuthorAgeFilesLines
* chanmgr: Don't build relay channel if method is not DirectDavid Goulet2026-03-191-0/+6
| | | | Signed-off-by: David Goulet <[email protected]>
* chanmgr: Clarify the use of no identity ChanTargetDavid Goulet2026-03-191-6/+10
| | | | Signed-off-by: David Goulet <[email protected]>
* chanmgr: Don't get the peer cert as a responder channelDavid Goulet2026-03-191-9/+1
| | | | | | | | No initiator present a TLS certificate and so don't try to get one. Fixes #2388 Signed-off-by: David Goulet <[email protected]>
* safelog: Rename MaybeSensitive::hidden/visible()David Goulet2026-03-031-3/+4
| | | | | | Rename them to respectively sensitive() and not_sensitive(). Signed-off-by: David Goulet <[email protected]>
* chanmgr: Safely log the peer in the channel builderDavid Goulet2026-03-031-15/+21
| | | | | | | | | On I/O error, we safely log the peer address that was used that lead to this error. Closes #2375 Signed-off-by: David Goulet <[email protected]>
* proto: Make channel PeerAddr sensitiveDavid Goulet2026-03-031-1/+6
| | | | | | | Only the R2R channel that the PeerAddr becomes unsensitive. The rest, we keep it sensitive as it can be a client or a client's guard/bridge. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Rename function parameterDavid Goulet2026-02-261-3/+3
| | | | | | | It was _target before because we had it in the function with a cfg_if!(). Now don't so no need. Signed-off-by: David Goulet <[email protected]>
* chanmgr: The validate_relay_target() had its logic inversedDavid Goulet2026-02-261-4/+6
| | | | Signed-off-by: David Goulet <[email protected]>
* Merge branch 'chanbuilder-my-addrs' into 'main'David Goulet2026-02-241-6/+17
|\ | | | | | | | | chanmgr: Store our relay addresses in the builder See merge request tpo/core/arti!3716
| * chanmgr: Responder relay channel now use the builder my_addrsDavid Goulet2026-02-241-2/+1
| | | | | | | | | | | | 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.
| * chanmgr: Store our relay addresses in the builderDavid Goulet2026-02-241-4/+16
| | | | | | | | | | | | | | | | | | | | We need those addresses when we build a relay channel in order to send them into our NETINFO cell. This adds the `with_my_addrs()` on the `ChanMgrConfig` object. Next commit will make arti-relay use it. Signed-off-by: David Goulet <[email protected]>
* | chanmgr: Don't allow to build relay channel to ourselfDavid Goulet2026-02-241-3/+33
|/ | | | | | | | | | The validate_relay_target() is meant to probably have more checks in the future hence the vagueness of it instead of being specific to the goal of this patch. Closes #1699 Signed-off-by: David Goulet <[email protected]>
* chanmgr: Add a set_relay_identities() to update the RelayIdentitiesDavid Goulet2026-02-241-0/+11
| | | | | | | | | | The arti-relay crate rotates the keys at regular interval which we need to give to the ChanMgr to update its builder. This function boldly replace the default factory with the new identities including the TLS acceptor can pick up the new key. Signed-off-by: David Goulet <[email protected]>
* proto: Modify RelayIdentities to have encodable certDavid Goulet2026-02-231-1/+1
| | | | | | | This commit also adds the TlsKeyAndCert to the identities so the TLS acceptor can set it up. Signed-off-by: David Goulet <[email protected]>
* proto: Pass PeerAddr at the channel handshake finish for initiatorsDavid Goulet2026-02-191-4/+2
| | | | | | | | | | Responder relay handshake requires the peer address at the very start as it sends its NETINFO right away. For initiators, we only need it during the finalization process which is when the NETINFO is sent and the Channel is created. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Add a TODO() for logging PeerAddr instaed of ChanTargetDavid Goulet2026-02-191-0/+4
| | | | Signed-off-by: David Goulet <[email protected]>
* chanmgr: Fix channel builder commentDavid Goulet2026-02-191-6/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Use the PeerAddr accross channel handshakeDavid Goulet2026-02-191-23/+27
| | | | | | | This is a large change but it is basically using PeerAddr in the channel builder through the channel handshake code and into the Channel itself. Signed-off-by: David Goulet <[email protected]>
* Merge branch 'mr_3616_rebased' into 'main'Nick Mathewson2026-02-161-1/+1
|\ | | | | | | | | | | | | Mr 3616 rebased Closes #1800 See merge request tpo/core/arti!3681
| * tor-chanmgr: integrate outbound proxy into DefaultTransportNihal2026-02-161-1/+1
| |
* | relay: Pass our TLS cert to the responder verify processDavid Goulet2026-02-121-1/+6
|/ | | | | | | | | | For the responder to build the authentication data, it needs its own certificate of the TLS handshake that it is responding to (as a TLS server). This resolves an important TODO(relay) in the code. Signed-off-by: David Goulet <[email protected]>
* chan: Use Canonicity when choosing a channelDavid Goulet2026-02-121-0/+6
| | | | Signed-off-by: David Goulet <[email protected]>
* chanmgr: Use the actual channel target used on connect()David Goulet2026-02-121-16/+21
| | | | | | | | | | | | | | | When connecting, we pass an OwnedChanTarget that can contain a list of IPs of the relay we want to connect to. The connect() picks one and return the actual OwnedChanTarget used as in the real IP address we are using. From that point on, we must only use that as the channel canonicity requires to check against the IP we believe we are connected to. This also is much better to use for error handling considering the error is on the actual channel target, not the hypothetical one. Signed-off-by: David Goulet <[email protected]>
* proto: Channel finish() now handles canonicityDavid Goulet2026-02-121-0/+1
| | | | | | | | | | | | | | All handshake pass the NETINFO cell, the advertised addresses (if any) and the peer address in order to build the Canonicity and build the channel with it. In order to pull this off, the "my_addrs" were added to several object along the NETINFO cell. We also pass the channel method when connecting (initiator) to a relay as we need this for this canonicity build. Signed-off-by: David Goulet <[email protected]>
* proto: Relay responder channel allow to be non_exhaustiveDavid Goulet2026-02-091-1/+0
| | | | Signed-off-by: David Goulet <[email protected]>
* chanmgr: Fix the outbound_chan_type() to not be based on relay featureDavid Goulet2026-02-091-10/+4
| | | | | | | A client can have the relay feature enabled. The presence of "identities" is what dictates if we are a relay or not. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Build channel/reactor on incoming connectionsDavid Goulet2026-02-091-6/+74
| | | | | | | | Implement the accept_from_transport() in the ChanBuilder. This returns a `Channel` and spawns a reactor. Signed-off-by: David Goulet <[email protected]>
* relay: Add a TLS acceptor in the ChanBuilderDavid Goulet2026-02-091-12/+39
| | | | | | | | | | | | | | | 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]>
* chanmgr: Always use connect target for error reportingDavid Goulet2026-02-041-14/+6
| | | | Signed-off-by: David Goulet <[email protected]>
* chanmgr: Use the new tor-proto relay channel APIDavid Goulet2026-02-041-43/+112
| | | | | | | | | With specific types now for relay channels, add a function to build the channel and run the reactor. That function is feature gated and thus relay only. Signed-off-by: David Goulet <[email protected]>
* rtcompat: Return certificates as Cow.Nick Mathewson2026-02-021-1/+5
|
* proto: Remove async for VerifiableChannel::check()David Goulet2026-01-221-16/+15
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Send relay channel NETINFO in check()David Goulet2026-01-221-15/+19
| | | | | | | | | | Once channel is verified and authenticate if need be, send the NETINFO. We require our advertised IP addresses for this so pass them to launch() as well to the UnverifiedRelayChannel. A cargo fmt change slipped in here, sorry about that. Signed-off-by: David Goulet <[email protected]>
* proto: Make VerifiableChannel::check() asyncDavid Goulet2026-01-221-1/+1
| | | | | | | | | Relay initiator needs to send CERTS and AUTHENTICATE in that function after verifiying the channel. And thus require to be async. Signed-off-by: David Goulet <[email protected]>
* relay: Pass advertised addresses to the channel handlerDavid Goulet2026-01-221-1/+2
| | | | | | | | | | | 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: Get rid of the builder outbound_chan_typeDavid Goulet2026-01-131-8/+23
| | | | | | | | | | | | | | | | | | | Instead, we'll simply use `RelayInitiator` if the identity keys (identities) struct is set. This avoids the problem where someone could call outbound_chan_type() of the ChanMgrConfig and get the wrong channel type if with_identities() is set after. This way, a single call, `with_identities()` is what will define the outbound channel type so no chance of errors. This also removes the cfg_if {} around the builder creation in a much more simplified version. Related to #1599 Signed-off-by: David Goulet <[email protected]>
* chanmgr: Use the new tor-proto channel traits in builderDavid Goulet2026-01-131-170/+55
| | | | | | | Remove code duplication and simplifies the code by using the new VerifiableChannel and FinalizableChannel traits. Signed-off-by: David Goulet <[email protected]>
* proto: Add traits for public channel viewsDavid Goulet2026-01-131-1/+1
| | | | | | | | | | | | | | Add traits that will be returned outside tor-proto allowing us to not expose client and relay specific channels. The goal is for the tor-chanmgr to get those objects implementing those traits and can build and run the reactor without knowing the specific underlying type. This allows us to have less code duplication and less client/relay distinction in the chanmgr. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Add a relay channel connect to ChanBuilderDavid Goulet2026-01-131-9/+156
| | | | | | | | | | First, this is not great. Lots of duplicated code but it is a starting point that we can build on top to remove code duplication. Future commit will address this but for now, the client and relay mechanics are implemented. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Rename the connect_no_timeout() to be client specificDavid Goulet2026-01-131-6/+8
| | | | | | | | | | | | | | Heavy refactoring coming up for the ChanBuilder. This renames connect_no_timeout() to be client specific and uses the client channel builder directly instead of the generic one. Previous commit added the outbound ChannelType to the ChanBuilder which means that we'll soon have a relay specific function to connect using the relay channel builder. Refactoring will then happen for shared code in those two functions. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Add RelayIdentities to ChanBuilderDavid Goulet2026-01-131-4/+16
| | | | Signed-off-by: David Goulet <[email protected]>
* chanmgr: Add ChannelType to channel manager configDavid Goulet2026-01-131-2/+7
| | | | | | | | | | This allows us to pass it to the ChanBuilder which will be able to use this type for the outbound channels. For now, we do this trick where if we have relay identities, we always consider that all outbound channels will be RelayInitiator. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Remove KeyMgr from constructorDavid Goulet2026-01-131-7/+2
| | | | | | | 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]>
* Merge branch 'relay-bin-4' into 'main'opara2025-11-111-2/+4
|\ | | | | | | | | arti-relay: Add OR port listener task See merge request tpo/core/arti!3396
| * tor-chanmgr: wrap the peer address in `Sensitive`Steven Engler2025-11-051-2/+4
| | | | | | | | | | For incoming connections, wrap the peer address in `Sensitive` as it could be a client.
* | Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
|/ | | | Run maint/add_warning
* all: replace all uses of `futures::task::SpawnExt` with `tor_rtcompat::SpawnExt`Steven Engler2025-11-041-1/+1
|
* Use random_hostname() to pick an (E)SNINeel Chauhan2025-10-201-2/+4
| | | | | | Closes #2210. Edited-by: Nick Mathewson <[email protected]>
* opentelemetry: Add some instrument macros.Wesley Aptekar-Cassels2025-09-241-0/+3
| | | | | I've added these in places that are useful for the debugging that I've been doing.
* chan: Rename channel launch to launch_clientDavid Goulet2025-08-201-1/+1
| | | | Signed-off-by: David Goulet <[email protected]>