pub struct Endpoint { /* private fields */ }
Expand description

The Quic Endpoint structure

Implementations§

source§

impl Endpoint

source

pub fn new_server( bind_addr: SocketAddr, alpn: &[u8], cert_path: &str, pkey_path: &str, config: Config ) -> Result<Self, Error>

Create a QUIC Server Endpoint

source

pub fn new_client( bind_addr: SocketAddr, alpn: &[u8], cert_path: &str, config: Config ) -> Result<Self, Error>

Create a QUIC Client Endpoint

source

pub fn add_client_connection( &mut self, peer_addr: SocketAddr, server_name: &str ) -> Result<(), Error>

Add a connection for a Client Endpoint

Must be used on a Client and not a Server otherwise an error will be thrown

source

pub fn new_client_with_first_connection( bind_addr: SocketAddr, alpn: &[u8], cert_path: &str, peer_addr: SocketAddr, server_name: &str, config: Config ) -> Result<Self, Error>

Create a QUIC Client Endpoint with an initial connection

source

pub fn get_num_connections(&self) -> usize

Get the number of connections that the Endpoint is managing

source

pub fn update_keep_alive_duration(&mut self, duration_opt: Option<Duration>)

Update the keep alive duration time

Will disable the keep alive functionality if set to None

source

pub fn close_connection( &mut self, cid: &ConnectionId, error_code: u64 ) -> Result<bool, Error>

Close a connection with a given error code value

Returns true when connection close process has started

source

pub fn get_connection_socket_addr( &mut self, cid: &ConnectionId ) -> Result<SocketAddr, Error>

Get the socket address for a connection

This address could change if a backend connection migration happens (not currently implemented / expected)

source

pub fn main_stream_send( &mut self, cid: &ConnectionId, send_data: Vec<u8> ) -> Result<(), Error>

Send data over the main stream. This data is queued up if it cannot be sent immediately.

The main stream is a reliable (ordered) stream that focuses on communicating high-priority, small(ish) messages between the server and client.

A reminder that the Endpoint connection will be taking ownership of the data so it can be sent out when possible

source

pub fn rt_stream_send( &mut self, cid: &ConnectionId, send_data: Option<Vec<u8>>, last_send_of_time_segment: bool ) -> Result<(), Error>

Send data over the real-time stream. This data is queued up if it cannot be sent immediately.

The real-time “stream” is different than the main stream because it uses multiple incremental QUIC unidirectional streams in the backend where each stream id represents a single time segment that has unreliability the moment when the next single time segment arrives before the previous stream (time segment) had finished.

When last_send_of_time_segment is set to true, the currently transmitting time segment will finish after sending all the data that is in the queue (including the optional send_data) and the real-time stream id will be incremented for any future real-time stream send data.

If not all of the send data for a previous real-time stream id has made it to the peer by the time the next time segement real-time stream data is ready to be sent (with a call to this function) then the send queue will be cleared (unreliable transmission) and the next send data will take its place.

A reminder that the Endpoint connection will be taking ownership of the data so it can be sent out when possible

source

pub fn background_stream_send( &mut self, cid: &ConnectionId, send_data: Vec<u8> ) -> Result<(), Error>

Send data over the background stream. This data is queued up if it cannot be sent immediately.

The background stream is a reliable (ordered) stream that focuses on communicating large(ish) messages between the server and client such as a file transfer.

A reminder that the Endpoint connection will be taking ownership of the data so it can be sent out when possible

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.