Struct poem::listener::RustlsConfig
source · [−]pub struct RustlsConfig { /* private fields */ }
Available on crate features
server
and rustls
only.Expand description
Rustls Config.
Implementations
sourceimpl RustlsConfig
impl RustlsConfig
sourcepub fn cert(self, cert: impl Into<Vec<u8>>) -> Self
👎Deprecated: replaced by RustlsConfig::fallback
pub fn cert(self, cert: impl Into<Vec<u8>>) -> Self
RustlsConfig::fallback
Sets the certificates.
sourcepub fn key(self, key: impl Into<Vec<u8>>) -> Self
👎Deprecated: replaced by RustlsConfig::fallback
pub fn key(self, key: impl Into<Vec<u8>>) -> Self
RustlsConfig::fallback
Sets the private key.
sourcepub fn ocsp_resp(self, ocsp_resp: impl Into<Vec<u8>>) -> Self
👎Deprecated: replaced by RustlsConfig::fallback
pub fn ocsp_resp(self, ocsp_resp: impl Into<Vec<u8>>) -> Self
RustlsConfig::fallback
Sets the DER-encoded OCSP response.
sourcepub fn fallback(self, certificate: RustlsCertificate) -> Self
pub fn fallback(self, certificate: RustlsCertificate) -> Self
If the certificate corresponding to the SNI name is not found, it will fall back to this certificate.
Examples
use poem::listener::{Listener, RustlsCertificate, RustlsConfig, TcpListener};
let config =
RustlsConfig::new().fallback(RustlsCertificate::new().cert(cert_bytes).key(key_bytes));
let listener = TcpListener::bind("127.0.0.1:3000").rustls(config);
sourcepub fn certificate(
self,
name: impl Into<String>,
certificate: RustlsCertificate
) -> Self
pub fn certificate(
self,
name: impl Into<String>,
certificate: RustlsCertificate
) -> Self
Add a new certificate to be used for the given SNI name
.
sourcepub fn client_auth_optional(self, trust_anchor: impl Into<Vec<u8>>) -> Self
pub fn client_auth_optional(self, trust_anchor: impl Into<Vec<u8>>) -> Self
Sets the trust anchor for optional client authentication.
sourcepub fn client_auth_required(self, trust_anchor: impl Into<Vec<u8>>) -> Self
pub fn client_auth_required(self, trust_anchor: impl Into<Vec<u8>>) -> Self
Sets the trust anchor for required client authentication.
Trait Implementations
sourceimpl Default for RustlsConfig
impl Default for RustlsConfig
sourceimpl IntoTlsConfigStream<RustlsConfig> for RustlsConfig
impl IntoTlsConfigStream<RustlsConfig> for RustlsConfig
type Stream = Once<Ready<RustlsConfig>>
type Stream = Once<Ready<RustlsConfig>>
Represents a tls config stream.
sourcefn into_stream(self) -> IoResult<Self::Stream>
fn into_stream(self) -> IoResult<Self::Stream>
Consume itself and return tls config stream.
sourceimpl<T> IntoTlsConfigStream<RustlsConfig> for Twhere
T: Stream<Item = RustlsConfig> + Send + 'static,
impl<T> IntoTlsConfigStream<RustlsConfig> for Twhere
T: Stream<Item = RustlsConfig> + Send + 'static,
type Stream = T
type Stream = T
Represents a tls config stream.
sourcefn into_stream(self) -> IoResult<Self::Stream>
fn into_stream(self) -> IoResult<Self::Stream>
Consume itself and return tls config stream.
Auto Trait Implementations
impl RefUnwindSafe for RustlsConfig
impl Send for RustlsConfig
impl Sync for RustlsConfig
impl Unpin for RustlsConfig
impl UnwindSafe for RustlsConfig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more