From 98a1de91a2dae06323558422c239e5a45fc86e7b Mon Sep 17 00:00:00 2001 From: hozan23 Date: Tue, 28 Nov 2023 22:41:33 +0300 Subject: implement TLS for inbound and outbound connections --- net/src/connection.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'net/src/connection.rs') diff --git a/net/src/connection.rs b/net/src/connection.rs index d8ec0a3..b1d7550 100644 --- a/net/src/connection.rs +++ b/net/src/connection.rs @@ -1,7 +1,9 @@ -use crate::{Endpoint, Result}; use async_trait::async_trait; -use crate::transports::{tcp, udp, unix}; +use crate::{ + transports::{tcp, udp, unix}, + Endpoint, Error, Result, +}; /// Alias for `Box` pub type Conn = Box; @@ -28,7 +30,7 @@ pub trait Connection: Send + Sync { /// Connects to the provided endpoint. /// -/// it only supports `tcp4/6`, `udp4/6` and `unix`. +/// it only supports `tcp4/6`, `udp4/6`, and `unix`. /// /// #Example /// @@ -53,5 +55,6 @@ pub async fn dial(endpoint: &Endpoint) -> Result { Endpoint::Tcp(addr, port) => Ok(Box::new(tcp::dial_tcp(addr, port).await?)), Endpoint::Udp(addr, port) => Ok(Box::new(udp::dial_udp(addr, port).await?)), Endpoint::Unix(addr) => Ok(Box::new(unix::dial_unix(addr).await?)), + _ => Err(Error::InvalidEndpoint(endpoint.to_string())), } } -- cgit v1.2.3