Skip to main content

QuicConn

Struct QuicConn 

Source
pub struct QuicConn {
    inner: Connection,
    peer_endpoint: Endpoint,
    local_endpoint: Endpoint,
}
Expand description

A QUIC connection. Manages streams and datagrams. This is NOT a single read/write channel — it is a stream factory.

Fields§

§inner: Connection§peer_endpoint: Endpoint§local_endpoint: Endpoint

Implementations§

Source§

impl QuicConn

Source

pub async fn open_bi(&self) -> Result<(QuicSendStream, QuicRecvStream)>

Open a new bidirectional stream.

Source

pub async fn open_uni(&self) -> Result<QuicSendStream>

Open a new unidirectional (send-only) stream.

Source

pub async fn accept_bi(&self) -> Result<(QuicSendStream, QuicRecvStream)>

Accept a bidirectional stream opened by the peer.

Source

pub async fn accept_uni(&self) -> Result<QuicRecvStream>

Accept a unidirectional (receive-only) stream from the peer.

Source

pub fn send_datagram(&self, data: Bytes) -> Result<()>

Send an unreliable datagram over the connection. Zero-copy — ownership of the Bytes allocation is passed to quinn.

Source

pub async fn recv_datagram(&self) -> Result<Bytes>

Receive an unreliable datagram. Zero-copy — wraps the allocation returned by quinn.

Source

pub fn max_datagram_size(&self) -> Option<usize>

Maximum datagram size the peer supports, or None if unsupported.

Source

pub fn peer_endpoint(&self) -> Result<Endpoint>

Remote peer’s address.

Source

pub fn local_endpoint(&self) -> Result<Endpoint>

Local address.

Source

pub fn rtt(&self) -> Duration

Current round-trip time estimate.

Source

pub fn close(&self, code: u32, reason: &[u8])

Close the connection gracefully.

Source

pub async fn closed(&self) -> ConnectionError

Wait for the connection to be closed (by us or the peer).

Source

pub fn inner(&self) -> &Connection

Returns a reference to the inner quinn connection.

Source

pub fn peer_certificates(&self) -> Option<Vec<CertificateDer<'static>>>

Peer certificate chain from the QUIC TLS handshake. Quinn returns a type-erased Box<dyn Any>; for rustls-based QUIC (which is what karyon uses) it downcasts to Vec<CertificateDer<'static>>.

Trait Implementations§

Source§

impl StreamMux for QuicConn

Source§

async fn open_stream(&self) -> Result<Box<dyn ByteStream>>

Open a new bidirectional stream.
Source§

async fn accept_stream(&self) -> Result<Box<dyn ByteStream>>

Accept a stream opened by the peer.
Source§

fn peer_endpoint(&self) -> Option<Endpoint>

Remote peer address.
Source§

fn local_endpoint(&self) -> Option<Endpoint>

Local address.

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.

§

impl<T> Instrument for T

§

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

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

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 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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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