Trait HoprSessionClientOperations
pub trait HoprSessionClientOperations: Send + Sync {
type Session: AsyncRead + AsyncWrite + Send + Unpin;
type SessionConfigurator: Send;
type Target: Send;
type Config: Send;
type Error: Error + Send + Sync + 'static;
// Required method
fn connect_to<'life0, 'async_trait>(
&'life0 self,
destination: Address,
target: Self::Target,
config: Self::Config,
) -> Pin<Box<dyn Future<Output = Result<(Self::Session, Self::SessionConfigurator), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
}Expand description
Trait for establishing HOPR sessions to remote destinations.
The concrete session, configurator, target, and config types are defined by the implementor (typically hopr-lib), keeping transport-level types out of the API crate.
Required Associated Types§
type Session: AsyncRead + AsyncWrite + Send + Unpin
type Session: AsyncRead + AsyncWrite + Send + Unpin
An established session implementing async read/write.
type SessionConfigurator: Send
type SessionConfigurator: Send
Handle for controlling a session after creation (e.g. keep-alive, SURB config).
Required Methods§
fn connect_to<'life0, 'async_trait>(
&'life0 self,
destination: Address,
target: Self::Target,
config: Self::Config,
) -> Pin<Box<dyn Future<Output = Result<(Self::Session, Self::SessionConfigurator), Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn connect_to<'life0, 'async_trait>(
&'life0 self,
destination: Address,
target: Self::Target,
config: Self::Config,
) -> Pin<Box<dyn Future<Output = Result<(Self::Session, Self::SessionConfigurator), Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Establishes a new session to the given destination via the HOPR network.
Returns the session (implementing [AsyncRead] + [AsyncWrite]) and a configurator
for controlling the session after creation.
Implementations may retry automatically on failure.