mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
REFACTOR: export models func downcase() (#2207)
This commit is contained in:
@@ -54,7 +54,7 @@ func TestDowncase(t *testing.T) {
|
|||||||
&RecordConfig{Type: "MX", Name: "lower", target: "targetmx"},
|
&RecordConfig{Type: "MX", Name: "lower", target: "targetmx"},
|
||||||
&RecordConfig{Type: "MX", Name: "UPPER", target: "TARGETMX"},
|
&RecordConfig{Type: "MX", Name: "UPPER", target: "TARGETMX"},
|
||||||
}}
|
}}
|
||||||
downcase(dc.Records)
|
Downcase(dc.Records)
|
||||||
if !dc.Records.HasRecordTypeName("MX", "lower") {
|
if !dc.Records.HasRecordTypeName("MX", "lower") {
|
||||||
t.Errorf("%v: expected (%v) got (%v)\n", dc.Records, false, true)
|
t.Errorf("%v: expected (%v) got (%v)\n", dc.Records, false, true)
|
||||||
}
|
}
|
||||||
|
@@ -556,11 +556,11 @@ func (recs Records) GroupedByFQDN() ([]string, map[string]Records) {
|
|||||||
|
|
||||||
// PostProcessRecords does any post-processing of the downloaded DNS records.
|
// PostProcessRecords does any post-processing of the downloaded DNS records.
|
||||||
func PostProcessRecords(recs []*RecordConfig) {
|
func PostProcessRecords(recs []*RecordConfig) {
|
||||||
downcase(recs)
|
Downcase(recs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Downcase converts all labels and targets to lowercase in a list of RecordConfig.
|
// Downcase converts all labels and targets to lowercase in a list of RecordConfig.
|
||||||
func downcase(recs []*RecordConfig) {
|
func Downcase(recs []*RecordConfig) {
|
||||||
for _, r := range recs {
|
for _, r := range recs {
|
||||||
r.Name = strings.ToLower(r.Name)
|
r.Name = strings.ToLower(r.Name)
|
||||||
r.NameFQDN = strings.ToLower(r.NameFQDN)
|
r.NameFQDN = strings.ToLower(r.NameFQDN)
|
||||||
|
Reference in New Issue
Block a user