pub struct TlsConfig { /* private fields */ }Expand description
Rustls server configuration with Phoenix ALPN and handshake policy.
Implementations§
Source§impl TlsConfig
impl TlsConfig
Sourcepub fn from_pem(
certificate_pem: &[u8],
private_key_pem: &[u8],
) -> Result<TlsConfig, TlsConfigError>
pub fn from_pem( certificate_pem: &[u8], private_key_pem: &[u8], ) -> Result<TlsConfig, TlsConfigError>
Load a certificate chain and private key from PEM bytes.
§Errors
Returns an error for unreadable PEM, missing material, or an invalid key/certificate pair.
Sourcepub fn from_files(
certificate_path: impl AsRef<Path>,
private_key_path: impl AsRef<Path>,
) -> Result<TlsConfig, TlsConfigError>
pub fn from_files( certificate_path: impl AsRef<Path>, private_key_path: impl AsRef<Path>, ) -> Result<TlsConfig, TlsConfigError>
Load PEM material from local files during application startup.
§Errors
Returns an error when either file cannot be read or parsed.
Sourcepub fn from_server_config(server_config: ServerConfig) -> TlsConfig
pub fn from_server_config(server_config: ServerConfig) -> TlsConfig
Wrap an advanced rustls configuration. Phoenix supplies HTTP ALPN defaults when absent.
Sourcepub fn handshake_timeout(
self,
timeout: Duration,
) -> Result<TlsConfig, TlsConfigError>
pub fn handshake_timeout( self, timeout: Duration, ) -> Result<TlsConfig, TlsConfigError>
Set a hard deadline for completing the TLS handshake.
§Errors
Returns an error when the timeout is zero.
pub fn alpn_protocols(&self) -> &[Vec<u8>]
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TlsConfig
impl !UnwindSafe for TlsConfig
impl Freeze for TlsConfig
impl Send for TlsConfig
impl Sync for TlsConfig
impl Unpin for TlsConfig
impl UnsafeUnpin for TlsConfig
Blanket Implementations§
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
Mutably borrows from an owned value. Read more