hitlist

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidDomainSyntax = errors.New("invalid domain syntax")
	ErrInvalidSyntax       = errors.New("invalid syntax")
)

Functions

This section is empty.

Types

type Domain

type Domain string

type Hit

type Hit struct {
	Recipients       map[rcpt]struct{}
	ValidUntil       time.Time
	ValidationResult validator.Result
}

type HitList

type HitList struct {
	// contains filtered or unexported fields
}

func New

func New(h hash.Hash, ttl time.Duration) *HitList

func (*HitList) Add

func (hl *HitList) Add(parts types.EmailParts, vr validator.Result) error

func (*HitList) AddDomain

func (hl *HitList) AddDomain(d string, vr validator.Result) error

AddDomain learns of a domain and it's validity.

func (*HitList) AddEmailAddress

func (hl *HitList) AddEmailAddress(email string, vr validator.Result) error

AddEmailAddress records validations for a particular e-mail address.

func (*HitList) AddEmailAddressDeadline

func (hl *HitList) AddEmailAddressDeadline(email string, vr validator.Result, duration time.Duration) error

AddEmailAddressDeadline Same as AddEmailAddress, but allows for custom TTL. Duration shouldn't be negative.

func (*HitList) AddInternalParts

func (hl *HitList) AddInternalParts(domain Domain, recipient Recipient, vr validator.Result, duration time.Duration) error

AddInternalParts adds values considered "safe". Typically you would only use this on provisioning HitList from a storage layer

func (*HitList) CreateInternalTypes

func (hl *HitList) CreateInternalTypes(p types.EmailParts) (domain Domain, recipient Recipient, err error)

CreateInternalTypes returns the Recipient and Domain types for an Email Type Parts. It's stateless, and solely works on the input. The input is not allowed to have empty parts. Typical use-case is when wanting to persist the "safe" value, to later re-add to a HitList

func (*HitList) GetDomainValidationResult

func (hl *HitList) GetDomainValidationResult(d Domain) (validator.Result, bool)

func (*HitList) GetRecipientCount

func (hl *HitList) GetRecipientCount(d Domain) (amount uint64)

GetRecipientCount returns the amount of recipients known for a domain

func (*HitList) GetValidAndUsageSortedDomains

func (hl *HitList) GetValidAndUsageSortedDomains() []string

GetValidAndUsageSortedDomains returns the used domains, sorted by their associated recipients (high>low)

func (*HitList) Has

func (hl *HitList) Has(parts types.EmailParts) (domain, local bool)

Has returns true if HitList knows about (part of) the argument

type Hits

type Hits map[Domain]Hit

type Recipient

type Recipient []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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