monitor

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: Apache-2.0 Imports: 22 Imported by: 2

Documentation

Overview

Package monitor implements the monitor service. A monitor repeatedly polls a key-transparency server's Mutations API and signs Map Roots if it could reconstruct clients can query.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInconsistentProofs occurs when the server returned different hashes
	// for the same inclusion proof node in the tree.
	ErrInconsistentProofs = errors.New("inconsistent inclusion proofs")
	// ErrInvalidLogConsistencyProof occurs when the log consistency proof does
	// not verify.
	ErrInvalidLogConsistencyProof = errors.New("invalid log consistency proof")
	// ErrInvalidLogInclusion occurs if the inclusion proof for the signed map
	// root into the log does not verify.
	ErrInvalidLogInclusion = errors.New("invalid log inclusion proof")
	// ErrInvalidLogSignature occurs if the log roots signature does not verify.
	ErrInvalidLogSignature = errors.New("invalid signature on log root")
	// ErrInvalidMapSignature occurs if the map roots signature does not verify.
	ErrInvalidMapSignature = errors.New("invalid signature on map root")
	// ErrInvalidMutation occurs when verification failed because of an invalid
	// mutation.
	ErrInvalidMutation = errors.New("invalid mutation")
	// ErrNotMatchingMapRoot occurs when the reconstructed root differs from the
	// one we received from the server.
	ErrNotMatchingMapRoot = errors.New("recreated root does not match")
)

Functions

func RevisionPairs

func RevisionPairs(ctx context.Context, revisions <-chan *types.MapRootV1, pairs chan<- RevisionPair) error

RevisionPairs consumes revisions (0, 1, 2) and produces pairs (0,1), (1,2).

Types

type ErrList

type ErrList []error

ErrList is a list of errors.

func (*ErrList) AppendStatus

func (e *ErrList) AppendStatus(s *status.Status, err error)

AppendStatus adds a status errord, or the error about adding the status if the latter is not nil.

func (*ErrList) Proto

func (e *ErrList) Proto() []*statuspb.Status

Proto converts all the errors to statuspb.Status. If the original error was not a status.Status, we use codes.Unknown.

type Monitor

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

Monitor holds the internal state for a monitor accessing the mutations API and for verifying its responses.

func New

func New(cli *client.Client,
	mapVerifier *tclient.MapVerifier,
	signer *tcrypto.Signer,
	store monitorstorage.Interface) (*Monitor, error)

New creates a new instance of the monitor.

func NewFromDirectory

func NewFromDirectory(cli pb.KeyTransparencyClient,
	config *pb.Directory,
	signer *tcrypto.Signer,
	store monitorstorage.Interface) (*Monitor, error)

NewFromDirectory produces a new monitor from a Directory object.

func (*Monitor) ProcessLoop

func (m *Monitor) ProcessLoop(ctx context.Context, startRev int64) error

ProcessLoop continuously fetches mutations and processes them.

type RevisionPair

type RevisionPair struct {
	A, B *types.MapRootV1
}

RevisionPair is two adjacent revisions.

Notes

Bugs

  • Proto serializations are not idempotent. - Upgrade the hasher to use ObjectHash. - Use deep compare between the tree and the computed value.

Jump to

Keyboard shortcuts

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