policy

package
v0.0.0-...-2d6eab0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

type List struct {
	Timestamp     time.Time            `json:"timestamp"`
	Expires       time.Time            `json:"expires"`
	Version       string               `json:"version"`
	Author        string               `json:"author"`
	PolicyAliases map[string]TLSPolicy `json:"policy-aliases"`
	Policies      map[string]TLSPolicy `json:"policies"`
}

List is a raw representation of the policy list.

func (*List) Add

func (l *List) Add(domain string, policy TLSPolicy)

Add adds a particular domain's policy to the list.

type TLSPolicy

type TLSPolicy struct {
	PolicyAlias string   `json:"policy-alias,omitempty"`
	Mode        string   `json:"mode,omitempty"`
	MXs         []string `json:"mxs,omitempty"`
}

TLSPolicy dictates the policy for a particular email domain.

type UpdatedList

type UpdatedList struct {
	*List
	// contains filtered or unexported fields
}

UpdatedList wraps a list that is updated from a remote policyURL every hour. Safe for concurrent calls to `Get`.

func MakeUpdatedList

func MakeUpdatedList() *UpdatedList

MakeUpdatedList wraps makeUpdatedList to use FetchListHTTP by default to update policy list

func (*UpdatedList) DomainsToValidate

func (l *UpdatedList) DomainsToValidate() ([]string, error)

DomainsToValidate [interface Validator] retrieves domains from the DB whose policies should be validated.

func (*UpdatedList) Get

func (l *UpdatedList) Get(domain string) (TLSPolicy, error)

Get safely reads from the underlying policy list and returns a TLSPolicy for a domain

func (*UpdatedList) HasDomain

func (l *UpdatedList) HasDomain(domain string) bool

HasDomain returns true if a domain is present on the policy list.

func (*UpdatedList) HostnamesForDomain

func (l *UpdatedList) HostnamesForDomain(domain string) ([]string, error)

HostnamesForDomain [interface Validator] retrieves the hostname policy for a particular domain.

func (*UpdatedList) Raw

func (l *UpdatedList) Raw() List

Raw returns a raw List struct, copied from the underlying one

Jump to

Keyboard shortcuts

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