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>,
}http-backend and http and quic and std only.Expand description
Local HTTP/3 connection budgets. Peer limits are negotiated independently.
Fields§
§application_protocol: ApplicationProtocolThe 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: AlpnPolicyALPN validation for inbound connections; never inherited by forwarded requests. Client connections use their connection’s ALPN policy instead.
early_requests: boolAllow 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: boolDispatch 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: PreferencesQPACK stream allocation order and whether idle type prefixes are sent.
client_control: Option<Arc<ClientControlPreferences>>Additional client frames after SETTINGS; disabled by default.
decoder: DecoderConfigLocal QPACK decoder limits, advertised where the protocol defines settings.
encoder: EncoderConfigLocal encoder budgets. Peer capacity/blocked-stream settings override those fields.
max_requests: usizeMaximum 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: DurationMaximum 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: usizeLifetime push quota; zero disables push. Bounds reordered push state.
max_frame_size: usizeMaximum 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: usizeMaximum QUIC chunk held by a stream reader.
max_pending_uni_streams: usizeMaximum unclassified peer unidirectional streams retained simultaneously.
extended_connect: boolAccept 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: boolReject, 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>opentelemetry only.Where each connection records the datagrams it dropped; None, the default, records
nothing.
Implementations§
§impl Config
impl Config
pub const CAPTURED_QPACK_CEILING: QpackDecoderCeiling
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
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>
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>
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>
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>
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>
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>
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§
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§
§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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