config

package
v0.0.0-...-4a05471 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package config provides runtime configuration for the Alice Looking Glass.

This configuration is read from a config file.

Index

Constants

View Source
const (
	// SourceTypeBird is used for either bird 1x and 2x
	// based route servers with a birdwatcher backend.
	SourceTypeBird = "bird"

	// SourceTypeGoBGP indicates a GoBGP based source.
	SourceTypeGoBGP = "gobgp"

	// SourceTypeOpenBGPD is used for an OpenBGPD source.
	SourceTypeOpenBGPD = "openbgpd"
)
View Source
const (
	// SourceBackendBirdwatcher is used to indicate that
	// the source is using a birdwatcher interface.
	SourceBackendBirdwatcher = "birdwatcher"

	// SourceBackendGoBGP is used when the source is consuming
	// a GoBGP daemon via grpc API.
	SourceBackendGoBGP = "gobgp"

	// SourceBackendOpenBGPDStateServer is used when the openbgpd
	// is exported using the openbgpd-state-server.
	SourceBackendOpenBGPDStateServer = "openbgpd-state-server"

	// SourceBackendOpenBGPDBgplgd is used when the openbgpd
	// state is exported through the bgplgd.
	SourceBackendOpenBGPDBgplgd = "openbgpd-bgplgd"
)
View Source
const (
	// DefaultHTTPTimeout is the time in seconds after which the
	// server will timeout.
	DefaultHTTPTimeout = 120

	// DefaultPrefixLookupCommunityFilterCutoff is the number of
	// routes after which the community filter will not be
	// available.
	DefaultPrefixLookupCommunityFilterCutoff = 100000

	// DefaultRoutesStoreQueryLimit is the default limit for
	// prefixes returned from the store.
	DefaultRoutesStoreQueryLimit = 200000
)

Variables

View Source
var (
	// ErrSourceTypeUnknown will be used if the type could
	// not be identified from the section.
	ErrSourceTypeUnknown = errors.New("source type unknown")

	// ErrPostgresUnconfigured will occure when the
	// postgres database URL is required, but missing.
	ErrPostgresUnconfigured = errors.New(
		"the selected postgres backend requires configuration")
)
View Source
var Build = "unknown"

Build is the current revision pointing at HEAD

View Source
var Version = "unknown"

Version Alice (set during the build)

Functions

func ErrInvalidCommunity

func ErrInvalidCommunity(s string) error

ErrInvalidCommunity creates an invalid community error

Types

type Config

type Config struct {
	Server       ServerConfig
	Postgres     *PostgresConfig
	Housekeeping HousekeepingConfig
	UI           UIConfig
	Sources      []*SourceConfig
	File         string
}

Config is the application configuration

func LoadConfig

func LoadConfig(file string) (*Config, error)

LoadConfig reads a configuration from a file.

func (*Config) SourceByID

func (cfg *Config) SourceByID(id string) *SourceConfig

SourceByID returns a source from the config by id

func (*Config) SourceInstanceByID

func (cfg *Config) SourceInstanceByID(id string) sources.Source

SourceInstanceByID returns an instance by id

type ExpandMap

type ExpandMap map[string]string

ExpandMap holds the current state of variables

func (ExpandMap) AddExpr

func (e ExpandMap) AddExpr(expr string) error

AddExpr inserts a new variable to the map. Key and value are expanded.

func (ExpandMap) Expand

func (e ExpandMap) Expand(s string) ([]string, error)

Expand variables by recursive substitution and expansion

type HousekeepingConfig

type HousekeepingConfig struct {
	Interval           int  `ini:"interval"`
	ForceReleaseMemory bool `ini:"force_release_memory"`
}

HousekeepingConfig describes the housekeeping interval and flags.

type NoexportsConfig

type NoexportsConfig struct {
	Reasons      api.BGPCommunityMap
	LoadOnDemand bool `ini:"load_on_demand"`
}

NoexportsConfig holds no-export reasons associated with BGP communities and behaviour tweaks.

type PaginationConfig

type PaginationConfig struct {
	RoutesFilteredPageSize    int `ini:"routes_filtered_page_size"`
	RoutesAcceptedPageSize    int `ini:"routes_accepted_page_size"`
	RoutesNotExportedPageSize int `ini:"routes_not_exported_page_size"`
}

PaginationConfig holds settings for route pagination

type PostgresConfig

type PostgresConfig struct {
	URL      string `ini:"url"`
	MaxConns int32  `ini:"max_connections"`
	MinConns int32  `ini:"min_connections"`
}

PostgresConfig is the configuration for the database connection when the postgres backend is used.

type RejectCandidatesConfig

type RejectCandidatesConfig struct {
	Communities api.BGPCommunityMap
}

RejectCandidatesConfig holds reasons for rejection candidates (e.g. routes that will be dropped if a hard filtering would be applied.)

type RejectionsConfig

type RejectionsConfig struct {
	Reasons api.BGPCommunityMap
}

RejectionsConfig holds rejection reasons associated with BGP communities

type RpkiConfig

type RpkiConfig struct {
	// Define communities
	Enabled    bool       `ini:"enabled"`
	Valid      [][]string `ini:"valid"`
	Unknown    [][]string `ini:"unknown"`
	NotChecked [][]string `ini:"not_checked"`
	Invalid    [][]string `ini:"invalid"`
}

RpkiConfig defines BGP communities describing the RPKI validation state.

type ServerConfig

type ServerConfig struct {
	Listen                            string `ini:"listen_http"`
	HTTPTimeout                       int    `ini:"http_timeout"`
	EnablePrefixLookup                bool   `ini:"enable_prefix_lookup"`
	PrefixLookupCommunityFilterCutoff int    `ini:"prefix_lookup_community_filter_cutoff"`
	NeighborsStoreRefreshInterval     int    `ini:"neighbors_store_refresh_interval"`
	NeighborsStoreRefreshParallelism  int    `ini:"neighbors_store_refresh_parallelism"`
	RoutesStoreRefreshInterval        int    `ini:"routes_store_refresh_interval"`
	RoutesStoreRefreshParallelism     int    `ini:"routes_store_refresh_parallelism"`
	RoutesStoreQueryLimit             uint   `ini:"routes_store_query_limit"`
	StoreBackend                      string `ini:"store_backend"`
	DefaultAsn                        int    `ini:"asn"`
	EnableNeighborsStatusRefresh      bool   `ini:"enable_neighbors_status_refresh"`
	StreamParserThrottle              int    `ini:"stream_parser_throttle"`
}

A ServerConfig holds the runtime configuration for the backend.

type SourceConfig

type SourceConfig struct {
	ID    string
	Order int
	Name  string
	Group string

	// Blackhole IPs
	Blackholes []string

	// Source configurations
	Type        string
	Backend     string
	Birdwatcher birdwatcher.Config
	GoBGP       gobgp.Config
	OpenBGPD    openbgpd.Config
	// contains filtered or unexported fields
}

A SourceConfig is a generic source configuration

func (*SourceConfig) GetInstance

func (cfg *SourceConfig) GetInstance() sources.Source

GetInstance gets a source instance from config

type ThemeConfig

type ThemeConfig struct {
	Path     string `ini:"path"`
	BasePath string `ini:"url_base"` // Optional, default: /theme
}

ThemeConfig describes a theme configuration

type UIConfig

type UIConfig struct {
	RoutesColumns      map[string]string
	RoutesColumnsOrder []string

	NeighborsColumns      map[string]string
	NeighborsColumnsOrder []string

	LookupColumns      map[string]string
	LookupColumnsOrder []string

	RoutesRejections       RejectionsConfig
	RoutesNoexports        NoexportsConfig
	RoutesRejectCandidates RejectCandidatesConfig

	BGPCommunities          api.BGPCommunityMap
	BGPBlackholeCommunities api.BGPCommunitiesSet
	Rpki                    RpkiConfig

	Theme ThemeConfig

	Pagination PaginationConfig
}

UIConfig holds runtime settings for the web client

Jump to

Keyboard shortcuts

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