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

@@ -154,7 +154,30 @@ func (this *AliDNSProvider) QueryRecord(domain string, name string, recordType d
return record, nil
}
}
return nil, err
return nil, nil
}
// QueryRecords 查询多个记录
func (this *AliDNSProvider) QueryRecords(domain string, name string, recordType dnstypes.RecordType) ([]*dnstypes.Record, error) {
// 从缓存中读取
if this.ProviderId > 0 {
records, hasRecords, _ := sharedDomainRecordsCache.QueryDomainRecords(this.ProviderId, domain, name, recordType)
if hasRecords { // 有效的搜索
return records, nil
}
}
records, err := this.GetRecords(domain)
if err != nil {
return nil, err
}
var result = []*dnstypes.Record{}
for _, record := range records {
if record.Name == name && record.Type == recordType {
result = append(result, record)
}
}
return result, nil
}
// AddRecord 设置记录