netlink

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: Apache-2.0 Imports: 23 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// IPv4DefaultRoute default IPv4 route
	IPv4DefaultRoute = net.IPNet{IP: net.IPv4zero, Mask: net.CIDRMask(0, 8*net.IPv4len)}

	// IPv6DefaultRoute default IPv6 route
	IPv6DefaultRoute = net.IPNet{IP: net.IPv6zero, Mask: net.CIDRMask(0, 8*net.IPv6len)}
)

Functions

func NeighborMetadataDecoder added in v0.21.0

func NeighborMetadataDecoder(raw json.RawMessage) (common.Getter, error)

NeighborMetadataDecoder implements a json message raw decoder

func RoutingTablesMetadataDecoder added in v0.21.0

func RoutingTablesMetadataDecoder(raw json.RawMessage) (common.Getter, error)

RoutingTablesMetadataDecoder implements a json message raw decoder

Types

type Neighbor added in v0.19.0

type Neighbor struct {
	Flags   []string `json:"Flags,omitempty"`
	MAC     string
	IP      net.IP   `json:"IP,omitempty"`
	State   []string `json:"State,omitempty"`
	Vlan    int64    `json:"Vlan,omitempty"`
	VNI     int64    `json:"VNI,omitempty"`
	IfIndex int64
}

Neighbor describes a member of the forwarding database easyjson:json

type Neighbors added in v0.21.0

type Neighbors []*Neighbor

Neighbors describes a list of neighbors easyjson:json

func (*Neighbors) GetField added in v0.21.0

func (nbs *Neighbors) GetField(field string) (interface{}, error)

GetField implements Getter interface

func (*Neighbors) GetFieldInt64 added in v0.21.0

func (nbs *Neighbors) GetFieldInt64(key string) (int64, error)

GetFieldInt64 implements Getter interface

func (*Neighbors) GetFieldKeys added in v0.21.0

func (nbs *Neighbors) GetFieldKeys() []string

GetFieldKeys returns the list of valid field of a Flow

func (*Neighbors) GetFieldString added in v0.21.0

func (nbs *Neighbors) GetFieldString(key string) (string, error)

GetFieldString implements Getter interface

type NetNsProbe added in v0.21.0

type NetNsProbe struct {
	common.RWMutex
	Graph  *graph.Graph
	Root   *graph.Node
	NsPath string
	// contains filtered or unexported fields
}

NetNsProbe describes a topology probe based on netlink in a network namespace

type NextHop

type NextHop struct {
	Priority int64  `json:"Priority"`
	IP       net.IP `json:"IP,omitempty"`
	IfIndex  int64  `json:"IfIndex"`
}

NextHop describes a next hop easyjson:json

type Prefix added in v0.21.0

type Prefix struct {
	net.IPNet
}

Prefix describes prefix

func (*Prefix) IsDefaultRoute added in v0.21.0

func (p *Prefix) IsDefaultRoute() bool

IsDefaultRoute return whether the given cidr is a default route

func (*Prefix) MarshalJSON added in v0.21.0

func (p *Prefix) MarshalJSON() ([]byte, error)

MarshalJSON custom marshal function

func (*Prefix) UnmarshalJSON added in v0.21.0

func (p *Prefix) UnmarshalJSON(b []byte) error

UnmarshalJSON custom unmarshal function

type Probe added in v0.21.0

type Probe struct {
	common.RWMutex
	Graph *graph.Graph
	// contains filtered or unexported fields
}

Probe describes a list NetLink NameSpace probe to enhance the graph

func NewProbe added in v0.21.0

func NewProbe(g *graph.Graph, hostNode *graph.Node) (*Probe, error)

NewProbe creates a new netlink probe

func (*Probe) Register added in v0.21.0

func (u *Probe) Register(nsPath string, root *graph.Node) (*NetNsProbe, error)

Register a new network netlink/namespace probe in the graph

func (*Probe) Start added in v0.21.0

func (u *Probe) Start()

Start the probe

func (*Probe) Stop added in v0.21.0

func (u *Probe) Stop()

Stop the probe

func (*Probe) Unregister added in v0.21.0

func (u *Probe) Unregister(nsPath string) error

Unregister a probe from a network namespace

type Route

type Route struct {
	Protocol int64      `json:"Protocol"`
	Prefix   Prefix     `json:"Prefix"`
	NextHops []*NextHop `json:"NextHops"`
}

Route describes a route easyjson:json

func (*Route) GetNextHop added in v0.21.0

func (r *Route) GetNextHop(ip net.IP, ifIndex int64) *NextHop

GetNextHop returns the nexthop for the given ip and ifindex

func (*Route) GetOrCreateNextHop added in v0.21.0

func (r *Route) GetOrCreateNextHop(ip net.IP, ifIndex int64, priority int64) *NextHop

GetOrCreateNextHop creates if not existing a new nexthop and returns it

type RoutingTable

type RoutingTable struct {
	ID     int64    `json:"ID"`
	Src    net.IP   `json:"Src"`
	Routes []*Route `json:"Routes"`
}

RoutingTable describes a list of Routes easyjson:json

func (*RoutingTable) GetOrCreateRoute added in v0.21.0

func (rt *RoutingTable) GetOrCreateRoute(protocol int64, prefix net.IPNet) *Route

GetOrCreateRoute creates if not existing a new route and returns it

func (*RoutingTable) GetRoute added in v0.21.0

func (rt *RoutingTable) GetRoute(protocol int64, prefix net.IPNet) *Route

GetRoute returns route for the given protocol and prefix

type RoutingTables added in v0.21.0

type RoutingTables []*RoutingTable

RoutingTables describes a list of routing table easyjson:json

func (*RoutingTables) GetField added in v0.21.0

func (rts *RoutingTables) GetField(field string) (interface{}, error)

GetField implements Getter interface

func (*RoutingTables) GetFieldInt64 added in v0.21.0

func (rts *RoutingTables) GetFieldInt64(key string) (int64, error)

GetFieldInt64 implements Getter interface

func (*RoutingTables) GetFieldKeys added in v0.21.0

func (rts *RoutingTables) GetFieldKeys() []string

GetFieldKeys returns the list of valid field of a Flow

func (*RoutingTables) GetFieldString added in v0.21.0

func (rts *RoutingTables) GetFieldString(key string) (string, error)

GetFieldString implements Getter interface

Jump to

Keyboard shortcuts

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