From 895d5fea41177e444c18f4fdc820fffa5f67d5bf Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Sat, 9 Dec 2023 17:08:45 +0100 Subject: Add drafty skeleton --- pkg/monitor/errors.go | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 pkg/monitor/errors.go (limited to 'pkg/monitor/errors.go') diff --git a/pkg/monitor/errors.go b/pkg/monitor/errors.go new file mode 100644 index 0000000..4d676af --- /dev/null +++ b/pkg/monitor/errors.go @@ -0,0 +1,41 @@ +package monitor + +import ( + "fmt" + + ct "github.com/google/certificate-transparency-go" +) + +// ErrorFetch occurs if there's a problem hitting the log's HTTP API. An STH is +// provided if available, since it might carry evidence of some log misbehavior. +type ErrorFetch struct { + URL string + Msg string + Err error + STH *ct.SignedTreeHead +} + +func (e ErrorFetch) Error() string { + return fmt.Sprintf("%s: %s: %v", e.URL, e.Msg, e.Err) +} + +// ErrorMerkleTree occurs if the log's Merkle tree can't be verified. An STH is +// provided if available (i.e., won't be available for internal tree building). +type ErrorMerkleTree struct { + URL string + Msg string + Err error + STH *ct.SignedTreeHead +} + +func (e ErrorMerkleTree) Error() string { + return fmt.Sprintf("%s: %s: %v", e.URL, e.Msg, e.Err) +} + +// TODO: MMD violations +// TODO: Growing read-only logs + +// noout implements the Logger interface to discard unwanted output +type noout struct{} + +func (n *noout) Printf(string, ...interface{}) {} -- cgit v1.2.3