NS1: Add SRV record support (#277)

* NS1 SRV record support
* Updated feature matrix
This commit is contained in:
Daniel Schmitz 2017-11-29 20:57:35 +08:00 committed by Tom Limoncelli
parent 53b72f39a8
commit f5bfcd0d6e
3 changed files with 9 additions and 5 deletions

View file

@ -115,7 +115,7 @@ var tmpl = template.Must(template.New("").Funcs(template.FuncMap{
"safe": func(s string) template.HTML { return template.HTML(s) },
}).Parse(`
{% comment %}
Matrix generated by build/generate/featureMatrix.go. DO NOT HAND EDIT!
Matrix generated by build/generate/featureMatrix.go. DO NOT HAND EDIT!
{% endcomment %}{{$providers := .Providers}}
<table class="table-header-rotated">
<thead>

View file

@ -1,6 +1,6 @@
{% comment %}
Matrix generated by build/generate/featureMatrix.go. DO NOT HAND EDIT!
Matrix generated by build/generate/featureMatrix.go. DO NOT HAND EDIT!
{% endcomment %}
<table class="table-header-rotated">
<thead>
@ -232,7 +232,9 @@
<td class="success">
<i class="fa fa-check text-success" aria-hidden="true"></i>
</td>
<td><i class="fa fa-minus dim"></i></td>
<td class="success">
<i class="fa fa-check text-success" aria-hidden="true"></i>
</td>
<td class="success">
<i class="fa fa-check text-success" aria-hidden="true"></i>
</td>

View file

@ -25,7 +25,7 @@ var docNotes = providers.DocumentationNotes{
}
func init() {
providers.RegisterDomainServiceProviderType("NS1", newProvider, docNotes)
providers.RegisterDomainServiceProviderType("NS1", newProvider, providers.CanUseSRV, docNotes)
}
type nsone struct {
@ -128,6 +128,8 @@ func buildRecord(recs models.Records, domain string, id string) *dns.Record {
for _, r := range recs {
if r.Type == "TXT" {
rec.AddAnswer(&dns.Answer{Rdata: []string{r.Target}})
} else if r.Type == "SRV" {
rec.AddAnswer(&dns.Answer{Rdata: strings.Split(fmt.Sprintf("%d %d %d %v", r.SrvPriority, r.SrvWeight, r.SrvPort, r.Target), " ")})
} else {
rec.AddAnswer(&dns.Answer{Rdata: strings.Split(r.Target, " ")})
}
@ -146,7 +148,7 @@ func convert(zr *dns.ZoneRecord, domain string) ([]*models.RecordConfig, error)
Original: zr,
Type: zr.Type,
}
if zr.Type == "MX" {
if zr.Type == "MX" || zr.Type == "SRV" {
rec.CombinedTarget = true
}
found = append(found, rec)