Skip to main content

VCLConnection

Struct VCLConnection 

Source
pub struct VCLConnection { /* private fields */ }

Implementations§

Source§

impl VCLConnection

Source

pub async fn bind(addr: &str) -> Result<Self, VCLError>

Source

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.

Source

pub fn set_timeout(&mut self, secs: u64)

Source

pub fn get_timeout(&self) -> u64

Source

pub fn last_activity(&self) -> Instant

Source

pub fn set_shared_key(&mut self, private_key: &[u8])

Source

pub async fn connect(&mut self, addr: &str) -> Result<(), VCLError>

Source

pub async fn accept_handshake(&mut self) -> Result<(), VCLError>

Source

pub async fn send(&mut self, data: &[u8]) -> Result<(), VCLError>

Source

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.

Source

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.

Source

pub async fn recv(&mut self) -> Result<VCLPacket, VCLError>

Source

pub fn close(&mut self) -> Result<(), VCLError>

Source

pub fn is_closed(&self) -> bool

Source

pub fn get_public_key(&self) -> Vec<u8>

Source

pub fn get_shared_secret(&self) -> Option<[u8; 32]>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V