Documentation ¶
Overview ¶
Package config provides runtime configuration for the Alice Looking Glass.
This configuration is read from a config file.
Index ¶
- Constants
- Variables
- func ErrInvalidCommunity(s string) error
- type Config
- type ExpandMap
- type HousekeepingConfig
- type NoexportsConfig
- type PaginationConfig
- type PostgresConfig
- type RejectCandidatesConfig
- type RejectionsConfig
- type RpkiConfig
- type ServerConfig
- type SourceConfig
- type ThemeConfig
- type UIConfig
Constants ¶
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" )
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" )
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 ¶
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") )
var Build = "unknown"
Build is the current revision pointing at HEAD
var Version = "unknown"
Version Alice (set during the build)
Functions ¶
func ErrInvalidCommunity ¶
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 ¶
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
type ExpandMap ¶
ExpandMap holds the current state of variables
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