lxd/cluster/tls.go
func tlsCheckCert(r *http.Request, info *shared.CertInfo) bool {
	cert, err := x509.ParseCertificate(info.KeyPair().Certificate[0])
	if err != nil {
		// Since we have already loaded this certificate, typically
		// using LoadX509KeyPair, an error should never happen, but
		// check for good measure.
		panic(fmt.Sprintf("invalid keypair material: %v", err))
	}
	trustedCerts := map[string]x509.Certificate{"0": *cert}

	trusted, _ := util.CheckTrustState(*r.TLS.PeerCertificates[0], trustedCerts)

	return r.TLS != nil && trusted
}
func tlsCheckCert(r *http.Request, info *shared.CertInfo) bool {
	cert, err := x509.ParseCertificate(info.KeyPair().Certificate[0])
	if err != nil {
		// Since we have already loaded this certificate, typically
		// using LoadX509KeyPair, an error should never happen, but
		// check for good measure.
		panic(fmt.Sprintf("invalid keypair material: %v", err))
	}
	trustedCerts := map[string]x509.Certificate{"0": *cert}

	trusted, _ := util.CheckTrustState(*r.TLS.PeerCertificates[0], trustedCerts)

	return r.TLS != nil && trusted
}
func tlsCheckCert ( r * http . Request , info * shared . CertInfo ) bool { cert , err := x509 . ParseCertificate ( info . KeyPair ( ) . Certificate [ 0 ] ) if err != nil { // Since we have already loaded this certificate, typically // using LoadX509KeyPair, an error should never happen, but // check for good measure. panic ( fmt . Sprintf ( " " , err ) ) } trustedCerts := map [ string ] x509 . Certificate { " " : * cert } trusted , _ := util . CheckTrustState ( * r . TLS . PeerCertificates [ 0 ] , trustedCerts ) return r . TLS != nil && trusted }
// Return true if the given request is presenting the given cluster certificate.
Return true if the given request is presenting the given cluster certificate .