Struct tor_hsclient::HsClientConnector
source · 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 client authentication (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
client authentication keys to use -
or default
if client auth is not required.
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 = 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<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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§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>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§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.§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.