Documentation ¶
Index ¶
- Variables
- func ExpireCache() int
- func GetCacheKey(fname string, fargs ...interface{}) string
- func InitializeCache()
- func InstallRateLimitReset()
- func IsSpecial(ret Parsed) bool
- func Run(args string) (io.Reader, error)
- type BirdConfig
- type Cache
- type CacheConfig
- type MemoryCache
- type Parsed
- func PipeRoutesFiltered(useCache bool, pipe string, table string) (Parsed, bool)
- func PipeRoutesFilteredCount(useCache bool, pipe string, table string, neighborAddress string) (Parsed, bool)
- func Protocols(useCache bool) (Parsed, bool)
- func ProtocolsBgp(useCache bool) (Parsed, bool)
- func ProtocolsShort(useCache bool) (Parsed, bool)
- func RoutesExport(useCache bool, protocol string) (Parsed, bool)
- func RoutesExportCount(useCache bool, protocol string) (Parsed, bool)
- func RoutesFiltered(useCache bool, protocol string) (Parsed, bool)
- func RoutesLookupProtocol(useCache bool, net string, protocol string) (Parsed, bool)
- func RoutesLookupTable(useCache bool, net string, table string) (Parsed, bool)
- func RoutesNoExport(useCache bool, protocol string) (Parsed, bool)
- func RoutesPeer(useCache bool, peer string) (Parsed, bool)
- func RoutesPrefixed(useCache bool, prefix string) (Parsed, bool)
- func RoutesProto(useCache bool, protocol string) (Parsed, bool)
- func RoutesProtoCount(useCache bool, protocol string) (Parsed, bool)
- func RoutesProtoPrimaryCount(useCache bool, protocol string) (Parsed, bool)
- func RoutesTable(useCache bool, table string) (Parsed, bool)
- func RoutesTableAndPeer(useCache bool, table string, peer string) (Parsed, bool)
- func RoutesTableCount(useCache bool, table string) (Parsed, bool)
- func RoutesTableFiltered(useCache bool, table string) (Parsed, bool)
- func RunAndParse(useCache bool, key string, cmd string, parser func(io.Reader) Parsed, ...) (Parsed, bool)
- func Status(useCache bool) (Parsed, bool)
- func Symbols(useCache bool) (Parsed, bool)
- type ParserConfig
- type RateLimitConfig
- type RedisCache
- type StatusConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var BirdVersion = 0
View Source
var IPVersion = "4"
View Source
var RateLimitConf struct { sync.RWMutex Conf RateLimitConfig }
View Source
var RunQueue sync.Map // queue birdc commands before execution
View Source
var WorkerPoolSize = 8
WorkerPoolSize is the number of go routines used to parse routing tables concurrently
Functions ¶
func GetCacheKey ¶
Determines the key in the cache, where the result of specific functions are stored. Eliminates the need to know what command was executed by that function.
func InitializeCache ¶
func InitializeCache()
intitialize the Cache once during setup with either a MemoryCache or RedisCache implementation. TODO implement singleton pattern
func InstallRateLimitReset ¶
func InstallRateLimitReset()
Types ¶
type BirdConfig ¶
type BirdConfig struct { Listen string ConfigFilename string `toml:"config"` BirdCmd string `toml:"birdc"` CacheTtl int `toml:"ttl"` }
var ClientConf BirdConfig
type CacheConfig ¶
type CacheConfig struct { UseRedis bool `toml:"use_redis"` RedisServer string `toml:"redis_server"` RedisPassword string `toml:"redis_password"` RedisDb int `toml:"redis_db"` MaxKeys int `toml:"max_keys"` }
var CacheConf CacheConfig
type MemoryCache ¶
MemoryCache is a simple in-memory cache for parsed BIRD output. Limiting the number of cached results is using a simple LRU algorithm.
func NewMemoryCache ¶
func NewMemoryCache(maxKeys int) *MemoryCache
NewMemoryCache creates a new MemoryCache with a maximum number of keys.
func (*MemoryCache) Expire ¶
func (c *MemoryCache) Expire() int
Expire all keys in cache that are older than the TTL value.
type Parsed ¶
type Parsed map[string]interface{}
func PipeRoutesFiltered ¶
func PipeRoutesFilteredCount ¶
func ProtocolsBgp ¶
func ProtocolsShort ¶
func RoutesLookupProtocol ¶
func RoutesLookupTable ¶
func RoutesProtoPrimaryCount ¶
func RoutesTableAndPeer ¶
func RunAndParse ¶
type ParserConfig ¶
type ParserConfig struct {
FilterFields []string `toml:"filter_fields"`
}
var (
ParserConf ParserConfig
)
type RateLimitConfig ¶
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
func NewRedisCache ¶
func NewRedisCache(config CacheConfig) (*RedisCache, error)
func (*RedisCache) Expire ¶
func (self *RedisCache) Expire() int
type StatusConfig ¶
type StatusConfig struct { ReconfigTimestampSource string `toml:"reconfig_timestamp_source"` ReconfigTimestampMatch string `toml:"reconfig_timestamp_match"` FilterFields []string `toml:"filter_fields"` }
var StatusConf StatusConfig
Click to show internal directories.
Click to hide internal directories.