增加批量上传证书接口、使用域名查询证书接口

This commit is contained in:
GoEdgeLab
2023-03-24 19:07:43 +08:00
parent 2970a0ac29
commit 2716a4eb4e
5 changed files with 192 additions and 11 deletions

View File

@@ -238,3 +238,17 @@ func TestSSLCertDAO_Update_JSON(t *testing.T) {
t.Log(cert)
}
}
func TestSSLCertDAO_FindAllCertsMatchDomains(t *testing.T) {
dbs.NotifyReady()
var tx *dbs.Tx
var dao = models.NewSSLCertDAO()
certs, err := dao.FindAllCertsMatchDomains(tx, 0, []string{"goedge.cn", "teaos.cn", "www.goedge.cn", "'hello\"'", "中文.com", "xn---1.com", "global.dl.goedge.cn"})
if err != nil {
t.Fatal(err)
}
for _, cert := range certs {
t.Log("id:", cert.Id, "userId:", cert.UserId, "name:", cert.Name, "dnsNames:", cert.DecodeDNSNames(), "end:", timeutil.FormatTime("Y-m-d H:i:s", int64(cert.TimeEndAt)))
}
}