添加DNS账号时自动读取DNS服务商下域名

This commit is contained in:
GoEdgeLab
2021-08-19 14:26:34 +08:00
parent ec1c59f33a
commit b2e3fba97e
18 changed files with 308 additions and 3 deletions

View File

@@ -59,6 +59,21 @@ func (this *CloudFlareProvider) Auth(params maps.Map) error {
return nil
}
// GetDomains 获取所有域名列表
func (this *CloudFlareProvider) GetDomains() (domains []string, err error) {
resp := new(cloudflare.ZonesResponse)
err = this.doAPI(http.MethodGet, "zones", map[string]string{}, nil, resp)
if err != nil {
return nil, err
}
for _, zone := range resp.Result {
domains = append(domains, zone.Name)
}
return
}
// GetRecords 获取域名解析记录列表
func (this *CloudFlareProvider) GetRecords(domain string) (records []*dnstypes.Record, err error) {
zoneId, err := this.findZoneIdWithDomain(domain)