api

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: 8 Imported by: 0

Documentation

Overview

Package api contains the datastructures for the Alice API.

Index

Constants

View Source
const (
	BGPCommunityTypeStd = iota
	BGPCommunityTypeExt
	BGPCommunityTypeLarge
)

BGPCommunity types: Standard, Extended and Large

View Source
const (
	// RouteStateFiltered indicates that the route
	// was not accepted by the route server.
	RouteStateFiltered = "filtered"
	// RouteStateImported indicates that the route was
	// imported by the route server.
	RouteStateImported = "imported"
)
View Source
const (
	SearchKeySources          = "sources"
	SearchKeyASNS             = "asns"
	SearchKeyCommunities      = "communities"
	SearchKeyExtCommunities   = "ext_communities"
	SearchKeyLargeCommunities = "large_communities"
)

SearchKeys are filterable attributes

Variables

View Source
var (
	ErrExtCommunityIncomplete = errors.New("incomplete extended community")
)

Errors

View Source
var ErrTooManyRoutes = errors.New("too many routes")

ErrTooManyRoutes is returned when the result set of a route query exceeds the maximum allowed number of routes.

Functions

This section is empty.

Types

type BGPCommunitiesSet

type BGPCommunitiesSet struct {
	Standard []BGPCommunityRange `json:"standard"`
	Extended []BGPCommunityRange `json:"extended"`
	Large    []BGPCommunityRange `json:"large"`
}

A BGPCommunitiesSet is a set of communities, large and extended. The communities are described as ranges.

type BGPCommunityMap

type BGPCommunityMap map[string]interface{}

BGPCommunityMap is a tree representation of BGP communities where the leaf is a description or reason.

func MakeWellKnownBGPCommunities

func MakeWellKnownBGPCommunities() BGPCommunityMap

MakeWellKnownBGPCommunities returns a BGPCommunityMap map with well known communities.

func (BGPCommunityMap) Communities

func (c BGPCommunityMap) Communities() Communities

Communities enumerates all bgp communities into a set of api.Communities. CAVEAT: Wildcards are substituted by 0 and ** ARE NOT ** expanded.

func (BGPCommunityMap) Lookup

func (c BGPCommunityMap) Lookup(community string) (string, error)

Lookup searches for a label in the communities map

func (BGPCommunityMap) Set

func (c BGPCommunityMap) Set(community string, label string)

Set assignes a label to a community

type BGPCommunityRange

type BGPCommunityRange []interface{}

BGPCommunityRange is a list of tuples with the start and end of the range defining a community.

func (BGPCommunityRange) Type

func (c BGPCommunityRange) Type() int

Type classifies the BGP Ranged BGP Community into: std, large, ext

type BGPInfo

type BGPInfo struct {
	Origin           *string        `json:"origin"`
	AsPath           []int          `json:"as_path"`
	NextHop          *string        `json:"next_hop"`
	Communities      Communities    `json:"communities"`
	LargeCommunities Communities    `json:"large_communities"`
	ExtCommunities   ExtCommunities `json:"ext_communities"`
	LocalPref        int            `json:"local_pref"`
	Med              int            `json:"med"`
}

BGPInfo is a set of BGP attributes

func (*BGPInfo) HasCommunity

func (bgp *BGPInfo) HasCommunity(community Community) bool

HasCommunity checks for the presence of a BGP community.

func (*BGPInfo) HasExtCommunity

func (bgp *BGPInfo) HasExtCommunity(community ExtCommunity) bool

HasExtCommunity checks for the presence of an extended community.

func (*BGPInfo) HasLargeCommunity

func (bgp *BGPInfo) HasLargeCommunity(community Community) bool

HasLargeCommunity checks for the presence of a large community.

type CacheStatus

type CacheStatus struct {
	CachedAt time.Time `json:"cached_at"`
	OrigTTL  int       `json:"orig_ttl"`
}

CacheStatus contains cache timing information.

type CacheableResponse

type CacheableResponse interface {
	CacheTTL() time.Duration
}

CacheableResponse is a cache aware API response

type Communities

type Communities []Community

Communities is a collection of bgp communities

type Community

type Community []int

Community is a BGP community

func (Community) String

func (com Community) String() string

type ConfigResponse

type ConfigResponse struct {
	RejectReasons map[string]interface{} `json:"reject_reasons"`

	Noexport        Noexport               `json:"noexport"`
	NoexportReasons map[string]interface{} `json:"noexport_reasons"`

	RejectCandidates RejectCandidates `json:"reject_candidates"`

	Rpki Rpki `json:"rpki"`

	BGPCommunities          map[string]interface{} `json:"bgp_communities"`
	BGPBlackholeCommunities BGPCommunitiesSet      `json:"bgp_blackhole_communities"`

	NeighborsColumns      map[string]string `json:"neighbors_columns"`
	NeighborsColumnsOrder []string          `json:"neighbors_columns_order"`

	RoutesColumns      map[string]string `json:"routes_columns"`
	RoutesColumnsOrder []string          `json:"routes_columns_order"`

	LookupColumns      map[string]string `json:"lookup_columns"`
	LookupColumnsOrder []string          `json:"lookup_columns_order"`

	PrefixLookupEnabled bool `json:"prefix_lookup_enabled"`
}

ConfigResponse is a response with client runtime configuration

type ErrorResponse

type ErrorResponse struct {
	Message       string `json:"message"`
	Code          int    `json:"code"`
	Tag           string `json:"tag"`
	RouteserverID string `json:"routeserver_id"`
}

ErrorResponse encodes an error message and code

type ExtCommunities

type ExtCommunities []ExtCommunity

ExtCommunities is a collection of extended bgp communities.

type ExtCommunity

type ExtCommunity []interface{}

ExtCommunity is a BGP extended community

func (ExtCommunity) String

func (com ExtCommunity) String() string

type FilterQueryParser

type FilterQueryParser func(value string) (*SearchFilter, error)

FilterQueryParser parses a filter value into a search filter

type FilterValue

type FilterValue interface{}

FilterValue can be anything

type Filterable

type Filterable interface {
	MatchSourceID(sourceID string) bool
	MatchASN(asn int) bool
	MatchCommunity(community Community) bool
	MatchExtCommunity(community ExtCommunity) bool
	MatchLargeCommunity(community Community) bool
}

Filterable objects provide methods for matching by ID, ASN, Community, etc...

type FilteredResponse

type FilteredResponse struct {
	FiltersAvailable    *SearchFilters `json:"filters_available"`
	FiltersApplied      *SearchFilters `json:"filters_applied"`
	FiltersNotAvailable []string       `json:"filters_not_available"`
}

FilteredResponse includes filters applied and available

type GlobalRoutesLookupResponse

type GlobalRoutesLookupResponse struct {
	Response
	PaginatedResponse
	TimedResponse
	FilteredResponse
	Routes LookupRoutes `json:"routes"`
}

GlobalRoutesLookupResponse is the result of a routes query across all route servers.

type LookupRoute

type LookupRoute struct {
	*Route

	State string `json:"state"` // Filtered, Imported, ...

	Neighbor    *Neighbor          `json:"neighbor"`
	RouteServer *LookupRouteServer `json:"routeserver"`
}

LookupRoute is a route with additional neighbor and state information

func (*LookupRoute) MatchASN

func (r *LookupRoute) MatchASN(asn int) bool

MatchASN matches the neighbor's ASN

func (*LookupRoute) MatchCommunity

func (r *LookupRoute) MatchCommunity(community Community) bool

MatchCommunity checks for the presence of a BGP community.

func (*LookupRoute) MatchExtCommunity

func (r *LookupRoute) MatchExtCommunity(community ExtCommunity) bool

MatchExtCommunity matches an extended community

func (*LookupRoute) MatchLargeCommunity

func (r *LookupRoute) MatchLargeCommunity(community Community) bool

MatchLargeCommunity matches large communities.

func (*LookupRoute) MatchNeighborQuery

func (r *LookupRoute) MatchNeighborQuery(query *NeighborQuery) bool

MatchNeighborQuery matches a neighbor query

func (*LookupRoute) MatchSourceID

func (r *LookupRoute) MatchSourceID(id string) bool

MatchSourceID implements filterable interface for lookup routes

type LookupRouteServer

type LookupRouteServer struct {
	ID   *string `json:"id"`
	Name string  `json:"name"`
}

A LookupRouteServer is a shorter representation of the route server data source.

type LookupRoutes

type LookupRoutes []*LookupRoute

LookupRoutes is a collection of lookup routes.

func (LookupRoutes) Len

func (r LookupRoutes) Len() int

func (LookupRoutes) Less

func (r LookupRoutes) Less(i, j int) bool

func (LookupRoutes) Swap

func (r LookupRoutes) Swap(i, j int)

type Meta

type Meta struct {
	Version         string           `json:"version"`
	CacheStatus     CacheStatus      `json:"cache_status"`
	ResultFromCache bool             `json:"result_from_cache"`
	TTL             time.Time        `json:"ttl"`
	StoreStatus     *StoreStatusMeta `json:"store_status,omitempty"`
}

Meta contains response meta information like cacheing time and cache ttl or the API version

type Neighbor

type Neighbor struct {
	ID string `json:"id"`

	// Mandatory fields
	Address         string        `json:"address"`
	ASN             int           `json:"asn"`
	State           string        `json:"state"`
	Description     string        `json:"description"`
	RoutesReceived  int           `json:"routes_received"`
	RoutesFiltered  int           `json:"routes_filtered"`
	RoutesExported  int           `json:"routes_exported"`
	RoutesPreferred int           `json:"routes_preferred"`
	RoutesAccepted  int           `json:"routes_accepted"`
	Uptime          time.Duration `json:"uptime"`
	LastError       string        `json:"last_error"`
	RouteServerID   string        `json:"routeserver_id"`

	// Original response
	Details map[string]interface{} `json:"details"`
}

Neighbor is a BGP peer on the RS

func (*Neighbor) MatchASN

func (n *Neighbor) MatchASN(asn int) bool

MatchASN compares the neighbor's ASN.

func (*Neighbor) MatchCommunity

func (n *Neighbor) MatchCommunity(Community) bool

MatchCommunity is undefined for neighbors.

func (*Neighbor) MatchExtCommunity

func (n *Neighbor) MatchExtCommunity(Community) bool

MatchExtCommunity is undefined for neighbors.

func (*Neighbor) MatchLargeCommunity

func (n *Neighbor) MatchLargeCommunity(Community) bool

MatchLargeCommunity is undefined for neighbors.

func (*Neighbor) MatchName

func (n *Neighbor) MatchName(name string) bool

MatchName is a case insensitive match of the neighbor's description

func (*Neighbor) MatchSourceID

func (n *Neighbor) MatchSourceID(id string) bool

MatchSourceID implements Filterable interface

func (*Neighbor) String

func (n *Neighbor) String() string

String encodes a neighbor as json. This is more readable than the golang default representation.

type NeighborFilter

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

A NeighborFilter includes only a name and ASN. We are using a slightly simpler solution for neighbor queries.

func NeighborFilterFromQuery

func NeighborFilterFromQuery(q url.Values) *NeighborFilter

NeighborFilterFromQuery constructs a NeighborFilter from query parameters.

Right now we support filtering by name (partial match) and ASN.

The latter is used to find related peers on all route servers.

func NeighborFilterFromQueryString

func NeighborFilterFromQueryString(q string) *NeighborFilter

NeighborFilterFromQueryString decodes query values from string into a NeighborFilter.

This is intended as a helper method to make testing easier.

func (*NeighborFilter) Match

func (s *NeighborFilter) Match(neighbor *Neighbor) bool

Match neighbor with filter: Check if the neighbor in question has the required parameters.

type NeighborQuery

type NeighborQuery struct {
	NeighborID *string
	SourceID   *string
}

NeighborQuery is used in finding routes by neighbors. Source and Neighbor IDs are pointers to string pools.

type NeighborStatus

type NeighborStatus struct {
	ID    string        `json:"id"`
	State string        `json:"state"`
	Since time.Duration `json:"uptime"`
}

NeighborStatus contains only the neighbor state and uptime.

type Neighbors

type Neighbors []*Neighbor

Neighbors is a collection of neighbors

func (Neighbors) Len

func (neighbors Neighbors) Len() int

func (Neighbors) Less

func (neighbors Neighbors) Less(i, j int) bool

func (Neighbors) Swap

func (neighbors Neighbors) Swap(i, j int)

type NeighborsLookupResults

type NeighborsLookupResults map[string]Neighbors

NeighborsLookupResults is a mapping of lookup neighbors. The sourceID is used as a key.

type NeighborsResponse

type NeighborsResponse struct {
	Response
	Neighbors Neighbors `json:"neighbors"`
}

A NeighborsResponse is a list of neighbors with caching information.

func (*NeighborsResponse) CacheTTL

func (res *NeighborsResponse) CacheTTL() time.Duration

CacheTTL returns the duration of validity of the neighbor response.

type NeighborsStatus

type NeighborsStatus []*NeighborStatus

NeighborsStatus is a list of statuses.

func (NeighborsStatus) Len

func (neighbors NeighborsStatus) Len() int

func (NeighborsStatus) Less

func (neighbors NeighborsStatus) Less(i, j int) bool

func (NeighborsStatus) Swap

func (neighbors NeighborsStatus) Swap(i, j int)

type NeighborsStatusResponse

type NeighborsStatusResponse struct {
	Response
	Neighbors NeighborsStatus `json:"neighbors"`
}

NeighborsStatusResponse contains the status of all neighbors on a RS.

type NeighborsStoreStats

type NeighborsStoreStats struct {
	TotalNeighbors int                         `json:"total_neighbors"`
	RouteServers   []RouteServerNeighborsStats `json:"route_servers"`
}

NeighborsStoreStats are the stats for all sources of neighbors.

func (*NeighborsStoreStats) Log

func (stats *NeighborsStoreStats) Log()

Log prints the stats

type Noexport

type Noexport struct {
	LoadOnDemand bool `json:"load_on_demand"`
}

Noexport options

type PaginatedResponse

type PaginatedResponse struct {
	Pagination Pagination `json:"pagination"`
}

A PaginatedResponse with pagination info

type PaginatedRoutesLookupResponse

type PaginatedRoutesLookupResponse struct {
	Response
	TimedResponse
	FilteredResponse

	Imported *RoutesLookup `json:"imported"`
	Filtered *RoutesLookup `json:"filtered"`

	Status *StoreStatusMeta `json:"status"`
}

A PaginatedRoutesLookupResponse TODO

type PaginatedRoutesResponse

type PaginatedRoutesResponse struct {
	Response
	PaginatedResponse
	TimedResponse
	FilteredResponse
	RoutesResponse
}

A PaginatedRoutesResponse includes routes and pagination information form a single route server

type Pagination

type Pagination struct {
	Page         int `json:"page"`
	PageSize     int `json:"page_size"`
	TotalPages   int `json:"total_pages"`
	TotalResults int `json:"total_results"`
}

Pagination information, including the current page, total pages, page size, etc...

type RejectCandidates

type RejectCandidates struct {
	Communities map[string]interface{} `json:"communities"`
}

RejectCandidates contains a communities mapping of reasons for a rejection in the future.

type Response

type Response struct {
	Meta *Meta `json:"api"`
}

A Response is a general API response. All API responses contain meta information with API version and caching information.

type Route

type Route struct {
	// ID         string  `json:"id"`
	NeighborID *string `json:"neighbor_id"`

	Network    string        `json:"network"`
	Interface  *string       `json:"interface"`
	Gateway    *string       `json:"gateway"`
	Metric     int           `json:"metric"`
	BGP        *BGPInfo      `json:"bgp"`
	Age        time.Duration `json:"age"`
	Type       []string      `json:"type"` // [BGP, unicast, univ]
	Primary    bool          `json:"primary"`
	LearntFrom *string       `json:"learnt_from"`

	Details *json.RawMessage `json:"details"`
}

Route is a prefix with BGP information.

func (*Route) MatchASN

func (r *Route) MatchASN(asn int) bool

MatchASN is not defined

func (*Route) MatchCommunity

func (r *Route) MatchCommunity(community Community) bool

MatchCommunity checks for the presence of a BGP community

func (*Route) MatchExtCommunity

func (r *Route) MatchExtCommunity(community ExtCommunity) bool

MatchExtCommunity checks for the presence of a BGP extended community

func (*Route) MatchLargeCommunity

func (r *Route) MatchLargeCommunity(community Community) bool

MatchLargeCommunity checks for the presence of a large BGP community

func (*Route) MatchSourceID

func (r *Route) MatchSourceID(id string) bool

MatchSourceID implements Filterable interface for routes

func (*Route) String

func (r *Route) String() string

type RouteServer

type RouteServer struct {
	ID         string   `json:"id"`
	Type       string   `json:"type"`
	Name       string   `json:"name"`
	Group      string   `json:"group"`
	Blackholes []string `json:"blackholes"`

	Order int `json:"-"`
}

A RouteServer is a datasource with attributes.

type RouteServerNeighborsStats

type RouteServerNeighborsStats struct {
	Name      string    `json:"name"`
	State     string    `json:"state"`
	Neighbors int       `json:"neighbors"`
	UpdatedAt time.Time `json:"updated_at"`
}

RouteServerNeighborsStats are statistics about the neighbors store for a single route server.

type RouteServerRoutesStats

type RouteServerRoutesStats struct {
	Name   string      `json:"name"`
	Routes RoutesStats `json:"routes"`

	State     string    `json:"state"`
	UpdatedAt time.Time `json:"updated_at"`
}

RouteServerRoutesStats provides the number of filtered and exported routes for a route server.

type RouteServers

type RouteServers []RouteServer

RouteServers is a collection of routeservers.

func (RouteServers) Len

func (rs RouteServers) Len() int

Len implements sorting interface for routeservers

func (RouteServers) Less

func (rs RouteServers) Less(i, j int) bool

func (RouteServers) Swap

func (rs RouteServers) Swap(i, j int)

type RouteServersResponse

type RouteServersResponse struct {
	RouteServers RouteServers `json:"routeservers"`
}

A RouteServersResponse contains a list of routeservers.

type Routes

type Routes []*Route

Routes is a collection of routes

func (Routes) Len

func (routes Routes) Len() int

func (Routes) Less

func (routes Routes) Less(i, j int) bool

func (Routes) Swap

func (routes Routes) Swap(i, j int)

func (Routes) ToLookupRoutes

func (routes Routes) ToLookupRoutes(
	state string,
	rs *LookupRouteServer,
	neighbors map[string]*Neighbor,
) LookupRoutes

ToLookupRoutes prepares routes for lookup

type RoutesLookup

type RoutesLookup struct {
	Routes     LookupRoutes `json:"routes"`
	Pagination Pagination   `json:"pagination"`
}

RoutesLookup contains routes and pagination info

type RoutesLookupResponse

type RoutesLookupResponse struct {
	Response
	PaginatedResponse
	TimedResponse
	FilteredResponse
	Routes LookupRoutes `json:"routes"`
}

RoutesLookupResponse is a PaginatedResponse with a set of lookup routes, as the result of a query of a specific route server.

type RoutesResponse

type RoutesResponse struct {
	Response
	Imported    Routes `json:"imported"`
	Filtered    Routes `json:"filtered"`
	NotExported Routes `json:"not_exported"`
}

RoutesResponse contains all routes from a source

func (*RoutesResponse) CacheTTL

func (res *RoutesResponse) CacheTTL() time.Duration

CacheTTL returns the cache ttl of the response

type RoutesStats

type RoutesStats struct {
	Filtered uint `json:"filtered"`
	Imported uint `json:"imported"`
}

RoutesStats provides number of filtered and imported prefixes in the store

type RoutesStoreStats

type RoutesStoreStats struct {
	TotalRoutes  RoutesStats              `json:"total_routes"`
	RouteServers []RouteServerRoutesStats `json:"route_servers"`
}

RoutesStoreStats are statistics about the stored prefixes per route server

func (*RoutesStoreStats) Log

func (stats *RoutesStoreStats) Log()

Log writes stats to the log

type Rpki

type Rpki struct {
	Enabled    bool       `json:"enabled"`
	Valid      [][]string `json:"valid"`
	Unknown    [][]string `json:"unknown"`
	NotChecked [][]string `json:"not_checked"`
	Invalid    [][]string `json:"invalid"`
}

Rpki is the validation status of a prefix

type SearchFilter

type SearchFilter struct {
	Cardinality int         `json:"cardinality"`
	Name        string      `json:"name"`
	Value       FilterValue `json:"value"`
}

SearchFilter is a key value pair with an indicator how many results the predicate does cover.

func (*SearchFilter) Equal

func (f *SearchFilter) Equal(other *SearchFilter) bool

Equal checks the equality of two filters by applying the appropriate compare function to the serach filter value.

type SearchFilterCmpFunc

type SearchFilterCmpFunc func(a FilterValue, b FilterValue) bool

A SearchFilterCmpFunc can be implemented for various types, e.g. for integer matching or string matchin.

type SearchFilterComparator

type SearchFilterComparator func(route Filterable, value interface{}) bool

A SearchFilterComparator compares route with a filter

type SearchFilterGroup

type SearchFilterGroup struct {
	Key string `json:"key"`

	Filters []*SearchFilter `json:"filters"`
	// contains filtered or unexported fields
}

SearchFilterGroup contains filtergroups and an index.

func (*SearchFilterGroup) AddFilter

func (g *SearchFilterGroup) AddFilter(filter *SearchFilter)

AddFilter adds a filter to a group

func (*SearchFilterGroup) AddFilters

func (g *SearchFilterGroup) AddFilters(filters []*SearchFilter)

AddFilters adds a list of filters to a group.

func (*SearchFilterGroup) Contains

func (g *SearchFilterGroup) Contains(filter *SearchFilter) bool

Contains checks if a filter is present in a a group

func (*SearchFilterGroup) FindFilter

func (g *SearchFilterGroup) FindFilter(filter *SearchFilter) *SearchFilter

FindFilter tries to lookup a filter in a search filter group.

func (*SearchFilterGroup) GetFilterByValue

func (g *SearchFilterGroup) GetFilterByValue(value interface{}) *SearchFilter

GetFilterByValue retrieves a filter by matching a string representation of it's filter value.

func (*SearchFilterGroup) MatchAll

func (g *SearchFilterGroup) MatchAll(route Filterable) bool

MatchAll checks if a route matches all predicates in the filter group.

func (*SearchFilterGroup) MatchAny

func (g *SearchFilterGroup) MatchAny(route Filterable) bool

MatchAny checks if a route matches any filter in a filter group.

type SearchFilters

type SearchFilters []*SearchFilterGroup

SearchFilters is a collection of filter groups

func FiltersFromQuery

func FiltersFromQuery(query url.Values) (*SearchFilters, error)

FiltersFromQuery builds a filter struct from query parameters.

For example a query string of:

asns=2342,23123&communities=23:42&large_communities=23:42:42

yields a filtering struct of

Groups[
    Group{"sources", []},
    Group{"asns", [Filter{Value: 2342},
                   Filter{Value: 23123}]},
    Group{"communities", ...
}

func FiltersFromTokens

func FiltersFromTokens(tokens []string) (*SearchFilters, error)

FiltersFromTokens parses the passed list of filters extracted from the query string and creates the filter.

func NewSearchFilters

func NewSearchFilters() *SearchFilters

NewSearchFilters creates a new collection of search filter groups.

func (*SearchFilters) Combine

func (s *SearchFilters) Combine(other *SearchFilters) *SearchFilters

Combine two search filters

func (*SearchFilters) GetGroupByKey

func (s *SearchFilters) GetGroupByKey(key string) *SearchFilterGroup

GetGroupByKey retrievs a search filter group by a string.

func (*SearchFilters) HasGroup

func (s *SearchFilters) HasGroup(key string) bool

HasGroup checks if a group with a given key exists and filters are present.

func (*SearchFilters) MatchRoute

func (s *SearchFilters) MatchRoute(r Filterable) bool

MatchRoute checks if a route matches all filters. Unless all filters are blank.

func (*SearchFilters) MergeProperties

func (s *SearchFilters) MergeProperties(other *SearchFilters)

MergeProperties merges two search filters

func (*SearchFilters) Sub

func (s *SearchFilters) Sub(other *SearchFilters) *SearchFilters

Sub makes a diff of two search filters

func (*SearchFilters) UpdateASNSFromLookupRoute

func (s *SearchFilters) UpdateASNSFromLookupRoute(r *LookupRoute)

UpdateASNSFromLookupRoute updates the ASN filter

func (*SearchFilters) UpdateCommunitiesFromLookupRoute

func (s *SearchFilters) UpdateCommunitiesFromLookupRoute(r *LookupRoute)

UpdateCommunitiesFromLookupRoute updates the communities filter

func (*SearchFilters) UpdateFromLookupRoute

func (s *SearchFilters) UpdateFromLookupRoute(r *LookupRoute)

UpdateFromLookupRoute updates a filter and its counters.

Update filter struct to include route:

  • Extract ASN, source, bgp communities,
  • Find Filter in group, increment result count if required.

func (*SearchFilters) UpdateFromRoute

func (s *SearchFilters) UpdateFromRoute(r *Route)

UpdateFromRoute updates a search filter, however as information of the route server or neighbor is not present, as this is not a lookup route, only communities are considered.

func (*SearchFilters) UpdateSourcesFromLookupRoute

func (s *SearchFilters) UpdateSourcesFromLookupRoute(r *LookupRoute)

UpdateSourcesFromLookupRoute updates the source filter

type SourceStatus

type SourceStatus struct {
	RefreshInterval time.Duration `json:"refresh_interval"`
	LastRefresh     time.Time     `json:"last_refresh"`
	State           string        `json:"state"`
	Initialized     bool          `json:"initialized"`
}

SourceStatus is the current status of a source in a store.

type Status

type Status struct {
	ServerTime   time.Time `json:"server_time"`
	LastReboot   time.Time `json:"last_reboot"`
	LastReconfig time.Time `json:"last_reconfig"`
	Message      string    `json:"message"`
	RouterID     string    `json:"router_id"`
	Version      string    `json:"version"`
	Backend      string    `json:"backend"`
}

Status ... TODO: ?

type StatusResponse

type StatusResponse struct {
	Response
	Status Status `json:"status"`
}

StatusResponse ??

type StoreStatus

type StoreStatus struct {
	Initialized bool                     `json:"initialized"`
	Sources     map[string]*SourceStatus `json:"sources"`
}

StoreStatus is meta data for a store

type StoreStatusMeta

type StoreStatusMeta struct {
	Routes    *StoreStatus `json:"routes,omitempty"`
	Neighbors *StoreStatus `json:"neighbors,omitempty"`
}

StoreStatusMeta is the meta response for all stores

type TimedResponse

type TimedResponse struct {
	RequestDuration float64 `json:"request_duration_ms"`
}

TimedResponse include the duration of the request

Jump to

Keyboard shortcuts

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