spflib

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2017 License: MIT Imports: 8 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)

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)

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
}

type SPFRecord

type SPFRecord struct {
	Parts []*SPFPart
}

func Parse

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

func (*SPFRecord) Flatten added in v0.2.2

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

func (*SPFRecord) Lookups

func (s *SPFRecord) Lookups() int

func (*SPFRecord) Print added in v0.2.2

func (rec *SPFRecord) Print() string

func (*SPFRecord) TXT added in v0.2.2

func (s *SPFRecord) TXT() string

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