本文整理汇总了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
}