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.
- Challenge
Response - A signed response to an authentication challenge.
- Identity
- A public cryptographic identity.
- Identity
Fingerprint - A compact SHA256 fingerprint of an
Identity. - Proxy
Client Config - Configuration for creating a proxy client.
- Proxy
Protocol Client - Client for connecting to and communicating through a ap-proxy server.
- Rendezvous
Code - A temporary rendezvous code for peer discovery.
Enums§
- Identity
KeyPair - A cryptographic identity key-pair for signing challenges.
- Incoming
Message - Messages received by the client from the proxy server.
- Messages
- Protocol messages exchanged between clients and the proxy server.
- Proxy
Error - Errors that can occur during proxy client or server operations.
- Signature
Algorithm - Signature algorithm selection for key generation.