routeview

package
v0.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoASNFound = errors.New("No ASN found for address")

ErrNoASNFound is returned when search fails to identify a network for the given src IP.

Functions

func ParseSystems

func ParseSystems(s string) []annotator.System

ParseSystems converts the RouteView AS string to an annotator.System array. Invalid values are ignored.

RouteViews may contain: * a single AS number, e.g. "32", one System with one ASN * an AS set, e.g. "32,54", one System with multiple ASNs * a Multi-Origin AS (MOAS), e.g. "10_20", two Systems each with one or more ASNs.

Types

type IPNet

type IPNet struct {
	net.IPNet
	Systems string
}

IPNet represents a parsed row in a RouteView file.

type Index

type Index []IPNet

Index is a sortable (and searchable) array of IPNets.

func ParseRouteView

func ParseRouteView(file []byte) Index

ParseRouteView reads the given csv file and generates a sorted IP list.

func (Index) Len

func (ns Index) Len() int

Len, Less, and Swap make Index sortable.

func (Index) Less

func (ns Index) Less(i, j int) bool

func (Index) Search

func (ns Index) Search(s string) (IPNet, error)

Search attempts to find the given IP in the Index.

func (Index) Swap

func (ns Index) Swap(i, j int)

Jump to

Keyboard shortcuts

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