1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Implement DS record support for ClouDNS (#1018)

* Add PTR support for ClouDNS

* Implement PTR Support for CLouDNS

* implemnent DS Record for ClouDNS

* implement DS record for clouDNS

* pull request review

* note that SshFpAlgorithm and DsAlgorithm both use json field algorithm

* primitive rate limit and fix order of NS/DS-entries

* codefixes

Co-authored-by: IT-Sumpfling <it-sumpfling@maxit-con.de>
Co-authored-by: bentaybi jamal <jamal@pfalzcloud.de>
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
taybinakh
2021-01-22 18:54:39 +01:00
committed by GitHub
parent 20a726df27
commit d7f40ed680
4 changed files with 99 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ import (
"io/ioutil"
"net/http"
"strconv"
"time"
)
// Api layer for CloDNS
@@ -62,6 +63,10 @@ type domainRecord struct {
TlsaMatchingType string `json:"tlsa_matching_type,omitempty"`
SshfpAlgorithm string `json:"algorithm,omitempty"`
SshfpFingerprint string `json:"fp_type,omitempty"`
DsKeyTag string `json:"key_tag,omitempty"`
DsAlgorithm string `json:"dsalgorithm,omitempty"`
DsDigestType string `json:"digest_type,omitempty"`
DsDigest string `json:"dsdigest,omitempty"`
}
type recordResponse map[string]domainRecord
@@ -143,7 +148,7 @@ func (c *cloudnsProvider) createDomain(domain string) error {
func (c *cloudnsProvider) createRecord(domainID string, rec requestParams) error {
rec["domain-name"] = domainID
if _, err := c.get("/dns/add-record.json", rec); err != nil {
if _, err := c.get("/dns/add-record.json", rec); err != nil { // here we add record
return fmt.Errorf("failed create record (ClouDNS): %s", err)
}
return nil
@@ -204,6 +209,9 @@ func (c *cloudnsProvider) get(endpoint string, params requestParams) ([]byte, er
req.URL.RawQuery = q.Encode()
// ClouDNS has a rate limit (not documented) of 10 request/second
// so we do a very primitive rate-limiting here - delay every request for 100ms - so max. 10 requests/second ...
time.Sleep(100 * time.Millisecond)
resp, err := client.Do(req)
if err != nil {
return []byte{}, err