fingerprint

package
v0.5.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2016 License: MPL-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_AWS_URL = "http://169.254.169.254/latest/meta-data/"

This is where the AWS metadata server normally resides. We hardcode the "instance" path as well since it's the only one we access here.

View Source
const DEFAULT_GCE_URL = "http://169.254.169.254/computeMetadata/v1/instance/"

This is where the GCE metadata server normally resides. We hardcode the "instance" path as well since it's the only one we access here.

View Source
const (
	EmptyDuration = time.Duration(0)
)

EmptyDuration is to be used by fingerprinters that are not periodic.

Variables

This section is empty.

Functions

func BuiltinFingerprints

func BuiltinFingerprints() []string

BuiltinFingerprints is a slice containing the key names of all registered fingerprints available. The order of this slice should be preserved when fingerprinting.

func FindCgroupMountpointDir added in v0.3.0

func FindCgroupMountpointDir() (string, error)

FindCgroupMountpointDir is used to find the cgroup mount point on a Linux system.

Types

type ArchFingerprint

type ArchFingerprint struct {
	StaticFingerprinter
	// contains filtered or unexported fields
}

ArchFingerprint is used to fingerprint the architecture

func (*ArchFingerprint) Fingerprint

func (f *ArchFingerprint) Fingerprint(config *client.Config, node *structs.Node) (bool, error)

type CGroupFingerprint added in v0.3.0

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

func (*CGroupFingerprint) Fingerprint added in v0.3.0

func (f *CGroupFingerprint) Fingerprint(cfg *client.Config, node *structs.Node) (bool, error)

Fingerprint tries to find a valid cgroup moint point

func (*CGroupFingerprint) Periodic added in v0.3.0

func (f *CGroupFingerprint) Periodic() (bool, time.Duration)

Periodic determines the interval at which the periodic fingerprinter will run.

type CPUFingerprint

type CPUFingerprint struct {
	StaticFingerprinter
	// contains filtered or unexported fields
}

CPUFingerprint is used to fingerprint the CPU

func (*CPUFingerprint) Fingerprint

func (f *CPUFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error)

type ConsulFingerprint

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

ConsulFingerprint is used to fingerprint for Consul

func (*ConsulFingerprint) Fingerprint

func (f *ConsulFingerprint) Fingerprint(config *client.Config, node *structs.Node) (bool, error)

func (*ConsulFingerprint) Periodic added in v0.2.0

func (f *ConsulFingerprint) Periodic() (bool, time.Duration)

type DefaultMountPointDetector added in v0.3.0

type DefaultMountPointDetector struct {
}

Implements the interface detector which calls the cgroups library directly

func (*DefaultMountPointDetector) MountPoint added in v0.3.0

func (b *DefaultMountPointDetector) MountPoint() (string, error)

Call out to the default cgroup library

type DefaultNetworkInterfaceDetector added in v0.2.0

type DefaultNetworkInterfaceDetector struct {
}

Implements the interface detector which calls net directly

func (*DefaultNetworkInterfaceDetector) Addrs added in v0.2.0

func (*DefaultNetworkInterfaceDetector) InterfaceByName added in v0.2.0

func (b *DefaultNetworkInterfaceDetector) InterfaceByName(name string) (*net.Interface, error)

func (*DefaultNetworkInterfaceDetector) Interfaces added in v0.2.0

func (b *DefaultNetworkInterfaceDetector) Interfaces() ([]net.Interface, error)

type EnvAWSFingerprint

type EnvAWSFingerprint struct {
	StaticFingerprinter
	// contains filtered or unexported fields
}

EnvAWSFingerprint is used to fingerprint AWS metadata

func (*EnvAWSFingerprint) Fingerprint

func (f *EnvAWSFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error)

type EnvGCEFingerprint added in v0.2.0

type EnvGCEFingerprint struct {
	StaticFingerprinter
	// contains filtered or unexported fields
}

EnvGCEFingerprint is used to fingerprint GCE metadata

func (*EnvGCEFingerprint) Fingerprint added in v0.2.0

func (f *EnvGCEFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error)

func (*EnvGCEFingerprint) Get added in v0.2.0

func (f *EnvGCEFingerprint) Get(attribute string, recursive bool) (string, error)

type Factory

type Factory func(*log.Logger) Fingerprint

Factory is used to instantiate a new Fingerprint

type Fingerprint

type Fingerprint interface {
	// Fingerprint is used to update properties of the Node,
	// and returns if the fingerprint was applicable and a potential error.
	Fingerprint(*config.Config, *structs.Node) (bool, error)

	// Periodic is a mechanism for the fingerprinter to indicate that it should
	// be run periodically. The return value is a boolean indicating if it
	// should be periodic, and if true, a duration.
	Periodic() (bool, time.Duration)
}

Fingerprint is used for doing "fingerprinting" of the host to automatically determine attributes, resources, and metadata about it. Each of these is a heuristic, and many of them can be applied on a particular host.

func NewArchFingerprint

func NewArchFingerprint(logger *log.Logger) Fingerprint

NewArchFingerprint is used to create an OS fingerprint

func NewCGroupFingerprint added in v0.3.0

func NewCGroupFingerprint(logger *log.Logger) Fingerprint

NewCGroupFingerprint returns a new cgroup fingerprinter

func NewCPUFingerprint

func NewCPUFingerprint(logger *log.Logger) Fingerprint

NewCPUFingerprint is used to create a CPU fingerprint

func NewConsulFingerprint

func NewConsulFingerprint(logger *log.Logger) Fingerprint

NewConsulFingerprint is used to create a Consul fingerprint

func NewEnvAWSFingerprint

func NewEnvAWSFingerprint(logger *log.Logger) Fingerprint

NewEnvAWSFingerprint is used to create a fingerprint from AWS metadata

func NewEnvGCEFingerprint added in v0.2.0

func NewEnvGCEFingerprint(logger *log.Logger) Fingerprint

NewEnvGCEFingerprint is used to create a fingerprint from GCE metadata

func NewFingerprint

func NewFingerprint(name string, logger *log.Logger) (Fingerprint, error)

NewFingerprint is used to instantiate and return a new fingerprint given the name and a logger

func NewHostFingerprint

func NewHostFingerprint(logger *log.Logger) Fingerprint

NewHostFingerprint is used to create a Host fingerprint

func NewMemoryFingerprint

func NewMemoryFingerprint(logger *log.Logger) Fingerprint

NewMemoryFingerprint is used to create a Memory fingerprint

func NewNetworkFingerprint added in v0.3.2

func NewNetworkFingerprint(logger *log.Logger) Fingerprint

NewNetworkFingerprint returns a new NetworkFingerprinter with the given logger

func NewNomadFingerprint added in v0.3.2

func NewNomadFingerprint(logger *log.Logger) Fingerprint

NewNomadFingerprint is used to create a Nomad fingerprint

func NewSignalFingerprint added in v0.5.0

func NewSignalFingerprint(logger *log.Logger) Fingerprint

NewSignalFingerprint is used to create a Signal fingerprint

func NewStorageFingerprint

func NewStorageFingerprint(logger *log.Logger) Fingerprint

func NewVaultFingerprint added in v0.5.0

func NewVaultFingerprint(logger *log.Logger) Fingerprint

NewVaultFingerprint is used to create a Vault fingerprint

type GCEMetadataNetworkInterface added in v0.2.0

type GCEMetadataNetworkInterface struct {
	AccessConfigs []struct {
		ExternalIp string
		Type       string
	}
	ForwardedIps []string
	Ip           string
	Network      string
}

type HostFingerprint

type HostFingerprint struct {
	StaticFingerprinter
	// contains filtered or unexported fields
}

HostFingerprint is used to fingerprint the host

func (*HostFingerprint) Fingerprint

func (f *HostFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error)

type MemoryFingerprint

type MemoryFingerprint struct {
	StaticFingerprinter
	// contains filtered or unexported fields
}

MemoryFingerprint is used to fingerprint the available memory on the node

func (*MemoryFingerprint) Fingerprint

func (f *MemoryFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error)

type MountPointDetector added in v0.3.0

type MountPointDetector interface {
	MountPoint() (string, error)
}

An interface to isolate calls to the cgroup library This facilitates testing where we can implement fake mount points to test various code paths

type NetworkFingerprint

type NetworkFingerprint struct {
	StaticFingerprinter
	// contains filtered or unexported fields
}

NetworkFingerprint is used to fingerprint the Network capabilities of a node

func (*NetworkFingerprint) Fingerprint

func (f *NetworkFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error)

type NetworkInterfaceDetector added in v0.2.0

type NetworkInterfaceDetector interface {
	Interfaces() ([]net.Interface, error)
	InterfaceByName(name string) (*net.Interface, error)
	Addrs(intf *net.Interface) ([]net.Addr, error)
}

An interface to isolate calls to various api in net package This facilitates testing where we can implement fake interfaces and addresses to test varios code paths

type NomadFingerprint added in v0.3.2

type NomadFingerprint struct {
	StaticFingerprinter
	// contains filtered or unexported fields
}

NomadFingerprint is used to fingerprint the Nomad version

func (*NomadFingerprint) Fingerprint added in v0.3.2

func (f *NomadFingerprint) Fingerprint(config *client.Config, node *structs.Node) (bool, error)

type ReqError added in v0.2.0

type ReqError struct {
	StatusCode int
}

func (ReqError) Error added in v0.2.0

func (e ReqError) Error() string

type SignalFingerprint added in v0.5.0

type SignalFingerprint struct {
	StaticFingerprinter
	// contains filtered or unexported fields
}

SignalFingerprint is used to fingerprint the available signals

func (*SignalFingerprint) Fingerprint added in v0.5.0

func (f *SignalFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error)

type StaticFingerprinter added in v0.2.0

type StaticFingerprinter struct{}

StaticFingerprinter can be embedded in a struct that has a Fingerprint method to make it non-periodic.

func (*StaticFingerprinter) Periodic added in v0.2.0

func (s *StaticFingerprinter) Periodic() (bool, time.Duration)

type StorageFingerprint

type StorageFingerprint struct {
	StaticFingerprinter
	// contains filtered or unexported fields
}

StorageFingerprint is used to measure the amount of storage free for applications that the Nomad agent will run on this machine.

func (*StorageFingerprint) Fingerprint

func (f *StorageFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error)

type VaultFingerprint added in v0.5.0

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

VaultFingerprint is used to fingerprint for Vault

func (*VaultFingerprint) Fingerprint added in v0.5.0

func (f *VaultFingerprint) Fingerprint(config *client.Config, node *structs.Node) (bool, error)

func (*VaultFingerprint) Periodic added in v0.5.0

func (f *VaultFingerprint) Periodic() (bool, time.Duration)

Jump to

Keyboard shortcuts

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