spf

package module
v0.0.0-...-81a2351 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2016 License: Apache-2.0 Imports: 4 Imported by: 1

README

Borrowed and refactored from daniellockard/gospfquery, to remove log.Fatal calls and make it more library-ish.

As explained in daniellockard's original Readme:

This does not implement REDIRECT, PTR, or EXISTS. The checking for the "ALL" record is very rough. It also turns all IPv6 records that lack a hostmask into a /128, because I don't know anything about IPv6 addresses. It turns IP4: records without a hostmask into a /32.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoSPFRecords when no TXT/SPF records are found or parsed.
	ErrNoSPFRecords = errors.New("No SPF Records found.")
)

Functions

func DumpCache

func DumpCache()

DumpCache dumps the cache from the built-in SPF Checker.

func GetDomainFromEmail

func GetDomainFromEmail(email string) (string, error)

GetDomainFromEmail returns the domain name from an email address. It is somewhat naive at present.

func NewSPFChecker

func NewSPFChecker() *spfChecker

NewSPFChecker returns a SPF looker-upper with an internal cache. You should probably use the library's instance through the top-level functions.

func Validate

func Validate(ip, domain string) (bool, error)

Validate returns whether emails from a domain can be sent from a given IP. This is the intended main entry point to this library. If you have an email address, then use GetDomainFromEmail to get the domain. Results from Validate are simply cached in RAM; extended and heavy use may create a memory leak. If this is a problem, simply call the top-level DumpCache function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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