pub struct UserClient { /* private fields */ }Expand description
A cloneable handle for controlling the user client.
Obtained from UserClient::connect(), which authenticates with the proxy,
spawns the event loop internally, and returns this handle. All methods
communicate with the event loop through an internal command channel.
Clone and Send — share freely across tasks and threads.
Implementations§
Source§impl UserClient
impl UserClient
Sourcepub async fn connect(
identity_provider: Box<dyn IdentityProvider>,
session_store: Box<dyn SessionStore>,
proxy_client: Box<dyn ProxyClient>,
notification_tx: Sender<UserClientNotification>,
request_tx: Sender<UserClientRequest>,
audit_log: Option<Box<dyn AuditLog>>,
) -> Result<Self, RemoteClientError>
pub async fn connect( identity_provider: Box<dyn IdentityProvider>, session_store: Box<dyn SessionStore>, proxy_client: Box<dyn ProxyClient>, notification_tx: Sender<UserClientNotification>, request_tx: Sender<UserClientRequest>, audit_log: Option<Box<dyn AuditLog>>, ) -> Result<Self, RemoteClientError>
Connect to the proxy server, spawn the event loop, and return a handle.
This is the single entry point. After connect() returns, the client is
already listening for incoming connections. Use get_psk_token() or
get_rendezvous_token() to set up pairings, and receive events through
the provided notification/request channels.
Pass None for audit_log to use a no-op logger.
Sourcepub async fn get_psk_token(
&self,
name: Option<String>,
) -> Result<String, RemoteClientError>
pub async fn get_psk_token( &self, name: Option<String>, ) -> Result<String, RemoteClientError>
Generate a PSK token for a new pairing.
Returns the formatted token string (<psk_hex>_<fingerprint_hex>).
Multiple PSK pairings are supported concurrently (each matched by psk_id).
Sourcepub async fn get_rendezvous_token(
&self,
name: Option<String>,
) -> Result<RendezvousCode, RemoteClientError>
pub async fn get_rendezvous_token( &self, name: Option<String>, ) -> Result<RendezvousCode, RemoteClientError>
Request a rendezvous code from the proxy for a new pairing.
Only one rendezvous pairing at a time — there’s no way to distinguish incoming rendezvous handshakes.
Trait Implementations§
Source§impl Clone for UserClient
impl Clone for UserClient
Source§fn clone(&self) -> UserClient
fn clone(&self) -> UserClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more