Struct Incoming
pub struct Incoming(/* private fields */);quic and std only.Expand description
An incoming connection for which the server has not yet begun its part of the handshake
Implementations§
§impl Incoming
impl Incoming
pub fn accept(self) -> Result<Connecting, ConnectionError>
pub fn accept(self) -> Result<Connecting, ConnectionError>
Attempt to accept this incoming connection (an error may still occur)
A server configuration whose TLS provider resolves its configuration per ClientHello,
such as one issuing certificates on demand, cannot start here: await this attempt
or use Self::accept_or_retry instead, or resolve one with Self::client_hello
and use Self::accept_with.
pub fn accept_with(
self,
server_config: Arc<ServerConfig>,
) -> Result<Connecting, ConnectionError>
pub fn accept_with( self, server_config: Arc<ServerConfig>, ) -> Result<Connecting, ConnectionError>
Accept this incoming connection using a custom configuration
See accept() for more details.
pub fn refuse(self)
pub fn refuse(self)
Reject this incoming connection attempt
pub fn retry(self) -> Result<(), RetryError>
pub fn retry(self) -> Result<(), RetryError>
Respond with a retry packet, requiring the client to retry with address validation
Errors if may_retry() is false.
pub fn ignore(self)
pub fn ignore(self)
Ignore this incoming connection attempt, not sending any packet in response
pub fn local_ip(&self) -> Option<IpAddr>
pub fn local_ip(&self) -> Option<IpAddr>
The local IP address which was used when the peer established the connection
pub fn local_address(&self) -> Option<SocketAddr>
pub fn local_address(&self) -> Option<SocketAddr>
The local address the peer’s first flight arrived on: the port of the socket that received it, with the IP the packet was sent to when that socket is a wildcard.
None when neither tells a specific IP.
pub fn remote_address(&self) -> SocketAddr
pub fn remote_address(&self) -> SocketAddr
The peer’s UDP address
pub fn remote_address_validated(&self) -> bool
pub fn remote_address_validated(&self) -> bool
Whether the socket address that is initiating this connection has been validated
This means that the sender of the initial packet has proved that they can receive traffic
sent to self.remote_address().
Before expiry, if self.remote_address_validated() is false, self.may_retry() is true.
The inverse is not guaranteed.
pub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Whether this pending attempt has expired or was retired by endpoint shutdown.
pub fn may_retry(&self) -> bool
pub fn may_retry(&self) -> bool
Whether it is legal to respond with a retry packet
Before expiry, if self.remote_address_validated() is false, self.may_retry() is true.
The inverse is not guaranteed.
pub fn orig_dst_cid(&self) -> ConnectionId
pub fn orig_dst_cid(&self) -> ConnectionId
The original destination CID when initiating the connection
pub async fn client_hello(&mut self) -> Result<ClientHello, ConnectionError>
pub async fn client_hello(&mut self) -> Result<ClientHello, ConnectionError>
The client’s ClientHello, once its first flight delivered all of it.
A ClientHello can span several Initial packets; this waits for the rest until the
attempt expires or the endpoint closes. One larger than 16 KiB is refused. Use it to
choose a configuration for Self::accept_with.
pub async fn accept_or_retry(self) -> Result<IncomingOutcome, ConnectionError>
pub async fn accept_or_retry(self) -> Result<IncomingOutcome, ConnectionError>
Accept this attempt as awaiting it does, but answer with a Retry instead when resolving its TLS configuration takes real work, such as issuing a certificate, for a client whose address is not validated yet (RFC 9000 §8.1.2). A provider that cannot tell, such as a rustls dynamic configuration, always takes real work.
When no Retry can be sent, the attempt is dropped without a response, so an unproven address never costs that work.
Trait Implementations§
§impl IntoFuture for Incoming
impl IntoFuture for Incoming
§type Output = Result<Connection, ConnectionError>
type Output = Result<Connection, ConnectionError>
§type IntoFuture = IncomingFuture
type IntoFuture = IncomingFuture
§fn into_future(self) -> <Incoming as IntoFuture>::IntoFuture
fn into_future(self) -> <Incoming as IntoFuture>::IntoFuture
Auto Trait Implementations§
impl !Freeze for Incoming
impl !RefUnwindSafe for Incoming
impl !UnwindSafe for Incoming
impl Send for Incoming
impl Sync for Incoming
impl Unpin for Incoming
impl UnsafeUnpin for Incoming
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more