Skip to main content

Crate ap_proxy_client

Crate ap_proxy_client 

Source
Expand description

Client library for connecting to an ap-proxy WebSocket server.

This crate provides ProxyProtocolClient for connecting to a proxy server, authenticating, and sending/receiving messages.

§Example

use ap_proxy_client::{ProxyClientConfig, ProxyProtocolClient, IncomingMessage};

let config = ProxyClientConfig {
    proxy_url: "ws://localhost:8080".to_string(),
    identity_keypair: None,
};

let mut client = ProxyProtocolClient::new(config);
let mut incoming = client.connect().await?;

tokio::spawn(async move {
    while let Some(msg) = incoming.recv().await {
        match msg {
            IncomingMessage::Send { source, payload, .. } => {
                println!("Message from {:?}", source);
            }
            IncomingMessage::RendezvousInfo(code) => {
                println!("Your code: {}", code.as_str());
            }
            IncomingMessage::IdentityInfo { identity, .. } => {
                println!("Found peer: {:?}", identity.fingerprint());
            }
        }
    }
});

client.request_rendezvous().await?;

Structs§

Challenge
A cryptographic challenge issued by the proxy server for authentication.
ChallengeResponse
A signed response to an authentication challenge.
Identity
A public cryptographic identity.
IdentityFingerprint
A compact SHA256 fingerprint of an Identity.
ProxyClientConfig
Configuration for creating a proxy client.
ProxyProtocolClient
Client for connecting to and communicating through a ap-proxy server.
RendezvousCode
A temporary rendezvous code for peer discovery.

Enums§

IdentityKeyPair
A cryptographic identity key-pair for signing challenges.
IncomingMessage
Messages received by the client from the proxy server.
Messages
Protocol messages exchanged between clients and the proxy server.
ProxyError
Errors that can occur during proxy client or server operations.
SignatureAlgorithm
Signature algorithm selection for key generation.