pub async fn connect(
        &mut self,
        dest_endpoint: &str,
        cert_host: Option<&str>,
    ) -> Result<OutgoingJsonRpcRequest> {
        let start = Instant::now();
        let url = Url::parse(dest_endpoint).map_err(|_| {
            Error::ClientError("Failed to parse remote end point address".to_string())
        })?;
        let remote = url
            .socket_addrs(|| None)
            .map_err(|_| Error::ClientError("Invalid remote end point address".to_string()))?[0];
        let host = cert_host
            .as_ref()
            .map_or_else(|| url.host_str(), |x| Some(&x))
            .ok_or_else(|| Error::ClientError("No certificate hostname specified".to_string()))?;

        let new_conn = self
            .quinn_endpoint
            .connect(&remote, &host)
            .map_err(|err| {
                Error::ClientError(format!(
                    "Failed when attempting to create a connection with remote QUIC endpoint: {}",
                    err
                ))
            })?
            .await
            .map_err(|err| {
                Error::ClientError(format!(
                    "Failed to establish connection with remote QUIC endpoint: {}",
                    err
                ))
            })?;

        debug!(
            "Connected with remote QUIC endpoint at {:?}",
            start.elapsed()
        );
        let quinn::NewConnection {
            connection: conn, ..
        } = { new_conn };

        Ok(OutgoingJsonRpcRequest::new(conn))
    }
// Connect to a remote peer to send JSON-RPC requests
// dest_endpoint: QUIC destination endpoint URL
// cert_host: Override hostname used for certificate verification
Connect to a remote peer to send JSON-RPC requests
dest_endpoint: QUIC destination endpoint URL
cert_host: Override hostname used for certificate verification
Connect to a remote peer to send JSON - RPC requests dest_endpoint : QUIC destination endpoint URL cert_host : Override hostname used for certificate verification
pub async fn connect(
        &mut self,
        dest_endpoint: &str,
        cert_host: Option<&str>,
    ) -> Result<OutgoingJsonRpcRequest> {
        let start = Instant::now();
        let url = Url::parse(dest_endpoint).map_err(|_| {
            Error::ClientError("Failed to parse remote end point address".to_string())
        })?;
        let remote = url
            .socket_addrs(|| None)
            .map_err(|_| Error::ClientError("Invalid remote end point address".to_string()))?[0];
        let host = cert_host
            .as_ref()
            .map_or_else(|| url.host_str(), |x| Some(&x))
            .ok_or_else(|| Error::ClientError("No certificate hostname specified".to_string()))?;
        let new_conn = self
            .quinn_endpoint
            .connect(&remote, &host)
            .map_err(|err| {
                Error::ClientError(format!(
                    "Failed when attempting to create a connection with remote QUIC endpoint: {}",
                    err
                ))
            })?
            .await
            .map_err(|err| {
                Error::ClientError(format!(
                    "Failed to establish connection with remote QUIC endpoint: {}",
                    err
                ))
            })?;
        debug!(
            "Connected with remote QUIC endpoint at {:?}",
            start.elapsed()
        );
        let quinn::NewConnection {
            connection: conn, ..
        } = { new_conn };
        Ok(OutgoingJsonRpcRequest::new(conn))
    }
pub async fn connect ( & mut self , dest_endpoint : & str , cert_host : Option < & str > , ) -> Result < OutgoingJsonRpcRequest > { let start = Instant :: now ( ) ; let url = Url :: parse ( dest_endpoint ) . map_err ( | _ | { Error :: ClientError ( " " . to_string ( ) ) } ) ? ; let remote = url . socket_addrs ( | | None ) . map_err ( | _ | Error :: ClientError ( " " . to_string ( ) ) ) ? [ 0 ] ; let host = cert_host . as_ref ( ) . map_or_else ( | | url . host_str ( ) , | x | Some ( & x ) ) . ok_or_else ( | | Error :: ClientError ( " " . to_string ( ) ) ) ? ; let new_conn = self . quinn_endpoint . connect ( & remote , & host ) . map_err ( | err | { Error :: ClientError ( format ! ( " " err ) ) } ) ? . await . map_err ( | err | { Error :: ClientError ( format ! ( " " err ) ) } ) ? ; debug ! ( " " start elapsed ( ) ) ; let quinn :: NewConnection { connection : conn , .. } = { new_conn } ; Ok ( OutgoingJsonRpcRequest :: new ( conn ) ) }
Connect to a remote peer to send JSON-RPC requests
dest_endpoint: QUIC destination endpoint URL
cert_host: Override hostname used for certificate verification
Connect to a remote peer to send JSON - RPC requests dest_endpoint : QUIC destination endpoint URL cert_host : Override hostname used for certificate verification
&mut self
dest_endpoint
&str
cert_host
Option<&str>