@@ -46,7 +46,14 @@ func (p Api) RetrieveRecords(domain string) ([]Record, error) {
46
46
return nil , err
47
47
}
48
48
49
- records := ignoreRecords (response .Records )
49
+ records := make ([]Record , 0 )
50
+ for _ , record := range response .Records {
51
+ if record .isIgnored () {
52
+ continue
53
+ }
54
+ records = append (records , record )
55
+ }
56
+
50
57
return records , nil
51
58
}
52
59
@@ -61,7 +68,7 @@ func (p Api) CreateRecord(domain string, toCreate Record) (string, error) {
61
68
Id int `json:"id"`
62
69
}
63
70
64
- if isIgnored (toCreate ) {
71
+ if toCreate . isIgnored () {
65
72
return "" , fmt .Errorf ("cannot create an ignored record: %s" , toCreate )
66
73
}
67
74
@@ -92,30 +99,6 @@ func (p Api) DeleteRecord(domain string, id string) error {
92
99
return nil
93
100
}
94
101
95
- func isIgnored (record Record ) bool {
96
- if record .Type == "NS" {
97
- return true
98
- }
99
- if strings .HasPrefix (record .Name , "_acme-challenge" ) {
100
- return true
101
- }
102
-
103
- return false
104
- }
105
-
106
- func ignoreRecords (input []Record ) []Record {
107
- records := make ([]Record , 0 )
108
- for _ , record := range input {
109
- if isIgnored (record ) {
110
- continue
111
- }
112
-
113
- records = append (records , record )
114
- }
115
-
116
- return records
117
- }
118
-
119
102
// Trims a root domain from a longer subdomain. For example, trims
120
103
// host.example.com to host. If the subdomain is example.com, then
121
104
// returns an empty string
0 commit comments