mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-10-09 05:17:07 +08:00
deadcode: move sfplib.Lookups to parse_test.go
This commit is contained in:
parent
3920d19ad4
commit
ce12d892df
2 changed files with 14 additions and 14 deletions
|
@ -10,20 +10,6 @@ type SPFRecord struct {
|
||||||
Parts []*SPFPart
|
Parts []*SPFPart
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lookups returns the number of DNS lookups required by s.
|
|
||||||
func (s *SPFRecord) Lookups() int {
|
|
||||||
count := 0
|
|
||||||
for _, p := range s.Parts {
|
|
||||||
if p.IsLookup {
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
if p.IncludeRecord != nil {
|
|
||||||
count += p.IncludeRecord.Lookups()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return count
|
|
||||||
}
|
|
||||||
|
|
||||||
// SPFPart stores a part of an SPF record, with attributes.
|
// SPFPart stores a part of an SPF record, with attributes.
|
||||||
type SPFPart struct {
|
type SPFPart struct {
|
||||||
Text string
|
Text string
|
||||||
|
|
|
@ -27,6 +27,20 @@ func dump(rec *SPFRecord, indent string, w io.Writer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lookups returns the number of DNS lookups required by s.
|
||||||
|
func (s *SPFRecord) Lookups() int {
|
||||||
|
count := 0
|
||||||
|
for _, p := range s.Parts {
|
||||||
|
if p.IsLookup {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
if p.IncludeRecord != nil {
|
||||||
|
count += p.IncludeRecord.Lookups()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
// Print prints an SPFRecord.
|
// Print prints an SPFRecord.
|
||||||
func (s *SPFRecord) Print() string {
|
func (s *SPFRecord) Print() string {
|
||||||
w := &bytes.Buffer{}
|
w := &bytes.Buffer{}
|
||||||
|
|
Loading…
Add table
Reference in a new issue