- 新增 ACME客户端功能,支持域名注册和证书申请 - 添加数据库模型和操作,用于存储和管理域名信息 - 实现 API 接口,提供域名注册、获取和分页查询功能 -集成全局错误处理和 panic捕获 - 添加单元测试和集成测试
28 lines
863 B
Go
28 lines
863 B
Go
package acme
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestRegister(t *testing.T) {
|
|
register := Register("1302344380@qq.com")
|
|
fmt.Println(register.Email)
|
|
fmt.Println(register.PrivateKey)
|
|
fmt.Println(register.Registration)
|
|
}
|
|
|
|
func TestParseRegister(t *testing.T) {
|
|
res := RegisterRes{
|
|
Email: "1302344380@qq.com",
|
|
Registration: "{\"body\":{\"status\":\"valid\",\"contact\":[\"mailto:1302344380@qq.com\"]},\"uri\":\"https://acme-v02.api.letsencrypt.org/acme/acct/2379447617\"}",
|
|
PrivateKey: "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgnxjIGpla+EGdl2+JcPBuE5T06wKYbp4x49aykmS84ryhRANCAARqMaBmXLfqgsJDmISHX9cLJcX19W51UjcKQ0rLllyf8YjOsxCZ+XHW/DpS/hh2VLgc5zpZtgBWOAskN1viAFKi",
|
|
}
|
|
|
|
user := User{}
|
|
register := user.FromRegister(&res)
|
|
fmt.Println(register.GetEmail())
|
|
fmt.Println(register.GetPrivateKey())
|
|
fmt.Println(register.GetRegistration())
|
|
}
|