fixed spelling errors
This commit is contained in:
parent
5bb0d0aaf2
commit
9064364325
@ -31,7 +31,7 @@ type Neighbor struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// String encodes a neighbor as json. This is
|
// String encodes a neighbor as json. This is
|
||||||
// more readable than the golang default represenation.
|
// more readable than the golang default representation.
|
||||||
func (n *Neighbor) String() string {
|
func (n *Neighbor) String() string {
|
||||||
repr, _ := json.Marshal(n)
|
repr, _ := json.Marshal(n)
|
||||||
return string(repr)
|
return string(repr)
|
||||||
|
@ -102,7 +102,7 @@ type RoutesResponse struct {
|
|||||||
NotExported Routes `json:"not_exported"`
|
NotExported Routes `json:"not_exported"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CacheTTL returns the cache ttl of the reponse
|
// CacheTTL returns the cache ttl of the response
|
||||||
func (res *RoutesResponse) CacheTTL() time.Duration {
|
func (res *RoutesResponse) CacheTTL() time.Duration {
|
||||||
now := time.Now().UTC()
|
now := time.Now().UTC()
|
||||||
return res.Response.Meta.TTL.Sub(now)
|
return res.Response.Meta.TTL.Sub(now)
|
||||||
@ -113,7 +113,7 @@ type TimedResponse struct {
|
|||||||
RequestDuration float64 `json:"request_duration_ms"`
|
RequestDuration float64 `json:"request_duration_ms"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pagination strucutres information about the
|
// Pagination information, including the
|
||||||
// current page, total pages, page size, etc...
|
// current page, total pages, page size, etc...
|
||||||
type Pagination struct {
|
type Pagination struct {
|
||||||
Page int `json:"page"`
|
Page int `json:"page"`
|
||||||
|
@ -177,7 +177,7 @@ func (g *SearchFilterGroup) rebuildIndex() {
|
|||||||
g.filtersIdx = idx // replace index
|
g.filtersIdx = idx // replace index
|
||||||
}
|
}
|
||||||
|
|
||||||
// A SearchFilterComparator comapres route with a filter
|
// A SearchFilterComparator compares route with a filter
|
||||||
type SearchFilterComparator func(route Filterable, value interface{}) bool
|
type SearchFilterComparator func(route Filterable, value interface{}) bool
|
||||||
|
|
||||||
func searchFilterMatchSource(route Filterable, value interface{}) bool {
|
func searchFilterMatchSource(route Filterable, value interface{}) bool {
|
||||||
@ -351,7 +351,7 @@ func (s *SearchFilters) GetGroupByKey(key string) *SearchFilterGroup {
|
|||||||
// and its counters.
|
// and its counters.
|
||||||
//
|
//
|
||||||
// Update filter struct to include route:
|
// Update filter struct to include route:
|
||||||
// - Extract ASN, source, bgp communites,
|
// - Extract ASN, source, bgp communities,
|
||||||
// - Find Filter in group, increment result count if required.
|
// - Find Filter in group, increment result count if required.
|
||||||
func (s *SearchFilters) UpdateFromLookupRoute(r *LookupRoute) {
|
func (s *SearchFilters) UpdateFromLookupRoute(r *LookupRoute) {
|
||||||
// Add source
|
// Add source
|
||||||
|
@ -36,7 +36,7 @@ func StringList(data interface{}) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TrimmedCSVStringList makes a trimmed list of CSV strings
|
// TrimmedCSVStringList makes a trimmed list of CSV strings
|
||||||
// ommitting empty values.
|
// omitting empty values.
|
||||||
func TrimmedCSVStringList(s string) []string {
|
func TrimmedCSVStringList(s string) []string {
|
||||||
tokens := strings.Split(s, ",")
|
tokens := strings.Split(s, ",")
|
||||||
list := []string{}
|
list := []string{}
|
||||||
|
@ -39,7 +39,7 @@ type apiEndpoint func(
|
|||||||
httprouter.Params,
|
httprouter.Params,
|
||||||
) (response, error)
|
) (response, error)
|
||||||
|
|
||||||
// Wrap handler for access controll, throtteling and compression
|
// Wrap handler for access control, throtteling and compression
|
||||||
func endpoint(wrapped apiEndpoint) httprouter.Handle {
|
func endpoint(wrapped apiEndpoint) httprouter.Handle {
|
||||||
return func(res http.ResponseWriter,
|
return func(res http.ResponseWriter,
|
||||||
req *http.Request,
|
req *http.Request,
|
||||||
|
@ -38,7 +38,7 @@ func NewErrAmbigousParam(key string) *ErrValidationFailed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewErrEmptyParam return an ErrValidationFailed if the
|
// NewErrEmptyParam return an ErrValidationFailed if the
|
||||||
// provided paramter value is empty.
|
// provided parameter value is empty.
|
||||||
func NewErrEmptyParam(key string) *ErrValidationFailed {
|
func NewErrEmptyParam(key string) *ErrValidationFailed {
|
||||||
return &ErrValidationFailed{
|
return &ErrValidationFailed{
|
||||||
Param: key,
|
Param: key,
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestApiLogSourceError(t *testing.T) {
|
func TestApiLogSourceError(t *testing.T) {
|
||||||
err := fmt.Errorf("an unexpected error occured")
|
err := fmt.Errorf("an unexpected error occurred")
|
||||||
|
|
||||||
cfg := &config.Config{
|
cfg := &config.Config{
|
||||||
Sources: []*config.SourceConfig{
|
Sources: []*config.SourceConfig{
|
||||||
|
@ -153,9 +153,6 @@ func (b *GenericBirdwatcher) filterRoutesByDuplicates(
|
|||||||
// Remove routes from "routes" that are contained within filterRoutes
|
// Remove routes from "routes" that are contained within filterRoutes
|
||||||
for _, filterRoute := range filterRoutes {
|
for _, filterRoute := range filterRoutes {
|
||||||
delete(routesMap, filterRoute.ID)
|
delete(routesMap, filterRoute.ID)
|
||||||
// in theorey this guard is unneccessary
|
|
||||||
//if _, ok := routesMap[filterRoute.ID]; ok {
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, route := range routesMap {
|
for _, route := range routesMap {
|
||||||
|
@ -160,9 +160,9 @@ func TestLookupPrefixForNeighbors(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// We should have retrived 8 prefixes,
|
// We should have retrieved 8 prefixes,
|
||||||
if len(results) != 8 {
|
if len(results) != 8 {
|
||||||
t.Error("Expected result lenght: 8, got:", len(results))
|
t.Error("Expected result length: 8, got:", len(results))
|
||||||
}
|
}
|
||||||
|
|
||||||
presence := []string{
|
presence := []string{
|
||||||
|
@ -141,7 +141,7 @@ func (s *SourcesStore) getStatus(sourceID string) (*Status, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IsInitialized will retrieve the status of the source
|
// IsInitialized will retrieve the status of the source
|
||||||
// and check if a successful refresh happend at least
|
// and check if a successful refresh happened at least
|
||||||
// once.
|
// once.
|
||||||
func (s *SourcesStore) IsInitialized(sourceID string) (bool, error) {
|
func (s *SourcesStore) IsInitialized(sourceID string) (bool, error) {
|
||||||
s.Lock()
|
s.Lock()
|
||||||
@ -190,7 +190,7 @@ func (s *SourcesStore) ShouldRefresh(
|
|||||||
}
|
}
|
||||||
if status.State == StateError {
|
if status.State == StateError {
|
||||||
// The refresh interval in the config is ok if the
|
// The refresh interval in the config is ok if the
|
||||||
// success case. When an error occures it is desireable
|
// success case. When an error occures it is desirable
|
||||||
// to retry sooner, without spamming the server.
|
// to retry sooner, without spamming the server.
|
||||||
nextRefresh = status.LastRefresh.Add(10 * time.Second)
|
nextRefresh = status.LastRefresh.Add(10 * time.Second)
|
||||||
}
|
}
|
||||||
@ -303,7 +303,7 @@ func (s *SourcesStore) LockSource(sourceID string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RefreshSuccess indicates a successfull update
|
// RefreshSuccess indicates a successful update
|
||||||
// of the store's content.
|
// of the store's content.
|
||||||
func (s *SourcesStore) RefreshSuccess(sourceID string) error {
|
func (s *SourcesStore) RefreshSuccess(sourceID string) error {
|
||||||
s.Lock()
|
s.Lock()
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
func TestContainsCi(t *testing.T) {
|
func TestContainsCi(t *testing.T) {
|
||||||
if ContainsCi("foo bar", "BaR") != true {
|
if ContainsCi("foo bar", "BaR") != true {
|
||||||
t.Error("An unexpected error occured.")
|
t.Error("An unexpected error occurred.")
|
||||||
}
|
}
|
||||||
if ContainsCi("Luxembourg Online SA", "Goo") == true {
|
if ContainsCi("Luxembourg Online SA", "Goo") == true {
|
||||||
t.Error("Should ne no match")
|
t.Error("Should ne no match")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user