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>
impl<Side> Connection<Side>
sourcepub fn packet_native(
&self,
pkt: impl AsRef<[u8]>,
addr: Address,
assoc_id: u16
) -> Result<(), Error>
pub fn packet_native( &self, pkt: impl AsRef<[u8]>, addr: Address, assoc_id: u16 ) -> Result<(), Error>
Sends a Packet
using UDP relay mode native
.
sourcepub async fn packet_quic(
&self,
pkt: impl AsRef<[u8]>,
addr: Address,
assoc_id: u16
) -> Result<(), Error>
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
.
sourcepub fn task_connect_count(&self) -> usize
pub fn task_connect_count(&self) -> usize
Returns the number of Connect
tasks
sourcepub fn task_associate_count(&self) -> usize
pub fn task_associate_count(&self) -> usize
Returns the number of active UDP sessions
sourcepub fn collect_garbage(&self, timeout: Duration)
pub fn collect_garbage(&self, timeout: Duration)
Removes packet fragments that can not be reassembled within the specified timeout
source§impl Connection<Client>
impl Connection<Client>
sourcepub fn new(conn: QuinnConnection) -> Self
pub fn new(conn: QuinnConnection) -> Self
Creates a new client side Connection
.
sourcepub async fn authenticate(
&self,
uuid: Uuid,
password: impl AsRef<[u8]>
) -> Result<(), Error>
pub async fn authenticate( &self, uuid: Uuid, password: impl AsRef<[u8]> ) -> Result<(), Error>
Sends an Authenticate
command.
sourcepub async fn accept_uni_stream(&self, recv: RecvStream) -> Result<Task, Error>
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
.
sourcepub async fn accept_bi_stream(
&self,
send: SendStream,
recv: RecvStream
) -> Result<Task, Error>
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§impl Connection<Server>
impl Connection<Server>
sourcepub fn new(conn: QuinnConnection) -> Self
pub fn new(conn: QuinnConnection) -> Self
Creates a new server side Connection
.
sourcepub async fn accept_uni_stream(&self, recv: RecvStream) -> Result<Task, Error>
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
.
sourcepub async fn accept_bi_stream(
&self,
send: SendStream,
recv: RecvStream
) -> Result<Task, Error>
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
.
Trait Implementations§
source§impl<Side: Clone> Clone for Connection<Side>
impl<Side: Clone> Clone for Connection<Side>
source§fn clone(&self) -> Connection<Side>
fn clone(&self) -> Connection<Side>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more