pub struct TlsLayer {
client_config: Option<ClientTlsConfig>,
server_config: Option<ServerTlsConfig>,
}Expand description
TLS middleware layer. Implements both ClientLayer and ServerLayer.
Wraps any ByteStream with TLS encryption.
§Example
use karyon_net::{tcp, ClientLayer, Endpoint};
use karyon_net::tls::{TlsLayer, ClientTlsConfig};
async {
let ep: Endpoint = "tcp://127.0.0.1:443".parse().unwrap();
let stream = tcp::connect(&ep, Default::default()).await.unwrap();
// let tls_stream = ClientLayer::handshake(
// &TlsLayer::client(config), stream
// ).await.unwrap();
};Fields§
§client_config: Option<ClientTlsConfig>§server_config: Option<ServerTlsConfig>Implementations§
Source§impl TlsLayer
impl TlsLayer
Sourcepub fn client(config: ClientTlsConfig) -> Self
pub fn client(config: ClientTlsConfig) -> Self
Create a TLS layer for client connections.
Sourcepub fn server(config: ServerTlsConfig) -> Self
pub fn server(config: ServerTlsConfig) -> Self
Create a TLS layer for server connections.
Trait Implementations§
Source§impl ClientLayer<Box<dyn ByteStream>, Box<dyn ByteStream>> for TlsLayer
impl ClientLayer<Box<dyn ByteStream>, Box<dyn ByteStream>> for TlsLayer
async fn handshake( &self, stream: Box<dyn ByteStream>, ) -> Result<Box<dyn ByteStream>>
Source§impl ServerLayer<Box<dyn ByteStream>, Box<dyn ByteStream>> for TlsLayer
impl ServerLayer<Box<dyn ByteStream>, Box<dyn ByteStream>> for TlsLayer
async fn handshake( &self, stream: Box<dyn ByteStream>, ) -> Result<Box<dyn ByteStream>>
Auto Trait Implementations§
impl Freeze for TlsLayer
impl !RefUnwindSafe for TlsLayer
impl Send for TlsLayer
impl Sync for TlsLayer
impl Unpin for TlsLayer
impl UnsafeUnpin for TlsLayer
impl !UnwindSafe for TlsLayer
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