pub(crate) struct HsCircPoolInner<B: AbstractTunnelBuilder<R> + 'static, R: Runtime> {
circmgr: Arc<CircMgrInner<B, R>>,
launcher_handle: OnceCell<TaskHandle>,
inner: Mutex<Inner<B::Tunnel>>,
}Expand description
An object to provide circuits for implementing onion services.
Fields§
§circmgr: Arc<CircMgrInner<B, R>>An underlying circuit manager, used for constructing circuits.
launcher_handle: OnceCell<TaskHandle>A task handle for making the background circuit launcher fire early.
inner: Mutex<Inner<B::Tunnel>>The mutable state of this pool.
Implementations§
Source§impl<R: Runtime> HsCircPoolInner<TunnelBuilder<R>, R>
impl<R: Runtime> HsCircPoolInner<TunnelBuilder<R>, R>
Sourcepub(crate) fn new(circmgr: &CircMgr<R>) -> Self
pub(crate) fn new(circmgr: &CircMgr<R>) -> Self
Internal implementation for HsCircPool::new.
Source§impl<B: AbstractTunnelBuilder<R> + 'static, R: Runtime> HsCircPoolInner<B, R>
impl<B: AbstractTunnelBuilder<R> + 'static, R: Runtime> HsCircPoolInner<B, R>
Sourcepub(crate) fn new_internal(circmgr: &Arc<CircMgrInner<B, R>>) -> Self
pub(crate) fn new_internal(circmgr: &Arc<CircMgrInner<B, R>>) -> Self
Create a new HsCircPoolInner from a CircMgrInner.
Sourcepub(crate) fn launch_background_tasks(
self: &Arc<Self>,
runtime: &R,
netdir_provider: &Arc<dyn NetDirProvider + 'static>,
) -> Result<Vec<TaskHandle>>
pub(crate) fn launch_background_tasks( self: &Arc<Self>, runtime: &R, netdir_provider: &Arc<dyn NetDirProvider + 'static>, ) -> Result<Vec<TaskHandle>>
Internal implementation for HsCircPool::launch_background_tasks.
Sourcepub(crate) async fn get_or_launch_client_rend<'a>(
&self,
netdir: &'a NetDir,
) -> Result<(B::Tunnel, Relay<'a>)>
pub(crate) async fn get_or_launch_client_rend<'a>( &self, netdir: &'a NetDir, ) -> Result<(B::Tunnel, Relay<'a>)>
Internal implementation for HsCircPool::get_or_launch_client_rend.
Sourcepub(crate) async fn get_or_launch_specific<T>(
&self,
netdir: &NetDir,
kind: HsCircKind,
target: T,
) -> Result<B::Tunnel>where
T: CircTarget + Sync,
pub(crate) async fn get_or_launch_specific<T>(
&self,
netdir: &NetDir,
kind: HsCircKind,
target: T,
) -> Result<B::Tunnel>where
T: CircTarget + Sync,
Helper for the HsCircPool functions that launch rendezvous,
introduction, or directory circuits.
Sourceasync fn extend_circ<T>(
&self,
circ: HsCircStem<B::Tunnel>,
params: CircParameters,
target: T,
) -> Result<B::Tunnel>where
T: CircTarget + Sync,
async fn extend_circ<T>(
&self,
circ: HsCircStem<B::Tunnel>,
params: CircParameters,
target: T,
) -> Result<B::Tunnel>where
T: CircTarget + Sync,
Try to extend a circuit to the specified target hop.
Sourcepub(crate) fn retire_all_circuits(&self) -> StdResult<(), ReconfigureError>
pub(crate) fn retire_all_circuits(&self) -> StdResult<(), ReconfigureError>
Internal implementation for HsCircPool::retire_all_circuits.
Sourceasync fn take_or_launch_stem_circuit<T>(
&self,
netdir: &NetDir,
avoid_target: Option<&T>,
kind: HsCircKind,
) -> Result<HsCircStem<B::Tunnel>>where
T: CircTarget + Sync,
async fn take_or_launch_stem_circuit<T>(
&self,
netdir: &NetDir,
avoid_target: Option<&T>,
kind: HsCircKind,
) -> Result<HsCircStem<B::Tunnel>>where
T: CircTarget + Sync,
Take and return a circuit from our pool suitable for being extended to avoid_target.
If vanguards are enabled, this will try to build a circuit stem appropriate for use
as the specified kind.
If vanguards are disabled, kind is unused.
If there is no such circuit, build and return a new one.
Sourceasync fn maybe_extend_stem_circuit<T>(
&self,
netdir: &NetDir,
circuit: HsCircStem<B::Tunnel>,
avoid_target: Option<&T>,
stem_kind: HsCircStemKind,
circ_kind: HsCircKind,
) -> Result<HsCircStem<B::Tunnel>>where
T: CircTarget + Sync,
async fn maybe_extend_stem_circuit<T>(
&self,
netdir: &NetDir,
circuit: HsCircStem<B::Tunnel>,
avoid_target: Option<&T>,
stem_kind: HsCircStemKind,
circ_kind: HsCircKind,
) -> Result<HsCircStem<B::Tunnel>>where
T: CircTarget + Sync,
Return a circuit of the specified kind, built from circuit.
Sourceasync fn extend_full_vanguards_circuit<T>(
&self,
netdir: &NetDir,
circuit: HsCircStem<B::Tunnel>,
avoid_target: Option<&T>,
stem_kind: HsCircStemKind,
circ_kind: HsCircKind,
) -> Result<HsCircStem<B::Tunnel>>where
T: CircTarget + Sync,
async fn extend_full_vanguards_circuit<T>(
&self,
netdir: &NetDir,
circuit: HsCircStem<B::Tunnel>,
avoid_target: Option<&T>,
stem_kind: HsCircStemKind,
circ_kind: HsCircKind,
) -> Result<HsCircStem<B::Tunnel>>where
T: CircTarget + Sync,
Extend the specified full vanguard circuit if necessary.
Sourcefn ensure_suitable_circuit<T>(
&self,
circ: &B::Tunnel,
target: Option<&T>,
kind: HsCircStemKind,
) -> Result<()>where
T: CircTarget + Sync,
fn ensure_suitable_circuit<T>(
&self,
circ: &B::Tunnel,
target: Option<&T>,
kind: HsCircStemKind,
) -> Result<()>where
T: CircTarget + Sync,
Ensure circ is compatible with target, and has the correct length for its kind.
Sourcefn ensure_circuit_length_valid(
&self,
tunnel: &B::Tunnel,
kind: HsCircStemKind,
) -> Result<()>
fn ensure_circuit_length_valid( &self, tunnel: &B::Tunnel, kind: HsCircStemKind, ) -> Result<()>
Ensure the specified circuit of type kind has the right length.
Sourcefn ensure_circuit_can_extend_to_target<T>(
tunnel: &B::Tunnel,
target: Option<&T>,
) -> Result<()>where
T: CircTarget + Sync,
fn ensure_circuit_can_extend_to_target<T>(
tunnel: &B::Tunnel,
target: Option<&T>,
) -> Result<()>where
T: CircTarget + Sync,
Ensure that it is possible to extend circ to target.
Returns an error if either of the last 2 hops of the circuit are the same as target,
because:
- a relay won’t let you extend the circuit to itself
- relays won’t let you extend the circuit to their previous hop
Sourcefn remove_closed(&self)
fn remove_closed(&self)
Internal: Remove every closed circuit from this pool.
Sourcefn remove_unlisted(&self, netdir: &NetDir)
fn remove_unlisted(&self, netdir: &NetDir)
Internal: Remove every circuit form this pool for which any relay is not
listed in netdir.
Sourcefn vanguard_mode(&self) -> VanguardMode
fn vanguard_mode(&self) -> VanguardMode
Returns the current VanguardMode.
Sourcepub(crate) fn estimate_timeout(&self, timeout_action: &Action) -> Duration
pub(crate) fn estimate_timeout(&self, timeout_action: &Action) -> Duration
Internal implementation for HsCircPool::estimate_timeout.
Auto Trait Implementations§
impl<B, R> !Freeze for HsCircPoolInner<B, R>
impl<B, R> !RefUnwindSafe for HsCircPoolInner<B, R>
impl<B, R> Send for HsCircPoolInner<B, R>
impl<B, R> Sync for HsCircPoolInner<B, R>
impl<B, R> Unpin for HsCircPoolInner<B, R>
impl<B, R> UnsafeUnpin for HsCircPoolInner<B, R>
impl<B, R> !UnwindSafe for HsCircPoolInner<B, R>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PossiblyOption<T> for T
impl<T> PossiblyOption<T> for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.