routeview

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0 Imports: 12 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 []NetIndex

Index is searchable array of NetIndexes.

func ParseRouteView

func ParseRouteView(file []byte) Index

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

func (Index) Search

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

Search attempts to find the given IP in the Index.

type NetIndex added in v0.5.0

type NetIndex []IPNet

NetIndex is a sortable and searchable array of IPNets.

func (NetIndex) Len added in v0.5.0

func (ns NetIndex) Len() int

Len, Less, and Swap make Index sortable.

func (NetIndex) Less added in v0.5.0

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

func (NetIndex) Swap added in v0.5.0

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

Jump to

Keyboard shortcuts

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