loglist

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MPL-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	LogTypeProd = "prod"
	LogTypeTest = "test"
)

Variables

View Source
var ErrNotModified = errors.New("loglist has not been modified")
View Source
var UserAgent = "certspotter"

Functions

func FetchIfModified added in v0.15.0

func FetchIfModified(ctx context.Context, url string, token *ModificationToken) (*List, *ModificationToken, error)

func LoadIfModified added in v0.15.0

func LoadIfModified(ctx context.Context, urlOrFile string, token *ModificationToken) (*List, *ModificationToken, error)

Types

type List

type List struct {
	Version          string     `json:"version"`
	LogListTimestamp time.Time  `json:"log_list_timestamp"` // Only present in v3 of schema
	Operators        []Operator `json:"operators"`
}

func Fetch

func Fetch(ctx context.Context, url string) (*List, error)

func Load

func Load(ctx context.Context, urlOrFile string) (*List, error)

func ReadFile

func ReadFile(filename string) (*List, error)

func Unmarshal

func Unmarshal(jsonBytes []byte) (*List, error)

func (*List) AllLogs

func (list *List) AllLogs() []*Log

func (*List) Validate

func (list *List) Validate() error

type Log

type Log struct {
	Key              []byte        `json:"key"`
	LogID            ct.SHA256Hash `json:"log_id"`
	MMD              int           `json:"mmd"`
	URL              string        `json:"url"`
	Description      string        `json:"description"`
	State            State         `json:"state"`
	DNS              string        `json:"dns"`
	LogType          LogType       `json:"log_type"`
	TemporalInterval *struct {
		StartInclusive time.Time `json:"start_inclusive"`
		EndExclusive   time.Time `json:"end_exclusive"`
	} `json:"temporal_interval"`
}

func (*Log) AcceptsExpiration

func (log *Log) AcceptsExpiration(expiration time.Time) bool

func (*Log) LogIDString

func (log *Log) LogIDString() string

func (*Log) Validate

func (log *Log) Validate() error

type LogType

type LogType string

type ModificationToken added in v0.15.0

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

type Operator

type Operator struct {
	Name  string   `json:"name"`
	Email []string `json:"email"`
	Logs  []Log    `json:"logs"`
}

func (*Operator) Validate

func (operator *Operator) Validate() error

type State

type State struct {
	Pending *struct {
		Timestamp time.Time `json:"timestamp"`
	} `json:"pending"`

	Qualified *struct {
		Timestamp time.Time `json:"timestamp"`
	} `json:"qualified"`

	Usable *struct {
		Timestamp time.Time `json:"timestamp"`
	} `json:"usable"`

	Readonly *struct {
		Timestamp     time.Time `json:"timestamp"`
		FinalTreeHead struct {
			TreeSize       int64  `json:"tree_size"`
			SHA256RootHash []byte `json:"sha256_root_hash"`
		} `json:"final_tree_head"`
	} `json:"readonly"`

	Retired *struct {
		Timestamp time.Time `json:"timestamp"`
	} `json:"retired"`

	Rejected *struct {
		Timestamp time.Time `json:"timestamp"`
	} `json:"rejected"`
}

func (*State) IsApproved

func (state *State) IsApproved() bool

func (*State) WasApprovedAt

func (state *State) WasApprovedAt(t time.Time) bool

Jump to

Keyboard shortcuts

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