Documentation ¶
Index ¶
- Constants
- Variables
- type Collector
- type DumpType
- type File
- type Finder
- type Logger
- type LoggerConfig
- type MultiFinder
- func (m *MultiFinder) AddFinder(f Finder) error
- func (m *MultiFinder) Collector(name string) (Collector, error)
- func (m *MultiFinder) Collectors(project string) ([]Collector, error)
- func (m *MultiFinder) Find(query Query) ([]File, error)
- func (m *MultiFinder) Project(name string) (Project, error)
- func (m *MultiFinder) Projects() ([]Project, error)
- type Project
- type Query
- type RISFinder
- type RouteViewsFinder
- func (f *RouteViewsFinder) Collector(name string) (Collector, error)
- func (f *RouteViewsFinder) Collectors(project string) ([]Collector, error)
- func (f *RouteViewsFinder) Find(query Query) ([]File, error)
- func (f *RouteViewsFinder) Project(name string) (Project, error)
- func (f *RouteViewsFinder) Projects() ([]Project, error)
Constants ¶
const ( RIS = "ris" RIS_ARCHIVE_URL = "https://data.ris.ripe.net/" // XXX: it's tempting, but we can't use // https://www.ris.ripe.net/peerlist/ because it only lists // currently-active collectors. RIS_COLLECTORS_URL = RIS_ARCHIVE_URL )
const ( ROUTEVIEWS = "routeviews" ROUTEVIEWS_ARCHIVE_URL = "http://archive.routeviews.org/" ROUTEVIEWS_COLLECTORS_URL = ROUTEVIEWS_ARCHIVE_URL )
Variables ¶
var ( ROUTEVIEWS_PROJECT = Project{Name: ROUTEVIEWS} // These are last-resort overrides to "fix" an out-of-pattern RV // collector name. ROUTEVIEWS_COLLECTOR_OVERRIDES = map[string][2]string{ "": {"route-views2", "rv2"}, } ROUTEVIEWS_DUMP_TYPES = map[DumpType]rvDumpType{ DUMP_TYPE_RIB: { DumpType: DUMP_TYPE_RIB, Duration: time.Hour, URL: "RIBS", Regexp: rvRIBFileRe, }, DUMP_TYPE_UPDATES: { DumpType: DUMP_TYPE_UPDATES, Duration: time.Minute * 15, URL: "UPDATES", Regexp: rvUpdatesFileRe, }, } )
var DefaultFinder = mustInitDefaultFinder()
Global finder instance that includes all the built-in finder implementations (RV and RIS for now).
If you have a custom (private) finder, you can either register it with this finder instance, or use it directly.
var (
RIS_PROJECT = Project{Name: RIS}
)
var ZeroCollector = Collector{}
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct { // Project name the collector belongs to Project Project `json:"project"` // Name of the collector Name string `json:"name"` // Project-internal name for this collector InternalName string `json:"internal_name"` }
func Collectors ¶
func GetCollector ¶
type DumpType ¶
type DumpType uint8
func DumpTypeString ¶
DumpTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func DumpTypeValues ¶
func DumpTypeValues() []DumpType
DumpTypeValues returns all values of the enum
func (DumpType) IsADumpType ¶
IsADumpType returns "true" if the value is listed in the enum definition. "false" otherwise
func (DumpType) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for DumpType
func (DumpType) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for DumpType
func (*DumpType) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for DumpType
func (*DumpType) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for DumpType
type File ¶
type File struct { // URL of the file URL string // Collector that collected this file Collector Collector // Nominal dump duration Duration time.Duration // Dump type DumpType DumpType }
Represents a single BGP file found by a Finder. TODO: better name for this. Dump is a candidate.
type Finder ¶
type Finder interface { // Get the list of projects supported by this finder Projects() ([]Project, error) // Get a specific project Project(name string) (Project, error) // Get the list of collectors supported by the given project. All // projects if unset. Collectors(project string) ([]Collector, error) // Get a specific collector by name, returns the zero collector if there // is no such collector Collector(name string) (Collector, error) // Find all the BGP data URLs that match the given query Find(query Query) ([]File, error) }
Just a sketch of what the base Finder interface might look like. Everything gets built on top of (or under, I guess) this.
type Logger ¶
func NewLogger ¶
func NewLogger(cfg LoggerConfig) (*Logger, error)
func (Logger) ModuleLogger ¶
Create a sub-logger with the given module name
type LoggerConfig ¶
type LoggerConfig struct {
LogLevel string `help:"Log level" default:"info"`
}
type MultiFinder ¶
type MultiFinder struct {
// contains filtered or unexported fields
}
Finder implementation that handles routing requests to a set of sub finder instances.
func NewMultiFinder ¶
func NewMultiFinder(finders ...Finder) (*MultiFinder, error)
func (*MultiFinder) AddFinder ¶
func (m *MultiFinder) AddFinder(f Finder) error
func (*MultiFinder) Collectors ¶
func (m *MultiFinder) Collectors(project string) ([]Collector, error)
func (*MultiFinder) Projects ¶
func (m *MultiFinder) Projects() ([]Project, error)
type Query ¶
type Query struct { // Collectors to search for. All collectors if unset/empty Collectors []Collector // Query window start time (inclusive) From time.Time // Query window end time (exclusive) Until time.Time // Dump type to search for. Any type if unset DumpType DumpType }
TODO: think about how this should work -- just keep it simple! no complex query structures
TODO: add Validate method (e.g., From is before Until, IsADumpType, etc.)
type RISFinder ¶
type RISFinder struct {
// contains filtered or unexported fields
}
func NewRISFinder ¶
func NewRISFinder() *RISFinder
type RouteViewsFinder ¶
type RouteViewsFinder struct {
// contains filtered or unexported fields
}
TODO: Finder implementation for the RouteViews archive TODO: refactor a this common caching-finder code out so that RIS and PCH can use it
func NewRouteViewsFinder ¶
func NewRouteViewsFinder() *RouteViewsFinder
func (*RouteViewsFinder) Collector ¶
func (f *RouteViewsFinder) Collector(name string) (Collector, error)
func (*RouteViewsFinder) Collectors ¶
func (f *RouteViewsFinder) Collectors(project string) ([]Collector, error)
func (*RouteViewsFinder) Projects ¶
func (f *RouteViewsFinder) Projects() ([]Project, error)