pub fn new<P: AsRef<Path>>(
        cert_base_path: P,
        idle_timeout: Option<u64>,
        keylog: bool,
    ) -> Result<Self> {
        let mut client_config = quinn::ClientConfigBuilder::default();
        client_config.protocols(ALPN_QUIC_HTTP);

        if keylog {
            client_config.enable_keylog();
        }

        let mut ca_path = PathBuf::new();
        ca_path.push(cert_base_path);
        ca_path.push("cert.der");

        let ca_certificate = fs::read(&ca_path).map_err(|err| {
            Error::ClientError(format!(
                "Failed to read certificate from '{}': {}",
                ca_path.display(),
                err
            ))
        })?;
        let ca_authority = quinn::Certificate::from_der(&ca_certificate).map_err(|err| {
            Error::ClientError(format!(
                "Failed to obtain CA authority from certificate found at '{}': {}",
                ca_path.display(),
                err
            ))
        })?;

        client_config
            .add_certificate_authority(ca_authority)
            .map_err(|err| {
                Error::ClientError(format!(
                    "Failed to add CA authority to QUIC client configuration: {}",
                    err
                ))
            })?;

        let mut config = client_config.build();
        if let Some(timeout) = idle_timeout {
            config.transport = Arc::new(utils::new_transport_cfg(timeout)?)
        };
        Ok(Self { config })
    }
// cert_base_path: Base path where to locate custom certificate authority to trust, in DER format
// idle_timeout: Optional number of millis before timing out an idle connection
// keylog: Perform NSS-compatible TLS key logging to the file specified in `SSLKEYLOGFILE`
Base path where to locate custom certificate authority to trust, in DER format
idle_timeout: Optional number of millis before timing out an idle connection
keylog: Perform NSS-compatible TLS key logging to the file specified in `SSLKEYLOGFILE`
Base path where to locate custom certificate authority to trust in DER format idle_timeout : Optional number of millis before timing out an idle connection keylog : Perform NSS - compatible TLS key logging to the file specified in ` SSLKEYLOGFILE `
pub fn new<P: AsRef<Path>>(
        cert_base_path: P,
        idle_timeout: Option<u64>,
        keylog: bool,
    ) -> Result<Self> {
        let mut client_config = quinn::ClientConfigBuilder::default();
        client_config.protocols(ALPN_QUIC_HTTP);
        if keylog {
            client_config.enable_keylog();
        }
        let mut ca_path = PathBuf::new();
        ca_path.push(cert_base_path);
        ca_path.push("cert.der");
        let ca_certificate = fs::read(&ca_path).map_err(|err| {
            Error::ClientError(format!(
                "Failed to read certificate from '{}': {}",
                ca_path.display(),
                err
            ))
        })?;
        let ca_authority = quinn::Certificate::from_der(&ca_certificate).map_err(|err| {
            Error::ClientError(format!(
                "Failed to obtain CA authority from certificate found at '{}': {}",
                ca_path.display(),
                err
            ))
        })?;
        client_config
            .add_certificate_authority(ca_authority)
            .map_err(|err| {
                Error::ClientError(format!(
                    "Failed to add CA authority to QUIC client configuration: {}",
                    err
                ))
            })?;
        let mut config = client_config.build();
        if let Some(timeout) = idle_timeout {
            config.transport = Arc::new(utils::new_transport_cfg(timeout)?)
        };
        Ok(Self { config })
    }
pub fn new < P : AsRef < Path > > ( cert_base_path : P , idle_timeout : Option < u64 > , keylog : bool , ) -> Result < Self > { let mut client_config = quinn :: ClientConfigBuilder :: default ( ) ; client_config . protocols ( ALPN_QUIC_HTTP ) ; if keylog { client_config . enable_keylog ( ) ; } let mut ca_path = PathBuf :: new ( ) ; ca_path . push ( cert_base_path ) ; ca_path . push ( " " ) ; let ca_certificate = fs :: read ( & ca_path ) . map_err ( | err | { Error :: ClientError ( format ! ( " " ca_path display ( ) err ) ) } ) ? ; let ca_authority = quinn :: Certificate :: from_der ( & ca_certificate ) . map_err ( | err | { Error :: ClientError ( format ! ( " " ca_path display ( ) err ) ) } ) ? ; client_config . add_certificate_authority ( ca_authority ) . map_err ( | err | { Error :: ClientError ( format ! ( " " err ) ) } ) ? ; let mut config = client_config . build ( ) ; if let Some ( timeout ) = idle_timeout { config . transport = Arc :: new ( utils :: new_transport_cfg ( timeout ) ? ) } ; Ok ( Self { config } ) }
cert_base_path: Base path where to locate custom certificate authority to trust, in DER format
idle_timeout: Optional number of millis before timing out an idle connection
keylog: Perform NSS-compatible TLS key logging to the file specified in `SSLKEYLOGFILE`
cert_base_path : Base path where to locate custom certificate authority to trust in DER format idle_timeout : Optional number of millis before timing out an idle connection keylog : Perform NSS - compatible TLS key logging to the file specified in ` SSLKEYLOGFILE `
cert_base_path
P
idle_timeout
Option<u64>
keylog
bool