pub fn connect<U>(
        &self,
        message: U,
    ) -> impl Future<Output = Result<TlsStream<TcpStream>, ConnectError>>
    where
        Connect<T>: From<U>,
    {
        let req = Connect::from(message);
        let host = req.host().to_string();
        let conn = self.connector.call(req);
        let config = self.config.clone();

        async move {
            let io = conn.await?;
            trace!("SSL Handshake start for: {:?}", host);

            let host = DNSNameRef::try_from_ascii_str(&host)
                .map_err(|e| io::Error::new(io::ErrorKind::Other, format!("{}", e)))?;

            match TlsConnector::from(config).connect(host, io).await {
                Ok(io) => {
                    trace!("SSL Handshake success: {:?}", host);
                    Ok(io)
                }
                Err(e) => {
                    trace!("SSL Handshake error: {:?}", e);
                    Err(io::Error::new(io::ErrorKind::Other, format!("{}", e)).into())
                }
            }
        }
    }
/// Resolve and connect to remote host
Resolve and connect to remote host
Resolve and connect to remote host
pub fn connect<U>(
        &self,
        message: U,
    ) -> impl Future<Output = Result<TlsStream<TcpStream>, ConnectError>>
    where
        Connect<T>: From<U>,
    {
        let req = Connect::from(message);
        let host = req.host().to_string();
        let conn = self.connector.call(req);
        let config = self.config.clone();
        async move {
            let io = conn.await?;
            trace!("SSL Handshake start for: {:?}", host);
            let host = DNSNameRef::try_from_ascii_str(&host)
                .map_err(|e| io::Error::new(io::ErrorKind::Other, format!("{}", e)))?;
            match TlsConnector::from(config).connect(host, io).await {
                Ok(io) => {
                    trace!("SSL Handshake success: {:?}", host);
                    Ok(io)
                }
                Err(e) => {
                    trace!("SSL Handshake error: {:?}", e);
                    Err(io::Error::new(io::ErrorKind::Other, format!("{}", e)).into())
                }
            }
        }
    }
pub fn connect < U > ( & self , message : U , ) -> impl Future < Output = Result < TlsStream < TcpStream > , ConnectError > > where Connect < T > : From < U > , { let req = Connect :: from ( message ) ; let host = req . host ( ) . to_string ( ) ; let conn = self . connector . call ( req ) ; let config = self . config . clone ( ) ; async move { let io = conn . await ? ; trace ! ( " " host ) ; let host = DNSNameRef :: try_from_ascii_str ( & host ) . map_err ( | e | io :: Error :: new ( io :: ErrorKind :: Other , format ! ( " " e ) ) ) ? ; match TlsConnector :: from ( config ) . connect ( host , io ) . await { Ok ( io ) => { trace ! ( " " host ) ; Ok ( io ) } Err ( e ) => { trace ! ( " " e ) ; Err ( io :: Error :: new ( io :: ErrorKind :: Other , format ! ( " " e ) ) . into ( ) ) } } } }
Resolve and connect to remote host
Resolve and connect to remote host
&self
message
U