fn init_configuration(configuration: &mut RTCConfiguration) -> Result<()> {
        let sanitized_ice_servers = configuration.get_ice_servers();
        if !sanitized_ice_servers.is_empty() {
            for server in &sanitized_ice_servers {
                server.validate()?;
            }
        }

        // https://www.w3.org/TR/webrtc/#constructor (step #3)
        if !configuration.certificates.is_empty() {
            let now = SystemTime::now();
            for cert in &configuration.certificates {
                cert.expires()
                    .duration_since(now)
                    .map_err(|_| Error::ErrCertificateExpired)?;
            }
        } else {
            let kp = KeyPair::generate(&rcgen::PKCS_ECDSA_P256_SHA256)?;
            let cert = RTCCertificate::from_key_pair(kp)?;
            configuration.certificates = vec![cert];
        };

        Ok(())
    }
/// init_configuration defines validation of the specified Configuration and
/// its assignment to the internal configuration variable. This function differs
/// from its set_configuration counterpart because most of the checks do not
/// include verification statements related to the existing state. Thus the
/// function describes only minor verification of some the struct variables.
init_configuration defines validation of the specified Configuration and
its assignment to the internal configuration variable. This function differs
from its set_configuration counterpart because most of the checks do not
include verification statements related to the existing state. Thus the
function describes only minor verification of some the struct variables.
init_configuration defines validation of the specified Configuration and its assignment to the internal configuration variable . This function differs from its set_configuration counterpart because most of the checks do not include verification statements related to the existing state . Thus the function describes only minor verification of some the struct variables .
fn init_configuration(configuration: &mut RTCConfiguration) -> Result<()> {
        let sanitized_ice_servers = configuration.get_ice_servers();
        if !sanitized_ice_servers.is_empty() {
            for server in &sanitized_ice_servers {
                server.validate()?;
            }
        }
        // https://www.w3.org/TR/webrtc/#constructor (step #3)
        if !configuration.certificates.is_empty() {
            let now = SystemTime::now();
            for cert in &configuration.certificates {
                cert.expires()
                    .duration_since(now)
                    .map_err(|_| Error::ErrCertificateExpired)?;
            }
        } else {
            let kp = KeyPair::generate(&rcgen::PKCS_ECDSA_P256_SHA256)?;
            let cert = RTCCertificate::from_key_pair(kp)?;
            configuration.certificates = vec![cert];
        };
        Ok(())
    }
fn init_configuration ( configuration : & mut RTCConfiguration ) -> Result < ( ) > { let sanitized_ice_servers = configuration . get_ice_servers ( ) ; if ! sanitized_ice_servers . is_empty ( ) { for server in & sanitized_ice_servers { server . validate ( ) ? ; } } // https://www.w3.org/TR/webrtc/#constructor (step #3) if ! configuration . certificates . is_empty ( ) { let now = SystemTime :: now ( ) ; for cert in & configuration . certificates { cert . expires ( ) . duration_since ( now ) . map_err ( | _ | Error :: ErrCertificateExpired ) ? ; } } else { let kp = KeyPair :: generate ( & rcgen :: PKCS_ECDSA_P256_SHA256 ) ? ; let cert = RTCCertificate :: from_key_pair ( kp ) ? ; configuration . certificates = vec ! [ cert ] ; } ; Ok ( ( ) ) }
init_configuration defines validation of the specified Configuration and
its assignment to the internal configuration variable.
init_configuration defines validation of the specified Configuration and its assignment to the internal configuration variable .
configuration
&mut RTCConfiguration