add the new ANAME record type to the records list (#158)

This commit is contained in:
Pat Moroney 2017-07-20 14:39:40 -06:00 committed by Craig Peterson
parent dee2456fdf
commit 8d390aad24

View file

@ -106,7 +106,7 @@ func (r *nameComRecord) toRecord() *models.RecordConfig {
Original: r, Original: r,
} }
switch r.Type { switch r.Type {
case "A", "AAAA", "CNAME", "NS", "TXT": case "A", "AAAA", "ANAME", "CNAME", "NS", "TXT":
// nothing additional. // nothing additional.
case "MX": case "MX":
rc.MxPreference = uint16(prio) rc.MxPreference = uint16(prio)
@ -141,7 +141,7 @@ func (n *nameDotCom) getRecords(domain string) ([]*nameComRecord, error) {
} }
for _, rc := range result.Records { for _, rc := range result.Records {
if rc.Type == "CNAME" || rc.Type == "MX" || rc.Type == "NS" { if rc.Type == "CNAME" || rc.Type == "ANAME" || rc.Type == "MX" || rc.Type == "NS" {
rc.Content = rc.Content + "." rc.Content = rc.Content + "."
} }
} }
@ -150,7 +150,7 @@ func (n *nameDotCom) getRecords(domain string) ([]*nameComRecord, error) {
func (n *nameDotCom) createRecord(rc *models.RecordConfig, domain string) error { func (n *nameDotCom) createRecord(rc *models.RecordConfig, domain string) error {
target := rc.Target target := rc.Target
if rc.Type == "CNAME" || rc.Type == "MX" || rc.Type == "NS" { if rc.Type == "CNAME" || rc.Type == "ANAME" || rc.Type == "MX" || rc.Type == "NS" {
if target[len(target)-1] == '.' { if target[len(target)-1] == '.' {
target = target[:len(target)-1] target = target[:len(target)-1]
} else { } else {
@ -174,7 +174,7 @@ func (n *nameDotCom) createRecord(rc *models.RecordConfig, domain string) error
dat.Hostname = "" dat.Hostname = ""
} }
switch rc.Type { switch rc.Type {
case "A", "AAAA", "CNAME", "MX", "NS", "TXT": case "A", "AAAA", "ANAME", "CNAME", "MX", "NS", "TXT":
// nothing // nothing
case "SRV": case "SRV":
dat.Content = fmt.Sprintf("%d %d %v", rc.SrvWeight, rc.SrvPort, rc.Target) dat.Content = fmt.Sprintf("%d %d %v", rc.SrvWeight, rc.SrvPort, rc.Target)