pub enum IncomingMessage {
RendevouzInfo(RendevouzCode),
IdentityInfo {
fingerprint: IdentityFingerprint,
identity: Identity,
},
Send {
source: IdentityFingerprint,
destination: IdentityFingerprint,
payload: Vec<u8>,
},
}Expand description
Messages received by the client from the proxy server.
These messages are delivered via the channel returned by
ProxyProtocolClient::connect().
§Examples
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?;
while let Some(msg) = incoming.recv().await {
match msg {
IncomingMessage::Send { source, payload, .. } => {
println!("Message from {:?}: {} bytes", source, payload.len());
}
IncomingMessage::RendevouzInfo(code) => {
println!("Your rendezvous code: {}", code.as_str());
}
IncomingMessage::IdentityInfo { identity, .. } => {
println!("Found peer: {:?}", identity.fingerprint());
}
}
}Variants§
RendevouzInfo(RendevouzCode)
Server responded with a rendezvous code.
Received in response to ProxyProtocolClient::request_rendezvous().
The code can be shared with other clients to enable them to discover your identity.
Codes expire after 5 minutes and are single-use.
IdentityInfo
Server responded with a peer’s identity.
Received in response to ProxyProtocolClient::request_identity().
Contains the full identity and fingerprint of the peer who created the rendezvous code.
After receiving this, you can send messages to the peer using their fingerprint.
Fields
fingerprint: IdentityFingerprintSHA256 fingerprint of the peer’s identity
Send
Received a message from another client.
The source is cryptographically verified by the proxy server - it cannot be forged.
The payload should be decrypted or validated by the receiving client, as the proxy
does not inspect message contents.
Fields
source: IdentityFingerprintThe sender’s fingerprint (validated by proxy)
destination: IdentityFingerprintYour fingerprint (the recipient)
Trait Implementations§
Source§impl Clone for IncomingMessage
impl Clone for IncomingMessage
Source§fn clone(&self) -> IncomingMessage
fn clone(&self) -> IncomingMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more