DNS API支持查询多个同名记录/优化ACME申请

This commit is contained in:
GoEdgeLab
2022-11-17 17:33:59 +08:00
parent 1e1f81f2a0
commit 8b1a5e1fb7
16 changed files with 381 additions and 35 deletions

View File

@@ -103,7 +103,7 @@ func (this *CustomHTTPProvider) QueryRecord(domain string, name string, recordTy
if len(resp) == 0 || string(resp) == "null" {
return nil, nil
}
record := &dnstypes.Record{}
var record = &dnstypes.Record{}
err = json.Unmarshal(resp, record)
if err != nil {
return nil, err
@@ -114,6 +114,28 @@ func (this *CustomHTTPProvider) QueryRecord(domain string, name string, recordTy
return record, nil
}
// QueryRecords 查询多个记录
func (this *CustomHTTPProvider) QueryRecords(domain string, name string, recordType dnstypes.RecordType) (result []*dnstypes.Record, err error) {
resp, err := this.post(maps.Map{
"action": "QueryRecords",
"domain": domain,
"name": name,
"recordType": recordType,
})
if err != nil {
return nil, err
}
if len(resp) == 0 || string(resp) == "null" {
return nil, nil
}
result = []*dnstypes.Record{}
err = json.Unmarshal(resp, &result)
if err != nil {
return nil, err
}
return result, nil
}
// AddRecord 设置记录
func (this *CustomHTTPProvider) AddRecord(domain string, newRecord *dnstypes.Record) error {
_, err := this.post(maps.Map{