mrt

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MRT_HEADER_LEN    = 12
	BGP4MP            = 16
	BGP4MP_ET         = 17
	MESSAGE           = 1
	MESSAGE_AS4       = 4
	MESSAGE_LOCAL     = 7
	MESSAGE_AS4_LOCAL = 7
	TABLE_DUMP        = 12
	TABLE_DUMP_V2     = 13
	PEER_INDEX_TABLE  = 1
)

Variables

This section is empty.

Functions

func GetASPath

func GetASPath(mbs *MrtBufferStack) ([]uint32, error)

This will return the full AS path listed on the mbs This does no length checking, so the returned path could be empty, under very weird circumstances

func GetCollector

func GetCollector(mbs *MrtBufferStack) net.IP

This will get the collector IP that received the message from the BGP4MP header

func GetTimestamp

func GetTimestamp(mbs *MrtBufferStack) time.Time

This code just converts the 32 bit timestamp inside an MRT header and converts it to a standard go time.Time

func IsRib

func IsRib(a []byte) (bool, error)

func MrtToBGPCapture

func MrtToBGPCapture(data []byte) (*monpb.BGPCapture, error)

func MrtToBGPCapturev2

func MrtToBGPCapturev2(data []byte) (*monpb2.BGPCapture, error)

func NewBGP4MPHeaderWrapper

func NewBGP4MPHeaderWrapper(dest *pbbgp.BGP4MPHeader) *bgp4mpHeaderWrapper

func NewBgp4mpHdrBuf

func NewBgp4mpHdrBuf(buf []byte, as4 bool) *bgp4mpHdrBuf

func NewMrtHdrBuf

func NewMrtHdrBuf(buf []byte) *mrtHhdrBuf

func NewMrtHeaderWrapper

func NewMrtHeaderWrapper(m *mrtHhdrBuf) *mrtHeaderWrapper

func NewRIBMrtHdrBuf

func NewRIBMrtHdrBuf(buf []byte, index pp.PbVal) *mrtHhdrBuf

func SplitMrt

func SplitMrt(data []byte, atEOF bool) (advance int, token []byte, err error)

Types

type MrtBufferStack

type MrtBufferStack struct {
	MrthBuf   protoparse.PbVal `json:"mrt_header,omitempty"`
	Bgp4mpbuf protoparse.PbVal `json:"bgp4mp_header,omitempty"`
	Bgphbuf   protoparse.PbVal `json:"bgp_header,omitempty"`
	Bgpupbuf  protoparse.PbVal `json:"bgp_update,omitempty"`

	Ribbuf protoparse.PbVal `json:"rib_entry,omitempty"`
}

func ParseHeaders

func ParseHeaders(data []byte, ind bool) (*MrtBufferStack, error)

func ParseRibHeaders

func ParseRibHeaders(data []byte, ind protoparse.PbVal) (*MrtBufferStack, error)

func (*MrtBufferStack) GetRawMessage

func (mbs *MrtBufferStack) GetRawMessage() []byte

func (*MrtBufferStack) IsRibStack

func (mbs *MrtBufferStack) IsRibStack() bool

type Route

type Route struct {
	IP   net.IP
	Mask uint8
}

func GetAdvertizedPrefixes

func GetAdvertizedPrefixes(mbs *MrtBufferStack) ([]Route, error)

This will return a list of prefixes <"ip/mask"> that appear in advertized routes Like getASPath, this does no length checking, and may return an empty array

func GetWithdrawnPrefixes

func GetWithdrawnPrefixes(mbs *MrtBufferStack) ([]Route, error)

This will return a list of prefixes that appear in withdrawn routes

func (Route) String

func (r Route) String() string

Jump to

Keyboard shortcuts

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