Skip to main content

Module connect

Module connect 

Source
Expand description

Main implementation of the connection functionality

Re-exportsยง

use std::collections::HashMap; ๐Ÿ”’
use std::fmt::Debug; ๐Ÿ”’
use std::fmt::Debug; ๐Ÿ”’
use std::marker::PhantomData; ๐Ÿ”’
use std::sync::Arc; ๐Ÿ”’
use async_trait::async_trait; ๐Ÿ”’
use educe::Educe; ๐Ÿ”’
use futures::AsyncRead; ๐Ÿ”’
use futures::AsyncWrite; ๐Ÿ”’
use itertools::Itertools; ๐Ÿ”’
use rand::RngExt; ๐Ÿ”’
use tor_bytes::Writeable; ๐Ÿ”’
use tor_cell::relaycell::hs::IntroduceAckStatus; ๐Ÿ”’
use tor_cell::relaycell::hs::intro_payload; ๐Ÿ”’
use tor_cell::relaycell::hs::intro_payload::IntroduceHandshakePayload; ๐Ÿ”’
use tor_cell::relaycell::hs::pow::ProofOfWork; ๐Ÿ”’
use tor_cell::relaycell::msg::AnyRelayMsg; ๐Ÿ”’
use tor_cell::relaycell::msg::Introduce1; ๐Ÿ”’
use tor_cell::relaycell::msg::Rendezvous2; ๐Ÿ”’
use tor_circmgr::build::onion_circparams_from_netparams; ๐Ÿ”’
use tor_circmgr::ClientOnionServiceDataTunnel; ๐Ÿ”’
use tor_circmgr::ClientOnionServiceDirTunnel; ๐Ÿ”’
use tor_circmgr::ClientOnionServiceIntroTunnel; ๐Ÿ”’
use tor_dirclient::SourceInfo; ๐Ÿ”’
use tor_error::Bug; ๐Ÿ”’
use tor_error::debug_report; ๐Ÿ”’
use tor_error::warn_report; ๐Ÿ”’
use tor_hscrypto::Subcredential; ๐Ÿ”’
use tor_hscrypto::time::TimePeriod; ๐Ÿ”’
use tor_netdir::params::NetParameters; ๐Ÿ”’
use tor_proto::TargetHop; ๐Ÿ”’
use tor_proto::client::circuit::handshake::hs_ntor; ๐Ÿ”’
use tor_proto::client::circuit::handshake::hs_ntor::HsNtorHkdfKeyGenerator; ๐Ÿ”’
use tracing::debug; ๐Ÿ”’
use tracing::instrument; ๐Ÿ”’
use tracing::instrument; ๐Ÿ”’
use tracing::trace; ๐Ÿ”’
use tracing::warn; ๐Ÿ”’
use web_time_compat::Duration; ๐Ÿ”’
use web_time_compat::Instant; ๐Ÿ”’
use web_time_compat::SystemTime; ๐Ÿ”’
use retry_error::RetryError; ๐Ÿ”’
use safelog::DispRedacted; ๐Ÿ”’
use safelog::Sensitive; ๐Ÿ”’
use tor_cell::relaycell::RelayMsg; ๐Ÿ”’
use tor_cell::relaycell::hs::AuthKeyType; ๐Ÿ”’
use tor_cell::relaycell::hs::EstablishRendezvous; ๐Ÿ”’
use tor_cell::relaycell::hs::IntroduceAck; ๐Ÿ”’
use tor_cell::relaycell::hs::RendezvousEstablished; ๐Ÿ”’
use tor_checkable::TimeBound; ๐Ÿ”’
use tor_checkable::timed::TimeRangeBound; ๐Ÿ”’
use tor_circmgr::hspool::HsCircPool; ๐Ÿ”’
use tor_circmgr::timeouts::Action as TimeoutsAction; ๐Ÿ”’
use tor_dirclient::request::Requestable as _; ๐Ÿ”’
use tor_error::HasRetryTime as _; ๐Ÿ”’
use tor_error::RetryTime; ๐Ÿ”’
use tor_error::internal; ๐Ÿ”’
use tor_error::into_internal; ๐Ÿ”’
use tor_hscrypto::RendCookie; ๐Ÿ”’
use tor_hscrypto::pk::HsBlindId; ๐Ÿ”’
use tor_hscrypto::pk::HsId; ๐Ÿ”’
use tor_hscrypto::pk::HsIdKey; ๐Ÿ”’
use tor_linkspec::CircTarget; ๐Ÿ”’
use tor_linkspec::HasRelayIds; ๐Ÿ”’
use tor_linkspec::OwnedCircTarget; ๐Ÿ”’
use tor_linkspec::RelayId; ๐Ÿ”’
use tor_llcrypto::pk::ed25519::Ed25519Identity; ๐Ÿ”’
use tor_netdir::NetDir; ๐Ÿ”’
use tor_netdir::Relay; ๐Ÿ”’
use tor_netdoc::doc::hsdesc::HsDesc; ๐Ÿ”’
use tor_netdoc::doc::hsdesc::IntroPointDesc; ๐Ÿ”’
use tor_proto::client::circuit::CircParameters; ๐Ÿ”’
use tor_proto::client::circuit::handshake; ๐Ÿ”’
use tor_proto::MetaCellDisposition; ๐Ÿ”’
use tor_proto::MsgHandler; ๐Ÿ”’
use tor_rtcompat::Runtime; ๐Ÿ”’
use tor_rtcompat::SleepProviderExt as _; ๐Ÿ”’
use tor_rtcompat::TimeoutError; ๐Ÿ”’
use crate::Config; ๐Ÿ”’
use crate::caps; ๐Ÿ”’
use crate::err::RendPtIdentityForError; ๐Ÿ”’
use crate::pow::HsPowClient; ๐Ÿ”’
use crate::proto_oneshot; ๐Ÿ”’
use crate::relay_info::ipt_to_circtarget; ๐Ÿ”’
use crate::state::MockableConnectorData; ๐Ÿ”’
use crate::ConnError; ๐Ÿ”’
use crate::DescriptorError; ๐Ÿ”’
use crate::DescriptorErrorDetail; ๐Ÿ”’
use crate::FailedAttemptError; ๐Ÿ”’
use crate::IntroPtIndex; ๐Ÿ”’
use crate::rend_pt_identity_for_error; ๐Ÿ”’
use crate::HsClientConnector; ๐Ÿ”’
use crate::HsClientSecretKeys; ๐Ÿ”’
use ConnError as CE; ๐Ÿ”’
use FailedAttemptError as FAE; ๐Ÿ”’

Macrosยง

DataTunnel ๐Ÿ”’
Given R, M where M: MocksForConnect<M>, expand to the mockable ClientCirc

Structsยง

Context ๐Ÿ”’
Common context for a single request to connect to a hidden service
Data
Information about a hidden service, including our connection history
HsDescForTp ๐Ÿ”’
An onion service descriptor and its associated HsBlindId.
Introduced ๐Ÿ”’
Details of an apparently-successful INTRODUCE exchange
IptExperience ๐Ÿ”’
How things went last time we tried to use this introduction point
IptExperienceMap ๐Ÿ”’
Marker type, to make typed Ipt exprience RelayIdFor keys
IptSortKey ๐Ÿ”’
Sort key for an introduction point, for selecting the best IPTs to try first
RefetchDescriptor ๐Ÿ”’
Token indicating that a descriptor fetch is wanted
RelayIdFor ๐Ÿ”’
Lookup key for looking up and recording information about a relay
Rendezvous ๐Ÿ”’
Details of an established rendezvous point
RequeryPeriodMap ๐Ÿ”’
Marker type, to make typed HsDir RelayIdFor keys
UsableIntroPt ๐Ÿ”’
Details of an apparently-useable introduction point

Enumsยง

IptSortKeyOutcome ๐Ÿ”’
Component of the IptSortKey representing outcome of our last attempt, if any

Traitsยง

MockableCircPool ๐Ÿ”’
Mock for HsCircPool
MockableClientData ๐Ÿ”’
Mock for onion service client data tunnel.
MockableClientDir ๐Ÿ”’
Mock for onion service client directory tunnel.
MockableClientIntro ๐Ÿ”’
Mock for onion service client introduction tunnel.
MocksForConnect ๐Ÿ”’
Mocks used for testing connect.rs

Functionsยง

connect ๐Ÿ”’
Actually make a HS connection, updating our recorded state as necessary
ensure_descriptor_compatible_with_params ๐Ÿ”’
Return an error if desc declares a set of parameters that is too far away from the consensus.

Type Aliasesยง

DataHsDesc ๐Ÿ”’
Part of Data that relates to the HS descriptor
DataHsDirs ๐Ÿ”’
Part of Data that relates to our information about the HsDir requery periods
DataIpts ๐Ÿ”’
Part of Data that relates to our information about introduction points
IptSortRand ๐Ÿ”’
Random value used as part of IPT selection
RelayIdForExperience ๐Ÿ”’
Lookup key for looking up and recording our IPT use experiences
RelayIdForRequeryPeriod ๐Ÿ”’
Lookup key for looking up and recording our IPT use experiences