pub struct TlsConfig { /* private fields */ }Expand description
Shared TLS configuration. Create once at startup, pass to each connection.
Wraps Arc<ClientConfig> — cloning is cheap.
§Examples
ⓘ
// Safe defaults: system root certs, TLS 1.2+1.3, AES-GCM preferred.
let config = TlsConfig::new()?;
// TLS 1.3 only, no certificate verification (testing).
let config = TlsConfig::builder()
.tls13_only()
.danger_no_verify()
.build()?;Implementations§
Source§impl TlsConfig
impl TlsConfig
Sourcepub fn new() -> Result<TlsConfig, TlsError>
pub fn new() -> Result<TlsConfig, TlsError>
Create with safe defaults.
- System root certificates via
rustls-native-certs - TLS 1.2 + 1.3 (both supported)
- aws-lc-rs crypto backend (AES-GCM with AES-NI)
Sourcepub fn client_config(&self) -> &Arc<ClientConfig>
pub fn client_config(&self) -> &Arc<ClientConfig>
Access the underlying rustls ClientConfig.
Useful for creating a tokio_rustls::TlsConnector or other
rustls-based adapters.
Sourcepub fn builder() -> TlsConfigBuilder
pub fn builder() -> TlsConfigBuilder
Create a builder for custom configuration.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TlsConfig
impl !RefUnwindSafe for TlsConfig
impl Send for TlsConfig
impl Sync for TlsConfig
impl Unpin for TlsConfig
impl UnsafeUnpin for TlsConfig
impl !UnwindSafe 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