almost ready

This commit is contained in:
Tom Limoncelli 2025-09-11 11:55:01 -04:00
parent e14c804882
commit fda523e949
5 changed files with 199 additions and 261 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
go.mod
View file

@ -158,5 +158,3 @@ require (
gopkg.in/sourcemap.v1 v1.0.5 // indirect gopkg.in/sourcemap.v1 v1.0.5 // indirect
moul.io/http2curl v1.0.0 // indirect moul.io/http2curl v1.0.0 // indirect
) )
tool golang.org/x/tools/cmd/stringer

View file

@ -11,6 +11,21 @@ type SPFRecord struct {
Parts []*SPFPart Parts []*SPFPart
} }
// Lookups returns the number of DNS lookups required by s.
// NB(tlim): This needs to be in this file or "gopherjs build" fails.
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

View file

@ -26,20 +26,6 @@ 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{}