surveillee

package
v0.0.0-...-18d8c9a Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: MPL-2.0 Imports: 15 Imported by: 0

README

surveillee

GoDoc

Documentation

Overview

Package surveillee manages the configuration of various entities being monitored by watches and the functions used to query them for data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	CheckForUpstreamChanges(fields ...string) (bool, bool) // returns hasChanged, isHealthy
}

Backend is an interface which all surveillee entities must implement

type FileWatcher

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

FileWatcher wraps the surveillee backend for checking changes in watched files and tracks their the md5 checksums.

func NewFileWatcher

func NewFileWatcher() *FileWatcher

NewFileWatcher returns a new FileWatcher.

func (*FileWatcher) CheckForUpstreamChanges

func (w *FileWatcher) CheckForUpstreamChanges(fields ...string) (hasChanged, isHealthy bool)

CheckForUpstreamChanges computes md5sum of a file and checks whether there has been a change since the last check.

type Services

type Services struct {
	Discovery     Backend
	FileWatcher   Backend
	SecretStorage Backend
}

Services is a structure which contains all known entities that can be monitored for changes.

func NewServices

func NewServices(discovery Backend, fileWatcher Backend, secretStorage Backend) *Services

NewServices returns a new Services structure.

type TestServer

type TestServer struct {
	HTTPAddr   string
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

TestServer represents a Vault server we can run our tests against. Depends on a local `vault` binary installed into our environ's PATH.

func NewTestServer

func NewTestServer(httpPort int) (*TestServer, error)

NewTestServer constructs a new TestServer by including the httpPort as well.

func (*TestServer) Stop

func (s *TestServer) Stop() error

Stop stops a TestServer

func (*TestServer) WaitForAPI

func (s *TestServer) WaitForAPI() error

WaitForAPI waits for only the agent HTTP endpoint to start responding. This is an indication that the agent has started, but will likely return before a leader is elected.

type Vault

type Vault struct {
	*api.Client
	// contains filtered or unexported fields
}

Vault wraps the secrets storage backend for the Hashicorp Vault client and tracks the state of all watched dependencies.

func NewVault

func NewVault(config interface{}) (*Vault, error)

NewVault creates a new secrets storage backend for Vault

func (*Vault) CheckForUpstreamChanges

func (v *Vault) CheckForUpstreamChanges(fields ...string) (hasChanged, isHealthy bool)

CheckForUpstreamChanges requests the set of healthy instances of a service from Consul and checks whether there has been a change since the last check.

type VaultConfig

type VaultConfig struct {
	Address string         `mapstructure:"address"`
	Scheme  string         `mapstructure:"scheme"`
	Token   string         `mapstructure:"token"`
	TLS     VaultTLSConfig `mapstructure:"tls"` // optional TLS settings
}

VaultConfig is used to configure the creation of the Hashicorp Vault client.

type VaultTLSConfig

type VaultTLSConfig struct {
	HTTPCACert        string `mapstructure:"cafile"`
	HTTPCAPath        string `mapstructure:"capath"`
	HTTPClientCert    string `mapstructure:"clientcert"`
	HTTPClientKey     string `mapstructure:"clientkey"`
	HTTPTLSServerName string `mapstructure:"servername"`
	HTTPSSLVerify     bool   `mapstructure:"verify"`
}

VaultTLSConfig is optional TLS settings for VaultConfig.

Jump to

Keyboard shortcuts

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