config

package
v0.0.0-...-891f3ce Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2019 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package config defines the constants and functions necessary to parse configuration files for bgpmon

Index

Constants

View Source
const (
	CochroachSession = sessionType(iota)
	PostgresSession
)

These are the session types currently supported

View Source
const (
	// DefaultRPCTimeoutSecs is the maximum lifetime for an RPC call defaults to 4 minutes
	DefaultRPCTimeoutSecs = 240
	// DefaultRPCAddress is the default address:port for the RPC server
	DefaultRPCAddress = ":12289"
	// DefaultDBTimeoutSecs is the maximum lifetime for a DB operation defaults to 4 minutes
	DefaultDBTimeoutSecs = 240
	// DefaultSuggestedNodeFile is the file created by PutConfiguredNodes
	DefaultSuggestedNodeFile = "suggested_nodes.toml"
)

Variables

This section is empty.

Functions

func PutConfiguredNodes

func PutConfiguredNodes(a map[string]NodeConfig) error

PutConfiguredNodes writes a node configuration in the TOML format to w

func SumNodeConfs

func SumNodeConfs(confnodes, dbnodes map[string]NodeConfig) map[string]NodeConfig

SumNodeConfs combines two maps of NodeConfigs, preferring the first in case of overlap

Types

type Configer

type Configer interface {
	GetSessionConfigs() []SessionConfiger
	GetSessionConfigWithName(string) (SessionConfiger, error)
	GetConfiguredNodes() map[string]NodeConfig
	GetModules() []ModuleConfig
}

Configer describes the configuration for a bgpmond server

func NewConfig

func NewConfig(creader io.Reader) (Configer, error)

NewConfig reads a TOML file with the bgpmon configuration, sanity checks it and returns a bgpmondConfig struct which should satisfy the Configer interface, or an error

type EntityConfig

type EntityConfig struct {
	Name          string
	Email         string
	OwnedOrigins  []int
	OwnedPrefixes []string
}

EntityConfig contains an entity that was specified in a configuration file.

func NewEntityConfigFromJSONFile

func NewEntityConfigFromJSONFile(fName string) (*EntityConfig, error)

NewEntityConfigFromJSONFile populates an entity config specified in the provided JSON file.

type ModuleConfig

type ModuleConfig struct {
	Type string

	Args string
	// contains filtered or unexported fields
}

ModuleConfig describes a module configuration

func (ModuleConfig) GetArgs

func (m ModuleConfig) GetArgs() map[string]string

GetArgs returns the arguments passed to the module

func (ModuleConfig) GetID

func (m ModuleConfig) GetID() string

GetID returns the ID of the module, specified as the map key

func (ModuleConfig) GetType

func (m ModuleConfig) GetType() string

GetType returns the type of a module in the config

type NodeConfig

type NodeConfig struct {
	IP                  string
	Name                string
	IsCollector         bool
	DumpDurationMinutes int
	Description         string
	Coords              string
	Location            string
}

NodeConfig describes a BGP node, either a collector or a peer.

type SessionConfiger

type SessionConfiger interface {
	Configer
	GetHostNames() []string
	GetName() string
	GetDatabaseName() string
	GetTypeName() string
	GetUser() string
	GetPassword() string
	GetCertDir() string
	GetWorkerCt() int
	GetDBTimeoutSecs() int
}

SessionConfiger describes the configuration for a bgpmond session

Jump to

Keyboard shortcuts

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