spflib

package
v0.2.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachingResolver added in v0.2.2

type CachingResolver interface {
	Resolver
	ChangedRecords() []string
	ResolveErrors() []error
	Save(filename string) error
}

CachingResolver wraps a live resolver and adds caching to it. GetSPF will always return the cached value, if present. It will also query the inner resolver and compare results. If a given lookup has inconsistencies between cache and live, GetSPF will return the cached result. All records queries will be stored for the lifetime of the resolver, and can be flushed to disk at the end. All resolution errors from the inner resolver will be saved and can be retreived later.

func NewCache added in v0.2.2

func NewCache(filename string) (CachingResolver, error)

NewCache creates a new cache file named filename.

type LiveResolver added in v0.2.2

type LiveResolver struct{}

LiveResolver simply queries DNS to resolve SPF records.

func (LiveResolver) GetSPF added in v0.2.2

func (l LiveResolver) GetSPF(name string) (string, error)

GetSPF looks up the SPF record named "name".

type Resolver added in v0.2.2

type Resolver interface {
	GetSPF(string) (string, error)
}

Resolver looks up spf txt records associated with a FQDN.

type SPFPart

type SPFPart struct {
	Text          string
	IsLookup      bool
	IncludeRecord *SPFRecord
	IncludeDomain string
}

SPFPart stores a part of an SPF record, with attributes.

type SPFRecord

type SPFRecord struct {
	Parts []*SPFPart
}

SPFRecord stores the parts of an SPF record.

func Parse

func Parse(text string, dnsres Resolver) (*SPFRecord, error)

Parse parses a raw SPF record.

func (*SPFRecord) Flatten added in v0.2.2

func (s *SPFRecord) Flatten(spec string) *SPFRecord

Flatten optimizes s.

func (*SPFRecord) Lookups

func (s *SPFRecord) Lookups() int

Lookups returns the number of DNS lookups required by s.

func (*SPFRecord) Print added in v0.2.2

func (s *SPFRecord) Print() string

Print prints an SPFRecord.

func (*SPFRecord) TXT added in v0.2.2

func (s *SPFRecord) TXT() string

TXT outputs s as a TXT record.

func (*SPFRecord) TXTSplit added in v0.2.2

func (s *SPFRecord) TXTSplit(pattern string) map[string]string

TXTSplit returns a set of txt records to use for SPF. pattern given is used to name all chained spf records. patern should include %d, which will be replaced by a counter. should result in fqdn after replacement returned map will have keys with fqdn of resulting records. root record will be under key "@"

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL