Skip to main content

Config

Struct Config 

pub struct Config {
Show 23 fields pub application_protocol: ApplicationProtocol, pub server_alpn_policy: AlpnPolicy, pub early_requests: bool, pub early_dispatch: bool, pub observation: Option<Box<ObservationLimits>>, pub settings_profile: Option<Arc<Settings>>, pub critical_streams: Preferences, pub client_control: Option<Arc<ClientControlPreferences>>, pub decoder: DecoderConfig, pub encoder: EncoderConfig, pub max_requests: usize, pub header_read_timeout: Option<HeaderReadTimeout>, pub idle_timeout: Option<IdleTimeout>, pub close_drain_timeout: Duration, pub goaway_drain_timeout: Option<Duration>, pub max_pushes: usize, pub max_frame_size: usize, pub read_chunk_size: usize, pub max_pending_uni_streams: usize, pub extended_connect: bool, pub datagrams: Option<DatagramConfig>, pub strict_connect_framing: bool, pub metrics: Option<H3Metrics>,
}
Available on crate features http-backend and http and quic and std only.
Expand description

Local HTTP/3 connection budgets. Peer limits are negotiated independently.

Fields§

§application_protocol: ApplicationProtocol

The ALPN both sides must have negotiated, h3 by default. Setups that are not plain HTTP/3, such as a Reversed one, pick their own.

§server_alpn_policy: AlpnPolicy

ALPN validation for inbound connections; never inherited by forwarded requests. Client connections use their connection’s ALPN policy instead.

§early_requests: bool

Allow safe client requests without a body to use TLS early keys.

Each request also needs an EarlyDataPermit from its recovery owner. ForbidEarlyData always wins. A bare configuration flag leaves ordinary clients handshake-first. Early requests use default peer SETTINGS (RFC 9114 section 7.2.4.2). A TLS rejection retires this connection; requests whose streams actually opened early receive Error::is_early_request_rejected. Responses and normal pool admissions still wait for authentication and ALPN verification. The opt-in also allows resumed ClientHellos to offer early data when a request ultimately waits for confirmation. Leave it off for exact TLS fingerprint emulation; compiled captured TLS profiles take precedence and disable early data. Disabled by default. Servers ignore this option.

§early_dispatch: bool

Dispatch safe-method requests actually received in early data before Finished.

Requires native server TLS early-data opt-in bound to Self::early_data_context. A missing or mismatched context keeps handshake-first dispatch. Routes must decide whether replay is safe; client-authenticated routes must await EarlyDataReceived::confirmed() and then read the connection’s NegotiatedTlsParameters again; peer identity is provisional before confirmation. Unsafe methods, CONNECT and requests with a Protocol extension still wait for confirmation, retaining their actual early receipt metadata. Gate non-replay-safe routes with validate_request::early_data::require_confirmed. Gateways must use validate_request::early_data::forward_to or add Early-Data: 1 themselves, including when upstream uses ordinary 1-RTT. Disabled by default. Clients ignore this option.

§observation: Option<Box<ObservationLimits>>

Optional independent budgets for wire observation; disabled by default.

§settings_profile: Option<Arc<Settings>>

Optional literal SETTINGS order, including unknown and reserved identifiers.

QPACK values must match decoder; an omitted QPACK setting means zero. An explicit field-section limit must match the decoder’s local limit. Server Extended CONNECT must match the application’s capability; datagrams must match negotiated transport support. Client ENABLE_CONNECT_PROTOCOL values are preserved but grant no permission. Incompatible profiles fail before HTTP/3 control bytes are emitted. Ordinary connections allocate no profile.

§critical_streams: Preferences

QPACK stream allocation order and whether idle type prefixes are sent.

§client_control: Option<Arc<ClientControlPreferences>>

Additional client frames after SETTINGS; disabled by default.

§decoder: DecoderConfig

Local QPACK decoder limits, advertised where the protocol defines settings.

§encoder: EncoderConfig

Local encoder budgets. Peer capacity/blocked-stream settings override those fields.

§max_requests: usize

Maximum concurrent application requests retained by the engine.

§header_read_timeout: Option<HeaderReadTimeout>

Deadline for incomplete server request heads, including blocked QPACK sections. None disables the deadline.

§idle_timeout: Option<IdleTimeout>

Server connection idle budgets. None disables the deadline.

§close_drain_timeout: Duration

Maximum time HTTP/3 dispatchers keep the driver and accepted request futures alive after a clean transport close. Defaults to five seconds. This does not limit ordinary requests; see goaway_drain_timeout for the GOAWAY phase.

§goaway_drain_timeout: Option<Duration>

Once a server queued its graceful-shutdown GOAWAY: how long each wait for the peer to acknowledge a response’s end, and the final wait for those acknowledgements and the GOAWAY’s hand-off to QUIC, may last before the server stops waiting and closes the connection without error (RFC 9114 §5.2). Each wait counts from when it began or from the GOAWAY, whichever is later; accepted requests still running are not limited. Defaults to one second. None waits for the peer, so one that went away holds the connection until the application’s own shutdown deadline.

§max_pushes: usize

Lifetime push quota; zero disables push. Bounds reordered push state.

§max_frame_size: usize

Maximum buffered encoded non-DATA frame.

This local wire-memory budget is independent of the decoded field-section size advertised in SETTINGS. QPACK literals can expand on the wire, so exceeding this bound is excessive load even for an otherwise valid field section (RFC 9114 §10.5.1). Increase both limits for large-header peers.

§read_chunk_size: usize

Maximum QUIC chunk held by a stream reader.

§max_pending_uni_streams: usize

Maximum unclassified peer unidirectional streams retained simultaneously.

§extended_connect: bool

Accept Extended CONNECT (RFC 9220) as a server, advertising SETTINGS_ENABLE_CONNECT_PROTOCOL. The service decides which :protocol tokens it serves; RFC 9220 §3 recommends 501 for others.

§datagrams: Option<DatagramConfig>

Receive HTTP/3 datagrams (RFC 9297). When QUIC DATAGRAM is negotiated this advertises SETTINGS_H3_DATAGRAM, as RFC 9297 §2.1.1 recommends for every endpoint able to receive them; None never advertises nor delivers them. A request only has datagram semantics once declared with HttpDatagrams.

§strict_connect_framing: bool

Reject, rather than drop, Content-Length or Transfer-Encoding on a successful response to CONNECT, which RFC 9110 §9.3.6 forbids as a tunnel follows the response.

§metrics: Option<H3Metrics>
Available on crate feature opentelemetry only.

Where each connection records the datagrams it dropped; None, the default, records nothing.

Implementations§

§

impl Config

pub const CAPTURED_QPACK_CEILING: QpackDecoderCeiling

The highest QPACK decoder limits captured SETTINGS may raise a connection to, about four times what browsers advertise.

pub fn with_browser_qpack_decoder_limits(self) -> Config

Raise the QPACK decoder limits to what browsers advertise, so captured browser SETTINGS fit: a 64 KiB dynamic table, 100 blocked streams and 256 KiB field sections.

pub fn try_with_captured_client_settings( &self, settings: Arc<Settings>, ) -> Result<Config, Error>

Apply captured client SETTINGS, raising the QPACK decoder limits to the captured values so they are advertised exactly, up to Self::CAPTURED_QPACK_CEILING.

Each raised limit is memory a peer may make this connection hold, so a profile cannot commit more than the ceiling. Limits already above a captured value are kept, and the SETTINGS are then fitted as by Self::try_with_client_settings.

pub fn try_with_client_settings( &self, settings: Arc<Settings>, ) -> Result<Config, Error>

Apply literal client SETTINGS within this configuration’s receive budgets.

Omitted QPACK values mean zero. The profile can lower configured limits; larger values are lowered to them and a datagram grant this configuration disables is dropped, keeping the order of every other entry. An omitted field-section limit keeps the local finite resource budget. Client ENABLE_CONNECT_PROTOCOL values are retained without enabling Extended CONNECT: only the server’s setting grants that permission.

pub fn try_with_server_settings( &self, settings: Arc<Settings>, ) -> Result<Config, Error>

Apply literal server SETTINGS within existing receive budgets and capabilities.

Omitted QPACK values mean zero. An Extended CONNECT grant without the local capability is dropped; a false or omitted value disables it. Datagram policy and receive budgets cannot be enabled or raised by the supplied settings. The native handshake also drops grants the QUIC transport cannot carry.

pub fn try_set_client_controls( &mut self, preferences: Option<Arc<ClientControlPreferences>>, ) -> Result<(), Error>

Set optional client control frames, dropping trailing frames past this configuration’s frame-count and byte budgets with a trace. An invalid frame leaves the existing configuration unchanged.

pub fn configure_transport( &self, transport: &mut TransportConfig, ) -> Result<(), Error>

Apply finite HTTP/3 receive budgets to a QUIC transport configuration. Configure the endpoint before establishing connections.

pub fn early_data_context(&self) -> Result<Bytes, Error>

Application compatibility context for a QUIC server accepting early data.

Pass these bytes to TlsOptions::with_early_data_context together with with_early_data(true) when building server TLS. The encoding includes every configured local SETTINGS entry, including unknown entries, and supported CONNECT/datagram capabilities. It does not promise replay safety for a route; that remains application policy. Changed settings reject old early sessions conservatively, even when the change only increases limits.

Trait Implementations§

§

impl Clone for Config

§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
§

impl Debug for Config

§

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

Formats the value using the given formatter. Read more
§

impl Default for Config

§

fn default() -> Config

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Config

§

impl !UnwindSafe for Config

§

impl Forget for Config

§

impl Freeze for Config

§

impl Move for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnsafeUnpin for Config

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

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

§

fn into_request(self) -> Request<T>

Wrap the input message T in a rama_grpc::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
§

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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
§

impl<T, U> RamaFrom<T> for U
where U: From<T>,

§

fn rama_from(value: T) -> U

§

impl<T, U, CrateMarker> RamaInto<U, CrateMarker> for T
where U: RamaFrom<T, CrateMarker>,

§

fn rama_into(self) -> U

§

impl<T, U> RamaTryFrom<T> for U
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

§

fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>

§

impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for T
where U: RamaTryFrom<T, CrateMarker>,

§

type Error = <U as RamaTryFrom<T, CrateMarker>>::Error

§

fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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<V, F> ValueFormatter<&V> for F
where F: ValueFormatter<V> + ?Sized, V: ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &&V)

Write value to writer
§

impl<V, F> ValueFormatter<Arc<V>> for F
where F: ValueFormatter<V> + ?Sized, V: ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &Arc<V>)

Write value to writer
§

impl<V, F> ValueFormatter<Box<V>> for F
where F: ValueFormatter<V> + ?Sized, V: ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &Box<V>)

Write value to writer
§

impl<V, F> ValueFormatter<Cow<'_, V>> for F
where V: ToOwned + ?Sized, F: ValueFormatter<V> + ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)

Write value to writer
§

impl<V, F> ValueFormatter<Option<V>> for F
where F: ValueFormatter<V> + ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &Option<V>)

Write value to writer
§

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