diff options
author | Nick Mathewson <nickm@torproject.org> | 2024-03-06 11:49:46 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2024-03-12 09:43:14 -0400 |
commit | cfb2ec7b4eb1817625fb4ed0916673b4b84f27eb (patch) | |
tree | eb25f80dd0b9ae73b909db024dc49a6158d9991c | |
parent | 3042830920b11775a135b7e7d0a50c0450c896e3 (diff) | |
download | arti-cfb2ec7b4eb1817625fb4ed0916673b4b84f27eb.tar.gz arti-cfb2ec7b4eb1817625fb4ed0916673b4b84f27eb.zip |
circmgr: Rename "any exit" code to reflect its real purpose
(These functionalities are for onion service circuits, and don't
actually need to go to an exit at all.)
-rw-r--r-- | crates/tor-circmgr/src/path/exitpath.rs | 17 | ||||
-rw-r--r-- | crates/tor-circmgr/src/usage.rs | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/crates/tor-circmgr/src/path/exitpath.rs b/crates/tor-circmgr/src/path/exitpath.rs index ab265ec6e..36655bb60 100644 --- a/crates/tor-circmgr/src/path/exitpath.rs +++ b/crates/tor-circmgr/src/path/exitpath.rs @@ -44,7 +44,7 @@ enum ExitPathBuilderInner<'a> { /// Request a path to any relay, even those that cannot exit. // TODO: #785 may make this non-conditional. #[cfg(feature = "hs-common")] - AnyRelay, + AnyRelayForOnionService, /// Request a path that uses a given relay as exit node. ChosenExit(Relay<'a>), @@ -120,6 +120,7 @@ impl<'a> ExitPathBuilder<'a> { } /// Create a new builder that will try to build a three-hop non-exit path + /// for use with the onion services protocols /// that is compatible with being extended to an optional given relay. /// /// (The provided relay is _not_ included in the built path: we only ensure @@ -130,9 +131,9 @@ impl<'a> ExitPathBuilder<'a> { /// Perhaps we should rename ExitPathBuilder, split it into multiple types, /// or move this method. #[cfg(feature = "hs-common")] - pub(crate) fn for_any_compatible_with(compatible_with: Option<OwnedChanTarget>) -> Self { + pub(crate) fn for_onion_service(compatible_with: Option<OwnedChanTarget>) -> Self { Self { - inner: ExitPathBuilderInner::AnyRelay, + inner: ExitPathBuilderInner::AnyRelayForOnionService, compatible_with, require_stability: true, } @@ -187,9 +188,11 @@ impl<'a> ExitPathBuilder<'a> { } #[cfg(feature = "hs-common")] - ExitPathBuilderInner::AnyRelay => { - // XXXX This enum variant is badly named! - RelaySelector::new(RelayUsage::any_exit(rs_cfg), guard_exclusion) + ExitPathBuilderInner::AnyRelayForOnionService => { + // TODO: This usage is a bit convoluted, and some onion-service- + // related circuits don't need this much stability. + let usage = RelayUsage::middle_relay(Some(&RelayUsage::new_intro_point())); + RelaySelector::new(usage, guard_exclusion) } ExitPathBuilderInner::WantsPorts(wantports) => RelaySelector::new( @@ -368,7 +371,7 @@ impl<'a> ExitPathBuilder<'a> { #[cfg(feature = "geoip")] ExitInCountry { .. } => "country-specific exit circuit", AnyExit { .. } => "testing circuit", - AnyRelay => "onion-service circuit", // XXXX badly named. + AnyRelayForOnionService => "onion-service circuit", ChosenExit(_) => "circuit to a specific exit", } } diff --git a/crates/tor-circmgr/src/usage.rs b/crates/tor-circmgr/src/usage.rs index e54f41c09..b26bbe12a 100644 --- a/crates/tor-circmgr/src/usage.rs +++ b/crates/tor-circmgr/src/usage.rs @@ -327,7 +327,7 @@ impl TargetCircUsage { compatible_with_target, } => { let (path, mon, usable) = - ExitPathBuilder::for_any_compatible_with(compatible_with_target.clone()) + ExitPathBuilder::for_onion_service(compatible_with_target.clone()) // TODO: We don't actually require stability if this is a // HsDir circuit: but at this point, we can't tell. .require_stability(true) |