mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
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:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -21,3 +21,4 @@ stack.sh
|
|||||||
.idea/
|
.idea/
|
||||||
*.nupkg
|
*.nupkg
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.vscode/launch.json
|
||||||
|
|||||||
@@ -9,17 +9,22 @@ jsId: CLOUDNS
|
|||||||
## Configuration
|
## Configuration
|
||||||
In your credentials file, you must provide your [Api user ID and password](https://asia.cloudns.net/wiki/article/42/).
|
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 %}
|
{% highlight json %}
|
||||||
{
|
{
|
||||||
"cloudns": {
|
"cloudns": {
|
||||||
"auth-id": "12345",
|
"auth-id": "12345",
|
||||||
|
"sub-auth-id": "12345",
|
||||||
"auth-password": "your-password"
|
"auth-password": "your-password"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
|
## Records
|
||||||
|
|
||||||
|
ClouDNS does not supprt DS Record.
|
||||||
|
|
||||||
## Metadata
|
## Metadata
|
||||||
This provider does not recognize any special metadata fields unique to ClouDNS.
|
This provider does not recognize any special metadata fields unique to ClouDNS.
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
},
|
},
|
||||||
"CLOUDNS": {
|
"CLOUDNS": {
|
||||||
"auth-id": "$CLOUDNS_AUTH_ID",
|
"auth-id": "$CLOUDNS_AUTH_ID",
|
||||||
|
"sub-auth-id": "$CLOUDNS_SUB_AUTH_ID",
|
||||||
"auth-password": "$CLOUDNS_AUTH_PASSWORD",
|
"auth-password": "$CLOUDNS_AUTH_PASSWORD",
|
||||||
"domain": "$CLOUDNS_DOMAIN"
|
"domain": "$CLOUDNS_DOMAIN"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ func (c *cloudnsProvider) get(endpoint string, params requestParams) ([]byte, er
|
|||||||
req, _ := http.NewRequest("GET", "https://api.cloudns.net"+endpoint, nil)
|
req, _ := http.NewRequest("GET", "https://api.cloudns.net"+endpoint, nil)
|
||||||
q := req.URL.Query()
|
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
|
// Add auth params
|
||||||
q.Add("auth-id", c.creds.id)
|
q.Add("auth-id", c.creds.id)
|
||||||
q.Add("auth-password", c.creds.password)
|
q.Add("auth-password", c.creds.password)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
/*
|
/*
|
||||||
CloDNS API DNS provider:
|
CloDNS API DNS provider:
|
||||||
Info required in `creds.json`:
|
Info required in `creds.json`:
|
||||||
- auth-id
|
- auth-id or sub-auth-id
|
||||||
- auth-password
|
- 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"]
|
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 == "" {
|
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
|
// Get a domain to validate authentication
|
||||||
@@ -46,7 +46,7 @@ var features = providers.DocumentationNotes{
|
|||||||
providers.CanUseSSHFP: providers.Can(),
|
providers.CanUseSSHFP: providers.Can(),
|
||||||
providers.CanUseCAA: providers.Can(),
|
providers.CanUseCAA: providers.Can(),
|
||||||
providers.CanUseTLSA: providers.Can(),
|
providers.CanUseTLSA: providers.Can(),
|
||||||
providers.CanUsePTR: providers.Unimplemented(),
|
providers.CanUsePTR: providers.Can(),
|
||||||
providers.CanGetZones: 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
|
switch rtype := r.Type; rtype { // #rtype_variations
|
||||||
case "TXT":
|
case "TXT":
|
||||||
rc.SetTargetTXT(r.Target)
|
rc.SetTargetTXT(r.Target)
|
||||||
case "CNAME", "MX", "NS", "SRV", "ALIAS":
|
case "CNAME", "MX", "NS", "SRV", "ALIAS", "PTR":
|
||||||
rc.SetTarget(dnsutil.AddOrigin(r.Target+".", domain))
|
rc.SetTarget(dnsutil.AddOrigin(r.Target+".", domain))
|
||||||
case "CAA":
|
case "CAA":
|
||||||
caaFlag, _ := strconv.ParseUint(r.CaaFlag, 10, 32)
|
caaFlag, _ := strconv.ParseUint(r.CaaFlag, 10, 32)
|
||||||
|
|||||||
Reference in New Issue
Block a user