本文整理匯總了Golang中github.com/lxc/lxd/shared.CertInfo.Certificate方法的典型用法代碼示例。如果您正苦於以下問題:Golang CertInfo.Certificate方法的具體用法?Golang CertInfo.Certificate怎麽用?Golang CertInfo.Certificate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/lxc/lxd/shared.CertInfo
的用法示例。
在下文中一共展示了CertInfo.Certificate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: certificatesGet
func certificatesGet(d *Daemon, r *http.Request) Response {
recursion := d.isRecursionRequest(r)
if recursion {
certResponses := []shared.CertInfo{}
baseCerts, err := dbCertsGet(d.db)
if err != nil {
return SmartError(err)
}
for _, baseCert := range baseCerts {
resp := shared.CertInfo{}
resp.Fingerprint = baseCert.Fingerprint
resp.Certificate = baseCert.Certificate
if baseCert.Type == 1 {
resp.Type = "client"
} else {
resp.Type = "unknown"
}
certResponses = append(certResponses, resp)
}
return SyncResponse(true, certResponses)
}
body := []string{}
for _, cert := range d.clientCerts {
fingerprint := fmt.Sprintf("/%s/certificates/%s", shared.APIVersion, certGenerateFingerprint(&cert))
body = append(body, fingerprint)
}
return SyncResponse(true, body)
}
示例2: doCertificateGet
func doCertificateGet(d *Daemon, fingerprint string) (shared.CertInfo, error) {
resp := shared.CertInfo{}
dbCertInfo, err := dbCertGet(d.db, fingerprint)
if err != nil {
return resp, err
}
resp.Fingerprint = dbCertInfo.Fingerprint
resp.Certificate = dbCertInfo.Certificate
if dbCertInfo.Type == 1 {
resp.Type = "client"
} else {
resp.Type = "unknown"
}
return resp, nil
}