omniwitness

package
v0.0.0-...-d1f79e0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 28 Imported by: 1

Documentation

Overview

Package omniwitness provides a single Main file that runs the omniwitness. Some components are left pluggable so this can be deployed on different runtimes.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConfigLogs is the config for the witness used in the omniwitness.
	// Its schema is LogConfig
	//go:embed logs.yaml
	ConfigLogs []byte
)

Functions

func Main

func Main(ctx context.Context, operatorConfig OperatorConfig, p LogStatePersistence, httpListener net.Listener, httpClient *http.Client) error

Main runs the omniwitness, with the witness listening using the listener, and all outbound HTTP calls using the client provided.

Types

type Feeder

type Feeder uint8

Feeder is an enum of the known feeder types.

const (
	Serverless Feeder = iota + 1
	SumDB
	Pixel
	Rekor
)

func ParseFeeder

func ParseFeeder(f string) (Feeder, error)

ParseFeeder takes a string and returns a valid enum or an error.

func (Feeder) FeedFunc

func (f Feeder) FeedFunc() logFeeder

func (*Feeder) UnmarshalYAML

func (f *Feeder) UnmarshalYAML(unmarshal func(interface{}) error) (err error)

UnmarshalYAML populates the log from yaml using the unmarshal func provided.

type LogConfig

type LogConfig struct {
	Logs []LogInfo `yaml:"Logs"`
}

LogConfig contains a list of LogInfo (configuration options for a log).

func (LogConfig) AsLogMap

func (config LogConfig) AsLogMap() (map[string]witness.LogInfo, error)

AsLogMap loads the log configuration information into a map, keyed by log ID.

type LogInfo

type LogInfo struct {
	Origin     string `yaml:"Origin"`
	PublicKey  string `yaml:"PublicKey"`
	URL        string `yaml:"URL"`
	Feeder     Feeder `yaml:"Feeder"`
	UseCompact bool   `yaml:"UseCompact"`
}

LogInfo contains the details about a log.

type LogStatePersistence

type LogStatePersistence = persistence.LogStatePersistence

LogStatePersistence describes functionality the omniwitness requires in order to persist its view of log state.

type LogStateReadOps

type LogStateReadOps = persistence.LogStateReadOps

LogStateReadOps provides read-only operations on the stored state for a given log.

type LogStateWriteOps

type LogStateWriteOps = persistence.LogStateWriteOps

LogStateWriteOps provides write operations on the stored state for a given log.

type OperatorConfig

type OperatorConfig struct {
	WitnessKey string

	// RestDistributorBaseURL is optional, and if provided gives the base URL
	// to a distributor that takes witnessed checkpoints via a PUT request.
	// TODO(mhutchinson): This should be baked into the code when there is a public distributor.
	RestDistributorBaseURL string

	FeedInterval       time.Duration
	DistributeInterval time.Duration
}

OperatorConfig allows the bare minimum operator-specific configuration. This should only contain configuration details that are custom per-operator.

Jump to

Keyboard shortcuts

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