Merge branch 'develop' into patch-1

This commit is contained in:
Annika Hannig 2024-03-05 16:03:03 +01:00 committed by GitHub
commit 0cfee83602
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
51 changed files with 157 additions and 139 deletions

View File

@ -3,21 +3,30 @@ __"No, no! The adventures first, explanations take such a dreadful time."__
_Lewis Carroll, Alice's Adventures in Wonderland & Through the Looking-Glass_
Take a look at Alice-LG production examples at:
- https://lg.de-cix.net/
- https://lg.ams-ix.net
- https://lg.bcix.de/
- https://lg.megaport.com/
- https://lg.netnod.se/
- https://alice-rs.linx.net/
- https://lg.ix.br/
- https://lg.bcix.de
- https://lg.dd-ix.net
- https://lg.de-cix.net
- https://glass.gigapix.pt
- https://lg.ix.br
- https://alice.sfmix.org/
- https://alice-rs.linx.net
- https://lg.megaport.com
- https://lg.netnod.se
- https://lg.s-ix.de
- https://lg.top-ix.org
- https://alice.sfmix.org/
And checkout the API at:
And check out the API at:
- https://lg.de-cix.net/api/v1/config
- https://lg.de-cix.net/api/v1/status
- https://lg.de-cix.net/api/v1/routeservers
- https://lg.de-cix.net/api/v1/routeservers/rs1_fra_ipv4/status
- https://lg.de-cix.net/api/v1/routeservers/rs1_fra_ipv4/neighbors
- https://lg.de-cix.net/api/v1/routeservers/rs1_fra_ipv4/neighbors/R194_106/routes
- https://lg.de-cix.net/api/v1/routeservers/rs1_fra_ipv4/neighbors/R194_106/routes/received
- https://lg.de-cix.net/api/v1/routeservers/rs1_fra_ipv4/neighbors/R194_106/routes/filtered
- https://lg.de-cix.net/api/v1/routeservers/rs1_fra_ipv4/neighbors/R194_106/routes/not-exported
- https://lg.de-cix.net/api/v1/lookup/prefix?q=217.115.0.0
@ -44,7 +53,7 @@ Currently Alice-LG supports the following APIs:
### Birdwatcher
Normally you would first install the [birdwatcher API](https://github.com/alice-lg/birdwatcher) directly on the machine(s) where you run [BIRD](http://bird.network.cz/) on
and then install Alice-LG on a seperate public facing server and point her to the afore mentioned [birdwatcher API](https://github.com/alice-lg/birdwatcher).
and then install Alice-LG on a separate public facing server and point her to the afore mentioned [birdwatcher API](https://github.com/alice-lg/birdwatcher).
This project was a direct result of the [RIPE IXP Tools Hackathon](https://atlas.ripe.net/hackathon/ixp-tools/)
just prior to [RIPE73](https://ripe73.ripe.net/) in Madrid, Spain.
@ -189,10 +198,10 @@ with the optional parameter (the "mountpoint" of the theme)
url_base = /theme
You can put assets (images, fonts, javscript, css) in
You can put assets (images, fonts, javascript, css) in
this folder.
Stylesheets and Javascripts are automatically included in
Stylesheets and JavaScripts are automatically included in
the client's html and are served from the backend.
Alice provides early stages of an extension API, which is for now

View File

@ -83,8 +83,10 @@ routes_accepted_page_size = 250
routes_not_exported_page_size = 250
[rejection_reasons]
# a pair of a large BGP community value and a string to signal the processing
# results of route filtering
# BGP communities which, when present on a prefix represent the route as having
# been filtered out.
# Additionally, communities for searching and descriptions should be listed in
# the [bgp_communities] section of this configuration.
9033:65666:1 = An IP Bogon was detected
9033:65666:2 = Prefix is longer than 64
9033:65666:3 = Prefix is longer than 24
@ -140,7 +142,8 @@ unknown = 23042:1000:2
invalid = 23042:1000:4-*
# Define other known bgp communities
# Define known bgp communities which should be recognized and described in the
# Alice web UI
[bgp_communities]
1:23 = some tag
9033:65666:1 = ip bogon detected

View File

@ -72,7 +72,7 @@ type Rpki struct {
}
// Meta contains response meta information
// like cacheing time and cache ttl or the API version
// like caching time and cache ttl or the API version
type Meta struct {
Version string `json:"version"`
CacheStatus CacheStatus `json:"cache_status"`

View File

@ -130,7 +130,7 @@ func TestHasCommunity(t *testing.T) {
}
if bgp.HasLargeCommunity(Community{23, 42}) != false {
t.Error("23:42 should not be present in large commnuties")
t.Error("23:42 should not be present in large communities")
}
}

View File

@ -372,7 +372,7 @@ func NewSearchFilters() *SearchFilters {
return groups
}
// GetGroupByKey retrievs a search filter group
// GetGroupByKey retrieves a search filter group
// by a string.
func (s *SearchFilters) GetGroupByKey(key string) *SearchFilterGroup {
// This is an optimization (this is basically a fixed hash map,

View File

@ -12,7 +12,7 @@ used key.
*/
type LRUMap map[string]time.Time
// LRU retrievs the least recently used key
// LRU retrieves the least recently used key
func (lrumap LRUMap) LRU() string {
t := time.Now()
key := ""

View File

@ -30,7 +30,7 @@ func NewNeighborsCache(disabled bool) *NeighborsCache {
return cache
}
// Get retrievs the neighbors response from the cache, if present,
// Get retrieves the neighbors response from the cache, if present,
// and makes sure the information is still up to date.
func (cache *NeighborsCache) Get() *api.NeighborsResponse {
if cache.disabled {

View File

@ -37,7 +37,7 @@ func NewRoutesCache(disabled bool, size int) *RoutesCache {
return cache
}
// Get retrievs all routes for a given neighbor
// Get retrieves all routes for a given neighbor
func (cache *RoutesCache) Get(neighborID string) *api.RoutesResponse {
if cache.disabled {
return nil

View File

@ -29,7 +29,7 @@ var (
// not be identified from the section.
ErrSourceTypeUnknown = errors.New("source type unknown")
// ErrPostgresUnconfigured will occure when the
// ErrPostgresUnconfigured will occur when the
// postgres database URL is required, but missing.
ErrPostgresUnconfigured = errors.New(
"the selected postgres backend requires configuration")
@ -731,7 +731,7 @@ func getSources(config *ini.File) ([]*SourceConfig, error) {
if len(sourceConfigSections) > 1 {
// The source is ambiguous
return nil, fmt.Errorf("%s has ambigous backends", section.Name())
return nil, fmt.Errorf("%s has ambiguous backends", section.Name())
}
// Configure backend
@ -795,15 +795,14 @@ func getSources(config *ini.File) ([]*SourceConfig, error) {
}
srcCfg.Birdwatcher = c
log.Println("Adding birdwatcher source",
c.Name, "of type", sourceType,
"with peer_table_prefix", peerTablePrefix,
"and pipe_protocol_prefix", pipeProtocolPrefix)
if c.AltPipeProtocolSuffix != "" {
log.Println(
"Alt pipe protocol prefix:", c.AltPipeProtocolPrefix,
"suffix:", c.AltPipeProtocolSuffix,
)
log.Println("Adding birdwatcher source", c.Name, "of type", sourceType)
if sourceType == "multi_table" {
log.Println(" Peer table prefix:", peerTablePrefix)
log.Println(" Pipe protocol prefix:", pipeProtocolPrefix)
if c.AltPipeProtocolSuffix != "" {
log.Println(" Alternative pipe protocol prefix:", c.AltPipeProtocolPrefix)
log.Println(" Alternative pipe protocol suffix:", c.AltPipeProtocolSuffix)
}
}
case SourceBackendGoBGP:

View File

@ -35,7 +35,7 @@ func TestLoadConfigs(t *testing.T) {
t.Error(err)
}
if label != "some tag" {
t.Error("expcted to find example community 1:23 with 'some tag'",
t.Error("expected to find example community 1:23 with 'some tag'",
"but got:", label)
}

View File

@ -1,6 +1,6 @@
package decoders
// MapGet retrievs a key from an expected map
// MapGet retrieves a key from an expected map
// it falls back if the input is not a map
// or the key was not found.
func MapGet(m interface{}, key string, fallback interface{}) interface{} {
@ -15,7 +15,7 @@ func MapGet(m interface{}, key string, fallback interface{}) interface{} {
return val
}
// MapGetString retrievs a key from a map and
// MapGetString retrieves a key from a map and
// asserts its type is a string. Otherwise fallback
// will be returned.
func MapGetString(m interface{}, key string, fallback string) string {

View File

@ -1,3 +1,3 @@
// Package decoders contains functions for
// decoding backend responses into internal datastrucures.
// decoding backend responses into internal datastructures.
package decoders

View File

@ -113,7 +113,7 @@ func Duration(value interface{}, fallback time.Duration) time.Duration {
}
// DurationTimeframe decodes a duration: Bgpctl encodes
// this using fmt_timeframe, whiuch outputs a format similar
// this using fmt_timeframe, which outputs a format similar
// to that being understood by time.ParseDuration - however
// the time unit "w" (weeks) is not supported.
// According to https://github.com/openbgpd-portable/openbgpd-openbsd/blob/master/src/usr.sbin/bgpctl/bgpctl.c#L586-L591

View File

@ -67,7 +67,7 @@ func (s *Server) apiRoutesListReceived(
allRoutes := apiQueryFilterNextHopGateway(req, "q", result.Imported)
routes := api.Routes{}
// Apply other (commmunity) filters
// Apply other (community) filters
filtersApplied, err := api.FiltersFromQuery(req.URL.Query())
if err != nil {
return nil, err
@ -145,7 +145,7 @@ func (s *Server) apiRoutesListFiltered(
allRoutes := apiQueryFilterNextHopGateway(req, "q", result.Filtered)
routes := api.Routes{}
// Apply other (commmunity) filters
// Apply other (community) filters
filtersApplied, err := api.FiltersFromQuery(req.URL.Query())
if err != nil {
return nil, err
@ -223,7 +223,7 @@ func (s *Server) apiRoutesListNotExported(
allRoutes := apiQueryFilterNextHopGateway(req, "q", result.NotExported)
routes := api.Routes{}
// Apply other (commmunity) filters
// Apply other (community) filters
filtersApplied, err := api.FiltersFromQuery(req.URL.Query())
if err != nil {
return nil, err

View File

@ -31,7 +31,7 @@ func TestApiRoutesPagination(t *testing.T) {
}
if pagination.Page != 0 {
t.Error("Exptected current page to be 0, got:", pagination.Page)
t.Error("Expected current page to be 0, got:", pagination.Page)
}
// Check paginated slicing

View File

@ -48,7 +48,7 @@ func TestApiQueryFilterNextHopGateway(t *testing.T) {
)
if len(filtered) != 2 {
t.Error("Exptected 2 routes, got:", len(filtered))
t.Error("Expected 2 routes, got:", len(filtered))
}
// Check presence of route_01 and _03, matching prefix 123.

View File

@ -19,7 +19,7 @@ func (err *ErrValidationFailed) Error() string {
return err.Reason
}
// NewErrMissingParam returns a new error idicating
// NewErrMissingParam returns a new error indicating
// a missing query parameter.
func NewErrMissingParam(key string) *ErrValidationFailed {
return &ErrValidationFailed{
@ -28,12 +28,12 @@ func NewErrMissingParam(key string) *ErrValidationFailed {
}
}
// NewErrAmbigousParam returns an ErrValidationFailed,
// indicating that the parameter was ambigous.
func NewErrAmbigousParam(key string) *ErrValidationFailed {
// NewErrAmbiguousParam returns an ErrValidationFailed,
// indicating that the parameter was ambiguous.
func NewErrAmbiguousParam(key string) *ErrValidationFailed {
return &ErrValidationFailed{
Param: key,
Reason: fmt.Sprintf("query parameter %s is ambigous", key),
Reason: fmt.Sprintf("query parameter %s is ambiguous", key),
}
}
@ -79,7 +79,7 @@ func validateQueryString(req *http.Request, key string) (string, error) {
}
if len(values) != 1 {
return "", NewErrAmbigousParam(key)
return "", NewErrAmbiguousParam(key)
}
value := values[0]

View File

@ -9,7 +9,7 @@ package http
directory will be included in the frontends HTML.
Additional files can be added in subdirectories.
These are served aswell and can be used for additional
These are served as well and can be used for additional
assets. (E.g. a logo)
*/
@ -108,7 +108,7 @@ func (t *Theme) StylesheetIncludes() string {
return strings.Join(includes, "\n")
}
// Scripts retrieve a list of includeable javascipts
// Scripts retrieve a list of includeable javascripts
func (t *Theme) Scripts() []string {
return t.listIncludes(".js")
}

View File

@ -13,7 +13,7 @@ import (
)
// Web Client
// Handle assets and client app preprarations
// Handle assets and client app preparations
// Prepare client HTML:
// Set paths and add version to assets.
@ -76,7 +76,7 @@ func (s *Server) webRegisterAssets(
io.WriteString(res, themedHTML)
})
// ...and all alice related paths aswell
// ...and all alice related paths as well
alicePaths := []string{
"/routeservers/*path",
"/search/*path",

View File

@ -57,7 +57,7 @@ func (p *StringListPool) Acquire(list []string) []string {
return p.root.value
}
// Make idenfier list
// Make identifier list
id := make([]int, len(list))
for i, s := range list {
// Resolve string value into int

View File

@ -96,7 +96,7 @@ func parseCacheStatus(
status := api.CacheStatus{
CachedAt: cachedAtTime,
// We ommit OrigTTL for now...
// We omit OrigTTL for now...
}
return status, nil
@ -286,7 +286,7 @@ func parseBgpCommunities(data interface{}) []api.Community {
return communities
}
// Extract extended communtieis
// Extract extended communities
func parseExtBgpCommunities(data interface{}) []api.ExtCommunity {
communities := []api.ExtCommunity{}
ldata, ok := data.([]interface{})

View File

@ -51,7 +51,7 @@ func Test_ParseApiStatus(t *testing.T) {
return
}
// Assertations
// Assertions
if apiStatus.Version != "1.7.11" {
t.Error("Expected version: 1.7.11, got:", apiStatus.Version)
}
@ -106,7 +106,7 @@ func Test_RoutesParsing(t *testing.T) {
t.Error("Expected parsed routes to be 1, not:", len(routes))
}
// TODO: addo more tests
// TODO: add more tests
}
func Test_ParseServerTime(t *testing.T) {

View File

@ -30,7 +30,7 @@ type GenericBirdwatcher struct {
routesRequiredCache *caches.RoutesCache
routesNotExportedCache *caches.RoutesCache
// Mutices:
// Mutexes:
routesFetchMutex *LockMap
}
@ -205,7 +205,7 @@ func (b *GenericBirdwatcher) ExpireCaches() int {
return count
}
// Status retrievs the current backend status
// Status retrieves the current backend status
func (b *GenericBirdwatcher) Status(ctx context.Context) (*api.StatusResponse, error) {
bird, err := b.client.GetJSON(ctx, "/status")
if err != nil {

View File

@ -57,7 +57,7 @@ func NewExtendedNexthopCapability(a *bgp.CapExtendedNexthop) *api.ExtendedNextho
}
}
// NewGracefulRestartCapability creates a new graceful resetart capabilty
// NewGracefulRestartCapability creates a new graceful restart capability
func NewGracefulRestartCapability(a *bgp.CapGracefulRestart) *api.GracefulRestartCapability {
tuples := make([]*api.GracefulRestartCapabilityTuple, 0, len(a.Tuples))
for _, t := range a.Tuples {
@ -73,7 +73,7 @@ func NewGracefulRestartCapability(a *bgp.CapGracefulRestart) *api.GracefulRestar
}
}
// NewFourOctetASNumberCapability creates new 32bit ASN capabiliy
// NewFourOctetASNumberCapability creates new 32bit ASN capability
func NewFourOctetASNumberCapability(a *bgp.CapFourOctetASNumber) *api.FourOctetASNumberCapability {
return &api.FourOctetASNumberCapability{
As: a.CapValue,

View File

@ -52,7 +52,7 @@ func (gobgp *GoBGP) lookupNeighbor(
return nil, fmt.Errorf("could not lookup neighbor")
}
// GetNeighbors retrievs all neighbors and returns
// GetNeighbors retrieves all neighbors and returns
// a list of peers.
func (gobgp *GoBGP) GetNeighbors(
ctx context.Context,

View File

@ -93,7 +93,7 @@ func (gobgp *GoBGP) ExpireCaches() int {
return count
}
// NeighborsStatus retrievs all status information
// NeighborsStatus retrieves all status information
// for all peers on the RS.
func (gobgp *GoBGP) NeighborsStatus(
ctx context.Context,
@ -130,12 +130,13 @@ func (gobgp *GoBGP) NeighborsStatus(
_resp.Peer.Timers.State.Uptime.Seconds,
int64(_resp.Peer.Timers.State.Uptime.Nanos)))
}
response.Neighbors = append(response.Neighbors, &ns)
}
return &response, nil
}
// Status retrievs the routers status
// Status retrieves the routers status
func (gobgp *GoBGP) Status(
ctx context.Context,
) (*api.StatusResponse, error) {
@ -154,7 +155,7 @@ func (gobgp *GoBGP) Status(
return &response, nil
}
// Neighbors retrievs a list of neighbors
// Neighbors retrieves a list of neighbors
func (gobgp *GoBGP) Neighbors(
ctx context.Context,
) (*api.NeighborsResponse, error) {

View File

@ -81,7 +81,7 @@ func (src *BgplgdSource) ShowNeighborsSummaryRequest(
return http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
}
// ShowNeighborRIBRequest retrives the routes accepted from the neighbor
// ShowNeighborRIBRequest retrieves the routes accepted from the neighbor
// identified by bgp-id.
func (src *BgplgdSource) ShowNeighborRIBRequest(
ctx context.Context,
@ -129,7 +129,7 @@ func (src *BgplgdSource) Status(ctx context.Context) (*api.StatusResponse, error
return response, nil
}
// Neighbors retrievs a full list of all neighbors
// Neighbors retrieves a full list of all neighbors
func (src *BgplgdSource) Neighbors(
ctx context.Context,
) (*api.NeighborsResponse, error) {
@ -180,7 +180,7 @@ func (src *BgplgdSource) Neighbors(
return response, nil
}
// NeighborsSummary retrievs list of neighbors, which
// NeighborsSummary retrieves list of neighbors, which
// might lack details like with number of rejected routes.
// It is much faster though.
func (src *BgplgdSource) NeighborsSummary(
@ -227,8 +227,8 @@ func (src *BgplgdSource) NeighborsSummary(
return response, nil
}
// NeighborsStatus retrives the status summary
// for all neightbors
// NeighborsStatus retrieves the status summary
// for all neighbors
func (src *BgplgdSource) NeighborsStatus(
ctx context.Context,
) (*api.NeighborsStatusResponse, error) {
@ -411,7 +411,7 @@ func (src *BgplgdSource) RoutesFiltered(
return response, nil
}
// RoutesNotExported retrievs the routes not exported
// RoutesNotExported retrieves the routes not exported
// from the rs for a neighbor.
func (src *BgplgdSource) RoutesNotExported(
ctx context.Context,
@ -428,7 +428,7 @@ func (src *BgplgdSource) RoutesNotExported(
return response, nil
}
// AllRoutes retrievs the entire RIB from the source. This is never
// AllRoutes retrieves the entire RIB from the source. This is never
// cached as it is processed by the store.
func (src *BgplgdSource) AllRoutes(
ctx context.Context,

View File

@ -43,7 +43,7 @@ func decodeNeighbor(n interface{}) (*api.Neighbor, error) {
prefixes := decoders.MapGet(stats, "prefixes", map[string]interface{}{})
neighbor := &api.Neighbor{
// ID: decoders.MapGetString(nb, "remote_addr", "invalid_id"),
ID: decoders.MapGetString(nb, "remote_addr", "invalid_id"),
Address: decoders.MapGetString(nb, "remote_addr", "invalid_address"),
ASN: decoders.IntFromString(decoders.MapGetString(nb, "remote_as", ""), -1),
State: decodeState(decoders.MapGetString(nb, "state", "unknown")),
@ -70,7 +70,7 @@ func describeNeighbor(nb interface{}) string {
return fmt.Sprintf("PEER AS%s %s", asn, addr)
}
// decodeNeighbors retrievs neighbors data from
// decodeNeighbors retrieves neighbors data from
// the bgpctl response.
func decodeNeighbors(res map[string]interface{}) (api.Neighbors, error) {
nbs := decoders.MapGet(res, "neighbors", nil)
@ -92,7 +92,7 @@ func decodeNeighbors(res map[string]interface{}) (api.Neighbors, error) {
return all, nil
}
// decodeNeighborsStatus retrievs a neighbors summary
// decodeNeighborsStatus retrieves a neighbors summary
// and decodes the status.
func decodeNeighborsStatus(res map[string]interface{}) (api.NeighborsStatus, error) {
nbs := decoders.MapGet(res, "neighbors", nil)
@ -234,7 +234,7 @@ func decodeCommunities(c interface{}) api.Communities {
return comms
}
// decodeExtendedCommunities decodes extended communties
// decodeExtendedCommunities decodes extended communities
// into a list of (str, int, int).
func decodeExtendedCommunities(c interface{}) api.ExtCommunities {
details := decoders.StringList(c)

View File

@ -20,7 +20,7 @@ const (
)
// StateServerSource implements the OpenBGPD source for Alice.
// It is intendet to consume structured bgpctl output
// It is intended to consume structured bgpctl output
// queried over HTTP using the:
//
// openbgpd-state-server
@ -93,7 +93,7 @@ func (src *StateServerSource) ShowNeighborsSummaryRequest(
return http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
}
// ShowNeighborRIBRequest retrives the routes accepted from the neighbor
// ShowNeighborRIBRequest retrieves the routes accepted from the neighbor
// identified by bgp-id.
func (src *StateServerSource) ShowNeighborRIBRequest(
ctx context.Context,
@ -153,7 +153,7 @@ func (src *StateServerSource) Status(
return response, nil
}
// Neighbors retrievs a full list of all neighbors
// Neighbors retrieves a full list of all neighbors
func (src *StateServerSource) Neighbors(
ctx context.Context,
) (*api.NeighborsResponse, error) {
@ -250,8 +250,8 @@ func (src *StateServerSource) NeighborsSummary(
return response, nil
}
// NeighborsStatus retrives the status summary
// for all neightbors
// NeighborsStatus retrieves the status summary
// for all neighbors
func (src *StateServerSource) NeighborsStatus(
ctx context.Context,
) (*api.NeighborsStatusResponse, error) {
@ -430,7 +430,7 @@ func (src *StateServerSource) RoutesFiltered(
return response, nil
}
// RoutesNotExported retrievs the routes not exported
// RoutesNotExported retrieves the routes not exported
// from the rs for a neighbor.
func (src *StateServerSource) RoutesNotExported(
ctx context.Context,
@ -447,7 +447,7 @@ func (src *StateServerSource) RoutesNotExported(
return response, nil
}
// AllRoutes retrievs the entire RIB from the source. This is never
// AllRoutes retrieves the entire RIB from the source. This is never
// cached as it is processed by the store.
func (src *StateServerSource) AllRoutes(
ctx context.Context,

View File

@ -17,7 +17,7 @@ type NeighborsBackend struct {
neighbors *sync.Map
}
// NewNeighborsBackend instanciates a new in memory
// NewNeighborsBackend instantiates a new in memory
// neighbors backend.
func NewNeighborsBackend() *NeighborsBackend {
return &NeighborsBackend{
@ -79,7 +79,7 @@ func (b *NeighborsBackend) GetNeighborsMapAt(
return result, nil
}
// CountNeighborsAt retrievs the number of neighbors
// CountNeighborsAt retrieves the number of neighbors
// at this source.
func (b *NeighborsBackend) CountNeighborsAt(
ctx context.Context,

View File

@ -112,7 +112,7 @@ func (r *RoutesBackend) FindByPrefix(
return false
}
for _, route := range rs.(api.LookupRoutes) {
// Naiive string filtering:
// Naive string filtering:
if hasPrefix && !strings.HasPrefix(strings.ToLower(route.Network), prefix) {
continue
}

View File

@ -58,7 +58,7 @@ func (m *Manager) Start(ctx context.Context) {
}
// Status retrieves the current schema version
// and checks if migrated. In case an error occures,
// and checks if migrated. In case an error occurs,
// it will be included in the result.
func (m *Manager) Status(ctx context.Context) *Status {
status := &Status{}
@ -82,7 +82,7 @@ func (m *Manager) Status(ctx context.Context) *Status {
return status
}
// Migrate applies the database intialisation script if required.
// Migrate applies the database initialization script if required.
func (m *Manager) Migrate(ctx context.Context) error {
s := m.Status(ctx)
if s.Migrated {

View File

@ -11,7 +11,7 @@ import (
)
// StartHousekeeping is a background task flushing
// memory and expireing caches.
// memory and expiring caches.
func StartHousekeeping(ctx context.Context, cfg *config.Config) {
for {

View File

@ -108,7 +108,7 @@ func (s *NeighborsStore) Start(ctx context.Context) {
}
}
// GetStatus retrievs the status for a route server
// GetStatus retrieves the status for a route server
// identified by sourceID.
func (s *NeighborsStore) GetStatus(sourceID string) (*Status, error) {
return s.sources.GetStatus(sourceID)
@ -150,7 +150,7 @@ func (s *NeighborsStore) safeUpdateSource(ctx context.Context, id string) {
}
if err := s.sources.LockSource(id); err != nil {
log.Println("Cloud not start neighbor refresh:", err)
log.Println("[neighbors store] could not start neighbor refresh:", err)
return
}
@ -165,15 +165,15 @@ func (s *NeighborsStore) safeUpdateSource(ctx context.Context, id string) {
defer func() {
if err := recover(); err != nil {
log.Println(
"Recovering after failed neighbors refresh of",
srcName, "from:", err)
"[neighbors store] recovering after failed neighbors refresh from",
srcName, "with error:", err)
s.sources.RefreshError(id, err)
}
}()
if err := s.updateSource(ctx, src, id); err != nil {
log.Println(
"Refeshing neighbors of", srcName, "failed:", err)
"[neighbors store] refreshing neighbors from", srcName, "failed:", err)
s.sources.RefreshError(id, err)
}
@ -181,7 +181,7 @@ func (s *NeighborsStore) safeUpdateSource(ctx context.Context, id string) {
if err != nil {
log.Println(err)
} else {
log.Println("Refreshed neighbors of", srcName, "in", status.LastRefreshDuration)
log.Println("[neighbors store] refreshed neighbors from", srcName, "in", status.LastRefreshDuration)
}
}
@ -332,7 +332,7 @@ func (s *NeighborsStore) Stats(
ncount, err := s.backend.CountNeighborsAt(ctx, sourceID)
if err != nil {
if !errors.Is(err, sources.ErrSourceNotFound) {
log.Println("error during neighbor count:", err)
log.Println("[neighbors store] error during neighbor count:", err)
}
}
totalNeighbors += ncount
@ -381,7 +381,7 @@ func (s *NeighborsStore) Status(ctx context.Context) *api.StoreStatus {
func (s *NeighborsStore) SourceCachedAt(sourceID string) time.Time {
status, err := s.sources.GetStatus(sourceID)
if err != nil {
log.Println("error while getting source cached at:", err)
log.Println("[neighbors store] error while getting source cached at:", err)
return time.Time{}
}
return status.LastRefresh

View File

@ -142,7 +142,7 @@ func (s *RoutesStore) safeUpdateSource(ctx context.Context, id string) {
}
if err := s.sources.LockSource(id); err != nil {
log.Println("Cloud not start routes refresh:", err)
log.Println("[routes store] could not start routes refresh:", err)
return
}
@ -153,28 +153,28 @@ func (s *RoutesStore) safeUpdateSource(ctx context.Context, id string) {
src := s.sources.Get(id)
srcName := s.sources.GetName(id)
log.Println("[routes store] begin routes refresh of:", srcName)
log.Println("[routes store] begin routes refresh from", srcName)
// Prepare for impact.
defer func() {
if err := recover(); err != nil {
log.Println(
"Recovering after failed routes refresh of",
src.Name, "from:", err)
"[routes store] recovering after failed routes refresh from",
src.Name, "with error:", err)
s.sources.RefreshError(id, err)
}
}()
if err := s.updateSource(ctx, src); err != nil {
log.Println(
"Refeshing routes of", src.Name, "failed:", err)
"[routes store] refreshing routes from", src.Name, "failed:", err)
s.sources.RefreshError(id, err)
} else {
status, err := s.sources.GetStatus(id)
if err != nil {
log.Println(err)
} else {
log.Println("Refreshed routes of", srcName, "in", status.LastRefreshDuration)
log.Println("[routes store] refreshed routes from", srcName, "in", status.LastRefreshDuration)
}
}
}
@ -194,7 +194,7 @@ func (s *RoutesStore) updateSource(
return err
}
log.Println("[routes store] finished fetching routes dump from RS", src.Name)
log.Println("[routes store] finished fetching routes dump from", src.Name)
neighbors, err := s.neighbors.GetNeighborsMapAt(ctx, src.ID)
if err != nil {
@ -203,7 +203,7 @@ func (s *RoutesStore) updateSource(
log.Println(
"[routes store] retrieved", len(res.Imported),
"accepted and", len(res.Filtered), "filtered routes for:", src.Name)
"accepted and", len(res.Filtered), "filtered routes from", src.Name)
// Prepare imported routes for lookup
srcRS := &api.LookupRouteServer{
@ -214,11 +214,11 @@ func (s *RoutesStore) updateSource(
filtered := res.Filtered.ToLookupRoutes("filtered", srcRS, neighbors)
lookupRoutes := append(imported, filtered...)
log.Println("[routes store] importing", len(lookupRoutes), "into store from", src.Name)
log.Println("[routes store] importing", len(lookupRoutes), "routes into store from", src.Name)
if err = s.backend.SetRoutes(ctx, src.ID, lookupRoutes); err != nil {
return err
}
log.Println("[routes store] import success")
log.Println("[routes store] successfully imported", len(lookupRoutes), "routes into store from", src.Name)
return s.sources.RefreshSuccess(src.ID)
}
@ -277,7 +277,7 @@ func (s *RoutesStore) Stats(ctx context.Context) *api.RoutesStoreStats {
for _, sourceID := range s.sources.GetSourceIDs() {
status, err := s.sources.GetStatus(sourceID)
if err != nil {
log.Println("error while getting source status:", err)
log.Println("[routes store] error while getting source status:", err)
continue
}
@ -285,7 +285,7 @@ func (s *RoutesStore) Stats(ctx context.Context) *api.RoutesStoreStats {
nImported, nFiltered, err := s.backend.CountRoutesAt(ctx, sourceID)
if err != nil {
if !errors.Is(err, sources.ErrSourceNotFound) {
log.Println("error during routes count:", err)
log.Println("[routes store] error during routes count:", err)
}
}

View File

@ -190,7 +190,7 @@ func (s *SourcesStore) ShouldRefresh(
}
if status.State == StateError {
// The refresh interval in the config is ok if the
// success case. When an error occures it is desirable
// success case. When an error occurs it is desirable
// to retry sooner, without spamming the server.
nextRefresh = status.LastRefresh.Add(10 * time.Second)
}
@ -202,7 +202,7 @@ func (s *SourcesStore) ShouldRefresh(
return true // Go for it
}
// CachedAt retrievs the oldest refresh time
// CachedAt retrieves the oldest refresh time
// from all sources. All data is then guaranteed to be older
// than the CachedAt date.
func (s *SourcesStore) CachedAt(ctx context.Context) time.Time {

View File

@ -14,11 +14,11 @@ func ContainsCi(s, substr string) bool {
)
}
// SerializeReasons asserts the bgp communitiy parts are
// SerializeReasons asserts the bgp community parts are
// actually strings, because there are no such things as
// integers as keys in json.
// Serialization of this is undefined behaviour, so we
// keep these interallybut provide a string as a key for
// keep these internally but provide a string as a key for
// serialization
func SerializeReasons(reasons map[int]string) map[string]string {
res := make(map[string]string)

View File

@ -76,7 +76,7 @@ const Routing = () => (
/**
* The application main entry point.
* Instanciate global providers and the router.
* Instantiate global providers and the router.
*/
const Main = () => {
return (

View File

@ -2,7 +2,7 @@
import moment from 'moment'
/**
* Render the formated 'absolute' time when given a
* Render the formatted 'absolute' time when given a
* relative timestamp (in nanoseconds).
*
* The timestamp is the duration from now to the absolute

View File

@ -1,6 +1,6 @@
/**
* Errors Component renders a stack of dismissable errors.
* Errors Component renders a stack of dismissible errors.
*/
import { FontAwesomeIcon }
from '@fortawesome/react-fontawesome';
@ -25,7 +25,7 @@ const infoFromError = (error) => {
/**
* Error renders a single dismissable error
* Error renders a single dismissible error
*/
const Error = ({error, onDismiss}) => {
const routeServers = useRouteServers();

View File

@ -116,7 +116,7 @@ const GroupSelect = ({groups, selected, onSelect}) => {
<GroupSelectOption key={group} group={group} onSelect={selectGroup} />
);
// Partition options into n coulumns with a maximum
// Partition options into n columns with a maximum
// of 10 rows per column.
const maxRows = 10;
const n = Math.ceil(options.length / maxRows);

View File

@ -19,11 +19,17 @@ const Sidebar = () => {
<div className="sidebar-header">
<div className="logo">
<Link to='/'>
<i>{/* Theme compatbility */}
<FontAwesomeIcon
className="logo-icon"
icon={faCloud} size="lg" transform="grow-11" />
</i>
<span>
<Content id="header.logo">
<i>
<FontAwesomeIcon
className="logo-icon"
icon={faCloud}
size="lg"
transform="grow-11" />
</i>
</Content>
</span>
</Link>
</div>
<div className="title">

View File

@ -262,7 +262,7 @@ const NeighborColumn = ({neighbor, column}) => {
"Description": ColDescription,
};
// For openbgpd the value is ommitted
// For openbgpd the value is omitted
if (rs.type === "openbgpd") {
widgets["routes_not_exported"] = ColNotAvailable;
}

View File

@ -30,7 +30,7 @@ const QuickLinks = () => {
const filtered = useRoutesFiltered();
const notExported = useRoutesNotExported();
const locRecevied = useMemo(() => ({...location, hash: "routes-received"}), [
const locReceived = useMemo(() => ({...location, hash: "routes-received"}), [
location,
]);
const locFiltered = useMemo(() => ({...location, hash: "routes-filtered"}), [
@ -57,7 +57,7 @@ const QuickLinks = () => {
<Link to={locFiltered}>Filtered</Link></li>}
{ showReceived &&
<li className="received">
<Link to={locRecevied}>Accepted</Link></li>}
<Link to={locReceived}>Accepted</Link></li>}
{ showNotExported &&
<li className="not-exported">
<Link to={locNotExported}>Not Exported</Link></li>}

View File

@ -10,7 +10,7 @@ import { Modal
, ModalFooter
}
from 'app/components/modal/Modal';
import BgpCommunitiyLabel
import BgpCommunityLabel
from 'app/components/routes/BgpCommunityLabel';
import { RouteAgeDetails }
from 'app/components/routes/Age';
@ -78,21 +78,21 @@ const RouteDetailsModal = () => {
<tr>
<th>Communities:</th>
<td>
{communities.map((c) => <BgpCommunitiyLabel community={c} key={communityKey(c)} />)}
{communities.map((c) => <BgpCommunityLabel community={c} key={communityKey(c)} />)}
</td>
</tr>}
{extCommunities.length > 0 &&
<tr>
<th>Ext. Communities:</th>
<td>
{extCommunities.map((c) => <BgpCommunitiyLabel community={c} key={communityKey(c)} />)}
{extCommunities.map((c) => <BgpCommunityLabel community={c} key={communityKey(c)} />)}
</td>
</tr>}
{largeCommunities.length > 0 &&
<tr>
<th>Large Communities:</th>
<td>
{largeCommunities.map((c) => <BgpCommunitiyLabel community={c} key={communityKey(c)} />)}
{largeCommunities.map((c) => <BgpCommunityLabel community={c} key={communityKey(c)} />)}
</td>
</tr>}
</tbody>

View File

@ -117,7 +117,7 @@ const RoutesNotExported = createRoutesSet(
/**
* Show a button to load routes not exported on demand.
* IF config states loading routes shoud be done automatically
* IF config states loading routes should be done automatically
* update the query parameter.
*/
const RoutesNotExportedRequest = () => {

View File

@ -63,7 +63,7 @@ const RpkiIndicator = ({route}) => {
}
// RPKI INVALID
// Depending on the configration this can either be a
// Depending on the configuration this can either be a
// single flag or a range with a given reason.
let rpkiInvalidReason = 0;
for (const invalid of rpkiInvalid) {

View File

@ -19,9 +19,9 @@ export const useErrorHandler = () => {
};
// Unfortunatley this does not really act as an error
// Unfortunately this does not really act as an error
// boundary. But we need to catch http errors from axios.
// Those are not cought using the ErrorBoundary approach.
// Those are not caught using the ErrorBoundary approach.
export const ErrorsProvider = ({children}) => {
const [errors, setErrors] = useState([]);

View File

@ -11,8 +11,8 @@ import { useQuery
/**
* usePageQuery retrievs the pagination
* query paramters and decodes the value
* usePageQuery retrieves the pagination
* query parameters and decodes the value
*/
export const usePageQuery = () => {
const [query] = useQuery({

View File

@ -207,7 +207,7 @@ const createRoutesProvider = (Context, useFetchRoutesState) => ({
/**
* RoutesReceivedProvider loads all routes recieved for a neighbor
* RoutesReceivedProvider loads all routes received for a neighbor
*/
export const RoutesReceivedProvider = createRoutesProvider(
RoutesReceivedContext,

View File

@ -61,7 +61,7 @@ const initialState = {
}
/**
* useSearchParam retrievs the query parameter
* useSearchParam retrieves the query parameter
*/
export const useSearchQuery = () => {
const [query] = useQuery({
@ -125,7 +125,7 @@ const decodeSearchResult = (result) => {
/**
* useSearchResult retrievs the url and returns the state
* useSearchResult retrieves the url and returns the state
*/
const useSearchResults = ({
query,
@ -207,7 +207,7 @@ export const SearchStatusProvider = ({children, api}) => {
/**
* RoutesSearchProvider provides routes received, filtered
* and not exportet.
* and not exported.
*/
export const RoutesSearchProvider = ({
children,