Struct TlsServerConfig
pub struct TlsServerConfig(/* private fields */);tls only.Expand description
A backend agnostic TLS server config
It holds a set of fine-grained config pieces (e.g. TlsServerAuth,
TlsAlpn) and exposes typed setters for the settings both TLS backends
support. Backend crates add setters for their backend-specific pieces (e.g.
dynamic cert issuance + caching, or a native escape hatch) via extension
traits (RustlsServerConfigExt / BoringServerConfigExt).
Implementations§
§impl TlsServerConfig
impl TlsServerConfig
pub fn new() -> TlsServerConfig
pub fn new() -> TlsServerConfig
Create an empty config.
pub fn default_http() -> Result<TlsServerConfig, Box<dyn Error + Sync + Send>>
pub fn default_http() -> Result<TlsServerConfig, Box<dyn Error + Sync + Send>>
Create a new config using with:
- ALPN: H2, http1.1
- Self signed certificate (freshly generated)
- Keylogger:
KeyLogIntent::Environment
pub fn self_signed_http_auto() -> Result<TlsServerConfig, Box<dyn Error + Sync + Send>>
pub fn self_signed_http_auto() -> Result<TlsServerConfig, Box<dyn Error + Sync + Send>>
Create a config that serves a freshly generated self-signed identity and offers HTTP/2 + HTTP/1.1 via ALPN.
pub fn write_to(&self, extensions: &Extensions)
pub fn write_to(&self, extensions: &Extensions)
Transfer this config’s pieces onto extensions (appending, so they
override existing entries of the same type — newest-wins).
pub fn with_server_auth(self, auth: ServerAuthData) -> TlsServerConfig
pub fn with_server_auth(self, auth: ServerAuthData) -> TlsServerConfig
Set the server auth: the certificate chain + private key to serve.
Dynamic / on-the-fly cert issuance (with caching) is backend-specific; configure it via the backend’s server-config extension trait.
pub fn set_server_auth(&mut self, auth: ServerAuthData) -> &mut TlsServerConfig
pub fn set_server_auth(&mut self, auth: ServerAuthData) -> &mut TlsServerConfig
Set the server auth: the certificate chain + private key to serve.
Dynamic / on-the-fly cert issuance (with caching) is backend-specific; configure it via the backend’s server-config extension trait.
pub fn try_with_self_signed(
self,
data: SelfSignedData,
) -> Result<TlsServerConfig, Box<dyn Error + Sync + Send>>
pub fn try_with_self_signed( self, data: SelfSignedData, ) -> Result<TlsServerConfig, Box<dyn Error + Sync + Send>>
Generate a fresh self-signed identity and serve it.
pub fn try_set_self_signed(
&mut self,
data: SelfSignedData,
) -> Result<&mut TlsServerConfig, Box<dyn Error + Sync + Send>>
pub fn try_set_self_signed( &mut self, data: SelfSignedData, ) -> Result<&mut TlsServerConfig, Box<dyn Error + Sync + Send>>
Generate a fresh self-signed identity and serve it.
pub fn with_single_cert(self, data: ServerAuthData) -> TlsServerConfig
pub fn with_single_cert(self, data: ServerAuthData) -> TlsServerConfig
Serve the provided certificate chain + private key.
pub fn set_single_cert(&mut self, data: ServerAuthData) -> &mut TlsServerConfig
pub fn set_single_cert(&mut self, data: ServerAuthData) -> &mut TlsServerConfig
Serve the provided certificate chain + private key.
pub fn with_alpn(
self,
protocols: SmallVec<[ApplicationProtocol; 2]>,
) -> TlsServerConfig
pub fn with_alpn( self, protocols: SmallVec<[ApplicationProtocol; 2]>, ) -> TlsServerConfig
Set the ALPN protocols accepted (in preference order).
pub fn set_alpn(
&mut self,
protocols: SmallVec<[ApplicationProtocol; 2]>,
) -> &mut TlsServerConfig
pub fn set_alpn( &mut self, protocols: SmallVec<[ApplicationProtocol; 2]>, ) -> &mut TlsServerConfig
Set the ALPN protocols accepted (in preference order).
pub fn with_alpn_http_auto(self) -> TlsServerConfig
pub fn with_alpn_http_auto(self) -> TlsServerConfig
Accept HTTP/2 and HTTP/1.1 via ALPN.
pub fn set_alpn_http_auto(&mut self) -> &mut TlsServerConfig
pub fn set_alpn_http_auto(&mut self) -> &mut TlsServerConfig
Accept HTTP/2 and HTTP/1.1 via ALPN.
pub fn with_alpn_http_1(self) -> TlsServerConfig
pub fn with_alpn_http_1(self) -> TlsServerConfig
Accept HTTP/1.1 only via ALPN.
pub fn set_alpn_http_1(&mut self) -> &mut TlsServerConfig
pub fn set_alpn_http_1(&mut self) -> &mut TlsServerConfig
Accept HTTP/1.1 only via ALPN.
pub fn with_alpn_http_2(self) -> TlsServerConfig
pub fn with_alpn_http_2(self) -> TlsServerConfig
Accept HTTP/2 only via ALPN.
pub fn set_alpn_http_2(&mut self) -> &mut TlsServerConfig
pub fn set_alpn_http_2(&mut self) -> &mut TlsServerConfig
Accept HTTP/2 only via ALPN.
pub fn with_supported_versions(
self,
versions: Vec<ProtocolVersion>,
) -> TlsServerConfig
pub fn with_supported_versions( self, versions: Vec<ProtocolVersion>, ) -> TlsServerConfig
Set the supported protocol versions.
pub fn set_supported_versions(
&mut self,
versions: Vec<ProtocolVersion>,
) -> &mut TlsServerConfig
pub fn set_supported_versions( &mut self, versions: Vec<ProtocolVersion>, ) -> &mut TlsServerConfig
Set the supported protocol versions.
pub fn with_keylog(self, intent: KeyLogIntent) -> TlsServerConfig
pub fn with_keylog(self, intent: KeyLogIntent) -> TlsServerConfig
Set the keylog intent.
pub fn set_keylog(&mut self, intent: KeyLogIntent) -> &mut TlsServerConfig
pub fn set_keylog(&mut self, intent: KeyLogIntent) -> &mut TlsServerConfig
Set the keylog intent.
pub fn with_client_verify(self, mode: ClientVerifyMode) -> TlsServerConfig
pub fn with_client_verify(self, mode: ClientVerifyMode) -> TlsServerConfig
Set how the client is verified (mTLS).
pub fn set_client_verify(
&mut self,
mode: ClientVerifyMode,
) -> &mut TlsServerConfig
pub fn set_client_verify( &mut self, mode: ClientVerifyMode, ) -> &mut TlsServerConfig
Set how the client is verified (mTLS).
pub fn with_store_client_cert_chain(self, store: bool) -> TlsServerConfig
pub fn with_store_client_cert_chain(self, store: bool) -> TlsServerConfig
Set whether the client certificate chain is captured into
NegotiatedTlsParameters.
pub fn set_store_client_cert_chain(
&mut self,
store: bool,
) -> &mut TlsServerConfig
pub fn set_store_client_cert_chain( &mut self, store: bool, ) -> &mut TlsServerConfig
Set whether the client certificate chain is captured into
NegotiatedTlsParameters.
pub fn as_extensions(&self) -> &Extensions
Trait Implementations§
§impl BoringServerConfigExt for TlsServerConfig
impl BoringServerConfigExt for TlsServerConfig
§fn with_cert_issuer(self, data: ServerCertIssuerData) -> TlsServerConfig
fn with_cert_issuer(self, data: ServerCertIssuerData) -> TlsServerConfig
DynamicCertIssuer]),
with optional in-memory caching.§fn set_cert_issuer(
&mut self,
data: ServerCertIssuerData,
) -> &mut TlsServerConfig
fn set_cert_issuer( &mut self, data: ServerCertIssuerData, ) -> &mut TlsServerConfig
DynamicCertIssuer]),
with optional in-memory caching.§impl Clone for TlsServerConfig
impl Clone for TlsServerConfig
§fn clone(&self) -> TlsServerConfig
fn clone(&self) -> TlsServerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for TlsServerConfig
impl Debug for TlsServerConfig
§impl Default for TlsServerConfig
impl Default for TlsServerConfig
§fn default() -> TlsServerConfig
fn default() -> TlsServerConfig
§impl RamaTryFrom<&TlsServerConfig, RamaTlsRustlsCrateMarker> for ServerConfig
impl RamaTryFrom<&TlsServerConfig, RamaTlsRustlsCrateMarker> for ServerConfig
type Error = Box<dyn Error + Sync + Send>
fn rama_try_from( value: &TlsServerConfig, ) -> Result<ServerConfig, <ServerConfig as RamaTryFrom<&TlsServerConfig, RamaTlsRustlsCrateMarker>>::Error>
§impl RamaTryFrom<TlsServerConfig, RamaTlsRustlsCrateMarker> for ServerConfig
impl RamaTryFrom<TlsServerConfig, RamaTlsRustlsCrateMarker> for ServerConfig
type Error = Box<dyn Error + Sync + Send>
fn rama_try_from( value: TlsServerConfig, ) -> Result<ServerConfig, <ServerConfig as RamaTryFrom<TlsServerConfig, RamaTlsRustlsCrateMarker>>::Error>
§impl RustlsServerConfigExt for TlsServerConfig
impl RustlsServerConfigExt for TlsServerConfig
§fn with_modify_rustls_config(
self,
modify: impl Fn(ServerConfig) -> Result<ServerConfig, Box<dyn Error + Sync + Send>> + Send + Sync + 'static,
) -> TlsServerConfig
fn with_modify_rustls_config( self, modify: impl Fn(ServerConfig) -> Result<ServerConfig, Box<dyn Error + Sync + Send>> + Send + Sync + 'static, ) -> TlsServerConfig
ServerConfig build: see ModifyRustlsServerConfig.§fn set_modify_rustls_config(
&mut self,
modify: impl Fn(ServerConfig) -> Result<ServerConfig, Box<dyn Error + Sync + Send>> + Send + Sync + 'static,
) -> &mut TlsServerConfig
fn set_modify_rustls_config( &mut self, modify: impl Fn(ServerConfig) -> Result<ServerConfig, Box<dyn Error + Sync + Send>> + Send + Sync + 'static, ) -> &mut TlsServerConfig
ServerConfig build: see ModifyRustlsServerConfig.§fn with_dynamic_config(
self,
provider: Arc<impl DynamicConfigProvider>,
) -> TlsServerConfig
fn with_dynamic_config( self, provider: Arc<impl DynamicConfigProvider>, ) -> TlsServerConfig
§fn set_dynamic_config(
&mut self,
provider: Arc<impl DynamicConfigProvider>,
) -> &mut TlsServerConfig
fn set_dynamic_config( &mut self, provider: Arc<impl DynamicConfigProvider>, ) -> &mut TlsServerConfig
§impl TryFrom<&TlsServerConfig> for TlsAcceptorData
impl TryFrom<&TlsServerConfig> for TlsAcceptorData
§fn try_from(
value: &TlsServerConfig,
) -> Result<TlsAcceptorData, <TlsAcceptorData as TryFrom<&TlsServerConfig>>::Error>
fn try_from( value: &TlsServerConfig, ) -> Result<TlsAcceptorData, <TlsAcceptorData as TryFrom<&TlsServerConfig>>::Error>
§impl TryFrom<&TlsServerConfig> for TlsAcceptorData
impl TryFrom<&TlsServerConfig> for TlsAcceptorData
§fn try_from(
value: &TlsServerConfig,
) -> Result<TlsAcceptorData, <TlsAcceptorData as TryFrom<&TlsServerConfig>>::Error>
fn try_from( value: &TlsServerConfig, ) -> Result<TlsAcceptorData, <TlsAcceptorData as TryFrom<&TlsServerConfig>>::Error>
Auto Trait Implementations§
impl Freeze for TlsServerConfig
impl RefUnwindSafe for TlsServerConfig
impl Send for TlsServerConfig
impl Sync for TlsServerConfig
impl Unpin for TlsServerConfig
impl UnsafeUnpin for TlsServerConfig
impl UnwindSafe for TlsServerConfig
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§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
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 Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
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 Twhere
T: ?Sized,
§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
value to writer§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
value to writer§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
value to writer§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
value to writer§impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
§fn format_value(writer: impl ValueWriter, value: &Option<V>)
fn format_value(writer: impl ValueWriter, value: &Option<V>)
value to writer