hitlist

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 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) AddDeadline added in v0.0.9

func (hl *HitList) AddDeadline(parts types.EmailParts, vr validator.Result, duration time.Duration) error

AddDeadline is similar to Add, but allows for custom TTL. Duration shouldn't be negative.

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) AddInternalParts

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

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

func (*HitList) AddInternalPartsDuration added in v0.0.9

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

AddInternalPartsDuration adds values considered "safe". Has an extra duration option which shouldn't be negative

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) GetDomainValidationDetails added in v0.0.9

func (hl *HitList) GetDomainValidationDetails(d Domain) (validator.Details, 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

Jump to

Keyboard shortcuts

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