Struct InitialQuicConnection

Source
pub struct InitialQuicConnection<Tx, M>
where Tx: DatagramSocketSend + Send + 'static + ?Sized, M: Metrics,
{ /* private fields */ }
Expand description

A QUIC connection that has not performed a handshake yet.

This type is currently only used for server-side connections. It is created and added to the listener’s connection stream after an initial packet from a client has been received and (optionally) the client’s IP address has been validated.

To turn the initial connection into a fully established one, a QUIC handshake must be performed. Users have multiple options to facilitate this:

  • start is a simple entrypoint which spawns a task to handle the entire lifetime of the QUIC connection. The caller can then only communicate with the connection via their ApplicationOverQuic.
  • handshake spawns a task for the handshake and awaits its completion. Afterwards, it pauses the connection and allows the caller to resume it later via an opaque struct. We spawn a separate task to allow the tokio scheduler free choice in where to run the handshake.
  • handshake_fut returns a future to drive the handshake for maximum flexibility.

Implementations§

Source§

impl<Tx, M> InitialQuicConnection<Tx, M>
where Tx: DatagramSocketSend + Send + 'static + ?Sized, M: Metrics,

Source

pub fn local_addr(&self) -> SocketAddr

The local address this connection listens on.

Source

pub fn peer_addr(&self) -> SocketAddr

The remote address for this connection.

Source

pub fn audit_log_stats(&self) -> Arc<QuicAuditStats>

A handle to the QuicAuditStats for this connection.

§Note

These stats are updated during the lifetime of the connection. The getter exists to grab a handle early on, which can then be stowed away and read out after the connection has closed.

Source

pub fn stats(&self) -> &Arc<Mutex<QuicConnectionStats>>

A handle to the QuicConnectionStats for this connection.

§Note

Initially, these stats represent the state when the [quiche::Connection] was created. They are updated when the connection is closed, so this getter exists primarily to grab a handle early on.

Source

pub fn handshake_fut<A: ApplicationOverQuic>( self, app: A, ) -> (QuicConnection, BoxFuture<'static, Result<Running<Arc<Tx>, M, A>>>)

Creates a future to drive the connection’s handshake.

This is a lower-level alternative to the handshake function which gives the caller more control over execution of the future. See handshake for details on the return values.

Source

pub async fn handshake<A: ApplicationOverQuic>( self, app: A, ) -> Result<(QuicConnection, Running<Arc<Tx>, M, A>)>

Performs the QUIC handshake in a separate tokio task and awaits its completion.

The returned QuicConnection holds metadata about the established connection. The connection itself is paused after handshake returns and must be resumed by passing the opaque Running value to InitialQuicConnection::resume. This two-step process allows callers to collect telemetry and run code before serving their ApplicationOverQuic.

Source

pub fn resume<A: ApplicationOverQuic>(pre_running: Running<Arc<Tx>, M, A>)

Resumes a QUIC connection which was paused after a successful handshake.

Source

pub fn start<A: ApplicationOverQuic>(self, app: A) -> QuicConnection

Drives a QUIC connection from handshake to close in separate tokio tasks.

It combines InitialQuicConnection::handshake and InitialQuicConnection::resume into a single call.

Trait Implementations§

Source§

impl<Tx, M> AsSocketStats for InitialQuicConnection<Tx, M>
where Tx: DatagramSocketSend + Send + 'static + ?Sized, M: Metrics,

Source§

impl<Tx, M> ShutdownConnection for InitialQuicConnection<Tx, M>
where Tx: DatagramSocketSend + Send + 'static + ?Sized, M: Metrics,

Source§

fn poll_shutdown(&mut self, _cx: &mut Context<'_>) -> Poll<Result<()>>

Initiates or attempts to shut down this writer, returning success when the I/O connection has completely shut down. Read more

Auto Trait Implementations§

§

impl<Tx, M> Freeze for InitialQuicConnection<Tx, M>
where M: Freeze, Tx: ?Sized,

§

impl<Tx, M> !RefUnwindSafe for InitialQuicConnection<Tx, M>

§

impl<Tx, M> Send for InitialQuicConnection<Tx, M>
where Tx: ?Sized,

§

impl<Tx, M> Sync for InitialQuicConnection<Tx, M>
where Tx: ?Sized,

§

impl<Tx, M> Unpin for InitialQuicConnection<Tx, M>
where Tx: ?Sized,

§

impl<Tx, M> !UnwindSafe for InitialQuicConnection<Tx, M>

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ShutdownConnectionExt for T

Source§

fn shutdown_connection(&mut self) -> impl Future<Output = Result<(), Error>>

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