Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

NS1: Add SRV record support #277

Merged
merged 2 commits into from
Nov 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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