CLOUDNS: Implement PTR Record Support (#999)

* Add PTR support for ClouDNS

* Implement PTR Support for CLouDNS

Co-authored-by: IT-Sumpfling <it-sumpfling@maxit-con.de>
Co-authored-by: bentaybi jamal <jamal@pfalzcloud.de>
This commit is contained in:
taybinakh 2020-12-22 19:32:00 +01:00 committed by GitHub
parent c89f14e926
commit e9f4257ad2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 6 deletions

1
.gitignore vendored
View file

@ -21,3 +21,4 @@ stack.sh
.idea/
*.nupkg
.DS_Store
.vscode/launch.json

View file

@ -9,17 +9,22 @@ jsId: CLOUDNS
## Configuration
In your credentials file, you must provide your [Api user ID and password](https://asia.cloudns.net/wiki/article/42/).
Current version of provider doesn't support `sub-auth-id` or `sub-auth-user`.
Current version of provider doesn't support `sub-auth-user`.
{% highlight json %}
{
"cloudns": {
"auth-id": "12345",
"sub-auth-id": "12345",
"auth-password": "your-password"
}
}
{% endhighlight %}
## Records
ClouDNS does not supprt DS Record.
## Metadata
This provider does not recognize any special metadata fields unique to ClouDNS.

View file

@ -35,6 +35,7 @@
},
"CLOUDNS": {
"auth-id": "$CLOUDNS_AUTH_ID",
"sub-auth-id": "$CLOUDNS_SUB_AUTH_ID",
"auth-password": "$CLOUDNS_AUTH_PASSWORD",
"domain": "$CLOUDNS_DOMAIN"
},

View file

@ -192,7 +192,7 @@ func (c *cloudnsProvider) get(endpoint string, params requestParams) ([]byte, er
req, _ := http.NewRequest("GET", "https://api.cloudns.net"+endpoint, nil)
q := req.URL.Query()
//TODO: Support sub-auth-id / sub-auth-user https://asia.cloudns.net/wiki/article/42/
//TODO: Support sub-auth-user https://asia.cloudns.net/wiki/article/42/
// Add auth params
q.Add("auth-id", c.creds.id)
q.Add("auth-password", c.creds.password)

View file

@ -15,7 +15,7 @@ import (
/*
CloDNS API DNS provider:
Info required in `creds.json`:
- auth-id
- auth-id or sub-auth-id
- auth-password
*/
@ -26,7 +26,7 @@ func NewCloudns(m map[string]string, metadata json.RawMessage) (providers.DNSSer
c.creds.id, c.creds.password, c.creds.subid = m["auth-id"], m["auth-password"], m["sub-auth-id"]
if (c.creds.id == "" && c.creds.subid == "") || c.creds.password == "" {
return nil, fmt.Errorf("missing ClouDNS auth-id and auth-password")
return nil, fmt.Errorf("missing ClouDNS auth-id or sub-auth-id and auth-password")
}
// Get a domain to validate authentication
@ -46,7 +46,7 @@ var features = providers.DocumentationNotes{
providers.CanUseSSHFP: providers.Can(),
providers.CanUseCAA: providers.Can(),
providers.CanUseTLSA: providers.Can(),
providers.CanUsePTR: providers.Unimplemented(),
providers.CanUsePTR: providers.Can(),
providers.CanGetZones: providers.Can(),
}
@ -193,7 +193,7 @@ func toRc(domain string, r *domainRecord) *models.RecordConfig {
switch rtype := r.Type; rtype { // #rtype_variations
case "TXT":
rc.SetTargetTXT(r.Target)
case "CNAME", "MX", "NS", "SRV", "ALIAS":
case "CNAME", "MX", "NS", "SRV", "ALIAS", "PTR":
rc.SetTarget(dnsutil.AddOrigin(r.Target+".", domain))
case "CAA":
caaFlag, _ := strconv.ParseUint(r.CaaFlag, 10, 32)