pub struct VCLConnection { /* private fields */ }Implementations§
Source§impl VCLConnection
impl VCLConnection
pub async fn bind(addr: &str) -> Result<Self, VCLError>
Sourcepub fn subscribe(&mut self) -> Receiver<VCLEvent>
pub fn subscribe(&mut self) -> Receiver<VCLEvent>
Subscribe to connection events. Returns an async receiver channel. Call before connect() / accept_handshake() to catch Connected event.
pub fn set_timeout(&mut self, secs: u64)
pub fn get_timeout(&self) -> u64
pub fn last_activity(&self) -> Instant
pub async fn connect(&mut self, addr: &str) -> Result<(), VCLError>
pub async fn accept_handshake(&mut self) -> Result<(), VCLError>
pub async fn send(&mut self, data: &[u8]) -> Result<(), VCLError>
Sourcepub async fn ping(&mut self) -> Result<(), VCLError>
pub async fn ping(&mut self) -> Result<(), VCLError>
Send a ping to the peer. The pong reply is handled automatically inside recv() — subscribe to events to receive PongReceived { latency }. You must keep calling recv() for the pong to be processed.
Sourcepub async fn rotate_keys(&mut self) -> Result<(), VCLError>
pub async fn rotate_keys(&mut self) -> Result<(), VCLError>
Initiate a key rotation. Generates a new X25519 ephemeral key pair, sends the public key to the peer, and waits for the peer’s response. Both sides atomically switch to the new shared secret. The peer must be in an active recv() loop to handle the rotation.
pub async fn recv(&mut self) -> Result<VCLPacket, VCLError>
pub fn close(&mut self) -> Result<(), VCLError>
pub fn is_closed(&self) -> bool
pub fn get_public_key(&self) -> Vec<u8> ⓘ
Auto Trait Implementations§
impl !Freeze for VCLConnection
impl RefUnwindSafe for VCLConnection
impl Send for VCLConnection
impl Sync for VCLConnection
impl Unpin for VCLConnection
impl UnsafeUnpin for VCLConnection
impl UnwindSafe for VCLConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more