Struct tuic_quinn::Connection

source ·
pub struct Connection<Side> { /* private fields */ }
Expand description

The TUIC Connection.

This struct takes a clone of quinn::Connection for performing TUIC operations.

See more details about the TUIC protocol at SPEC.md

Implementations§

source§

impl<Side> Connection<Side>

source

pub fn packet_native( &self, pkt: impl AsRef<[u8]>, addr: Address, assoc_id: u16 ) -> Result<(), Error>

Sends a Packet using UDP relay mode native.

source

pub async fn packet_quic( &self, pkt: impl AsRef<[u8]>, addr: Address, assoc_id: u16 ) -> Result<(), Error>

Sends a Packet using UDP relay mode quic.

source

pub fn task_connect_count(&self) -> usize

Returns the number of Connect tasks

source

pub fn task_associate_count(&self) -> usize

Returns the number of active UDP sessions

source

pub fn collect_garbage(&self, timeout: Duration)

Removes packet fragments that can not be reassembled within the specified timeout

source§

impl Connection<Client>

source

pub fn new(conn: QuinnConnection) -> Self

Creates a new client side Connection.

source

pub async fn authenticate( &self, uuid: Uuid, password: impl AsRef<[u8]> ) -> Result<(), Error>

Sends an Authenticate command.

source

pub async fn connect(&self, addr: Address) -> Result<Connect, Error>

Sends a Connect command.

source

pub async fn dissociate(&self, assoc_id: u16) -> Result<(), Error>

Sends a Dissociate command.

source

pub async fn heartbeat(&self) -> Result<(), Error>

Sends a Heartbeat command.

source

pub async fn accept_uni_stream(&self, recv: RecvStream) -> Result<Task, Error>

Try to parse a quinn::RecvStream as a TUIC command.

The quinn::RecvStream should be accepted by quinn::Connection::accept_uni() from the same quinn::Connection.

source

pub async fn accept_bi_stream( &self, send: SendStream, recv: RecvStream ) -> Result<Task, Error>

Try to parse a pair of quinn::SendStream and quinn::RecvStream as a TUIC command.

The pair of stream should be accepted by quinn::Connection::accept_bi() from the same quinn::Connection.

source

pub fn accept_datagram(&self, dg: Bytes) -> Result<Task, Error>

Try to parse a QUIC Datagram as a TUIC command.

The Datagram should be accepted by quinn::Connection::read_datagram() from the same quinn::Connection.

source§

impl Connection<Server>

source

pub fn new(conn: QuinnConnection) -> Self

Creates a new server side Connection.

source

pub async fn accept_uni_stream(&self, recv: RecvStream) -> Result<Task, Error>

Try to parse a quinn::RecvStream as a TUIC command.

The quinn::RecvStream should be accepted by quinn::Connection::accept_uni() from the same quinn::Connection.

source

pub async fn accept_bi_stream( &self, send: SendStream, recv: RecvStream ) -> Result<Task, Error>

Try to parse a pair of quinn::SendStream and quinn::RecvStream as a TUIC command.

The pair of stream should be accepted by quinn::Connection::accept_bi() from the same quinn::Connection.

source

pub fn accept_datagram(&self, dg: Bytes) -> Result<Task, Error>

Try to parse a QUIC Datagram as a TUIC command.

The Datagram should be accepted by quinn::Connection::read_datagram() from the same quinn::Connection.

Trait Implementations§

source§

impl<Side: Clone> Clone for Connection<Side>

source§

fn clone(&self) -> Connection<Side>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Side> Debug for Connection<Side>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Side> !RefUnwindSafe for Connection<Side>

§

impl<Side> Send for Connection<Side>where Side: Send,

§

impl<Side> Sync for Connection<Side>where Side: Sync,

§

impl<Side> Unpin for Connection<Side>where Side: Unpin,

§

impl<Side> !UnwindSafe for Connection<Side>

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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

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

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more