本文整理汇总了Golang中github.com/hlandau/acme/storage.Store.DefaultTarget方法的典型用法代码示例。如果您正苦于以下问题:Golang Store.DefaultTarget方法的具体用法?Golang Store.DefaultTarget怎么用?Golang Store.DefaultTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/hlandau/acme/storage.Store
的用法示例。
在下文中一共展示了Store.DefaultTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: StatusString
func StatusString(s storage.Store) string {
var buf bytes.Buffer
fmt.Fprintf(&buf, "Settings:\n")
fmt.Fprintf(&buf, " ACME_STATE_DIR: %s\n", s.Path())
fmt.Fprintf(&buf, " ACME_HOOKS_DIR: %s\n", hooks.DefaultPath)
fmt.Fprintf(&buf, " Default directory URL: %s\n", s.DefaultTarget().Request.Provider)
fmt.Fprintf(&buf, " Preferred key type: %v\n", &s.DefaultTarget().Request.Key)
fmt.Fprintf(&buf, " Additional webroots:\n")
for _, wr := range s.DefaultTarget().Request.Challenge.WebrootPaths {
fmt.Fprintf(&buf, " %s\n", wr)
}
fmt.Fprintf(&buf, "\nAvailable accounts:\n")
s.VisitAccounts(func(a *storage.Account) error {
fmt.Fprintf(&buf, " %v\n", a)
thumbprint, _ := acmeutils.Base64Thumbprint(a.PrivateKey)
fmt.Fprintf(&buf, " thumbprint: %s\n", thumbprint)
return nil
})
fmt.Fprintf(&buf, "\n")
s.VisitTargets(func(t *storage.Target) error {
fmt.Fprintf(&buf, "%v\n", t)
c, err := storageops.FindBestCertificateSatisfying(s, t)
if err != nil {
fmt.Fprintf(&buf, " error: %v\n", err)
return nil // continue
}
renewStr := ""
if storageops.CertificateNeedsRenewing(c) {
renewStr = " needs-renewing"
}
fmt.Fprintf(&buf, " best: %v%s\n", c, renewStr)
return nil
})
if storageops.HaveUncachedCertificates(s) {
fmt.Fprintf(&buf, "\nThere are uncached certificates.\n")
}
return buf.String()
}