Skip to content

Commit

Permalink
NS1: Add SRV record support (#277)
Browse files Browse the repository at this point in the history
* NS1 SRV record support
* Updated feature matrix
  • Loading branch information
bashgeek authored and Tom Limoncelli committed Nov 29, 2017
1 parent 53b72f3 commit f5bfcd0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/generate/featureMatrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 4 additions & 2 deletions docs/_includes/matrix.html
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -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>
Expand Down
6 changes: 4 additions & 2 deletions providers/ns1/ns1provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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, " ")})
}
Expand All @@ -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)
Expand Down

0 comments on commit f5bfcd0

Please # to comment.