pub struct HsClientConnector<R: Runtime, D: MockableConnectorData = Data> { /* private fields */ }
Expand description
An object that negotiates connections with onion services
This can be used by multiple requests on behalf of different clients,
with potentially different HS service discovery keys (KS_hsc_*
)
and potentially different circuit isolation.
The principal entrypoint is
get_or_launch_connection()
.
This object is handle-like: it is fairly cheap to clone,
and contains Arc
s internally.
Implementations§
Source§impl<R: Runtime> HsClientConnector<R, Data>
impl<R: Runtime> HsClientConnector<R, Data>
Sourcepub fn new(
runtime: R,
circpool: Arc<HsCircPool<R>>,
config: &impl HsClientConnectorConfig,
housekeeping_prompt: BoxStream<'static, ()>,
) -> Result<Self, StartupError>
pub fn new( runtime: R, circpool: Arc<HsCircPool<R>>, config: &impl HsClientConnectorConfig, housekeeping_prompt: BoxStream<'static, ()>, ) -> Result<Self, StartupError>
Create a new HsClientConnector
housekeeping_prompt
should yield “occasionally”,
perhaps every few hours or maybe daily.
In Arti we arrange for this to happen when we have a new consensus.
Housekeeping events shouldn’t arrive while we’re dormant, since the housekeeping might involve processing that ought to be deferred.
Sourcepub fn get_or_launch_circuit<'r>(
&'r self,
netdir: &'r Arc<NetDir>,
hs_id: HsId,
secret_keys: HsClientSecretKeys,
isolation: StreamIsolation,
) -> impl Future<Output = Result<Arc<ClientCirc>, ConnError>> + Send + Sync + 'r
pub fn get_or_launch_circuit<'r>( &'r self, netdir: &'r Arc<NetDir>, hs_id: HsId, secret_keys: HsClientSecretKeys, isolation: StreamIsolation, ) -> impl Future<Output = Result<Arc<ClientCirc>, ConnError>> + Send + Sync + 'r
Connect to a hidden service
On success, this function will return an open
rendezvous circuit with an authenticated connection to the onion service
whose identity is hs_id
. If such a circuit already exists, and its isolation
is compatible with isolation
, that circuit may be returned; otherwise,
a new circuit will be created.
Once a circuit is returned, the caller can use it to open new streams to the
onion service. To do so, call ClientCirc::begin_stream
on it.
Each HS connection request must provide the appropriate
service discovery keys to use -
or default
if the hidden service is not running in restricted discovery mode.
Sourcepub fn get_or_launch_connection<'r>(
&'r self,
netdir: &'r Arc<NetDir>,
hs_id: HsId,
secret_keys: HsClientSecretKeys,
isolation: StreamIsolation,
) -> impl Future<Output = Result<Arc<ClientCirc>, ConnError>> + Send + Sync + 'r
👎Deprecated since 0.5.1: Use get_or_launch_circuit instead.
pub fn get_or_launch_connection<'r>( &'r self, netdir: &'r Arc<NetDir>, hs_id: HsId, secret_keys: HsClientSecretKeys, isolation: StreamIsolation, ) -> impl Future<Output = Result<Arc<ClientCirc>, ConnError>> + Send + Sync + 'r
A deprecated alias for get_or_launch_circuit
.
We renamed it to be more clear about what exactly it is launching.
Trait Implementations§
Auto Trait Implementations§
impl<R, D> Freeze for HsClientConnector<R, D>
impl<R, D = Data> !RefUnwindSafe for HsClientConnector<R, D>
impl<R, D> Send for HsClientConnector<R, D>
impl<R, D> Sync for HsClientConnector<R, D>
impl<R, D> Unpin for HsClientConnector<R, D>
impl<R, D = Data> !UnwindSafe for HsClientConnector<R, D>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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 more