linuxcalls

package
v2.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 8 Imported by: 12 modules, 44 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// IP addresses matching any destination.
	IPv4AddrAny = "0.0.0.0"
	IPv6AddrAny = "::"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArpDetails

type ArpDetails struct {
	ARP  *linux.ARPEntry `json:"linux_arp"`
	Meta *ArpMeta        `json:"linux_arp_meta"`
}

ArpDetails is an object combining linux ARP data based on proto model with additional metadata

type ArpMeta

type ArpMeta struct {
	InterfaceIndex uint32 `json:"interface_index"`
	IPFamily       uint32 `json:"ip_family"`
	VNI            uint32 `json:"vni"`
}

ArpMeta represents linux ARP metadata

type NetLinkHandler added in v1.8.1

type NetLinkHandler struct {
	// contains filtered or unexported fields
}

NetLinkHandler is accessor for Netlink methods.

func NewNetLinkHandler

func NewNetLinkHandler(nsPlugin nsplugin.API, ifIndexes ifaceidx.LinuxIfMetadataIndex, goRoutineCount int,
	log logging.Logger) *NetLinkHandler

NewNetLinkHandler creates new instance of Netlink handler.

func (*NetLinkHandler) AddRoute

func (h *NetLinkHandler) AddRoute(route *netlink.Route) error

AddRoute creates the new static route

func (*NetLinkHandler) DelARPEntry

func (h *NetLinkHandler) DelARPEntry(arpEntry *netlink.Neigh) error

DelARPEntry removes an static ARP entry

func (*NetLinkHandler) DelRoute

func (h *NetLinkHandler) DelRoute(route *netlink.Route) error

DelRoute removes the static route

func (*NetLinkHandler) DumpARPEntries

func (h *NetLinkHandler) DumpARPEntries() ([]*ArpDetails, error)

DumpARPEntries reads all ARP entries and returns them as details with proto-modeled ARP data and additional metadata

func (*NetLinkHandler) DumpRoutes added in v1.8.1

func (h *NetLinkHandler) DumpRoutes() ([]*RouteDetails, error)

DumpRoutes reads all route entries and returns them as details with proto-modeled route data and additional metadata

func (*NetLinkHandler) GetARPEntries

func (h *NetLinkHandler) GetARPEntries(interfaceIdx int) ([]netlink.Neigh, error)

GetARPEntries reads all configured static ARP entries for given interface. <interfaceIdx> works as filter, if set to zero, all arp entries in the namespace are returned

func (*NetLinkHandler) GetRoutes

func (h *NetLinkHandler) GetRoutes(interfaceIdx int) (v4Routes, v6Routes []netlink.Route, err error)

GetRoutes reads all configured static routes with the given outgoing interface. <interfaceIdx> works as filter, if set to zero, all routes in the namespace are returned.

func (*NetLinkHandler) ReplaceRoute

func (h *NetLinkHandler) ReplaceRoute(route *netlink.Route) error

ReplaceRoute removes the static route

func (*NetLinkHandler) SetARPEntry

func (h *NetLinkHandler) SetARPEntry(arpEntry *netlink.Neigh) error

SetARPEntry updates existing arp entry

type NetlinkAPI

type NetlinkAPI interface {
	NetlinkAPIWrite
	NetlinkAPIRead
}

NetlinkAPI interface covers all methods inside linux calls package needed to manage linux ARP entries and routes.

type NetlinkAPIRead added in v1.8.1

type NetlinkAPIRead interface {
	// GetARPEntries reads all configured static ARP entries for given interface.
	// <interfaceIdx> works as filter, if set to zero, all arp entries in the namespace
	// are returned.
	GetARPEntries(interfaceIdx int) ([]netlink.Neigh, error)

	// DumpARPEntries reads all ARP entries and returns them as details
	// with proto-modeled ARP data and additional metadata
	DumpARPEntries() ([]*ArpDetails, error)

	// GetRoutes reads all configured static routes with the given outgoing
	// interface.
	// <interfaceIdx> works as filter, if set to zero, all routes in the namespace
	// are returned.
	GetRoutes(interfaceIdx int) (v4Routes, v6Routes []netlink.Route, err error)

	// DumpRoutes reads all route entries and returns them as details
	// with proto-modeled route data and additional metadata
	DumpRoutes() ([]*RouteDetails, error)
}

NetlinkAPIRead interface covers read methods inside linux calls package needed to manage linux ARP entries and routes.

type NetlinkAPIWrite added in v1.8.1

type NetlinkAPIWrite interface {
	/* ARP */
	// SetARPEntry adds/modifies existing linux ARP entry.
	SetARPEntry(arpEntry *netlink.Neigh) error
	// DelARPEntry removes linux ARP entry.
	DelARPEntry(arpEntry *netlink.Neigh) error

	/* Routes */
	// AddRoute adds new linux static route.
	AddRoute(route *netlink.Route) error
	// ReplaceRoute changes existing linux static route.
	ReplaceRoute(route *netlink.Route) error
	// DelRoute removes linux static route.
	DelRoute(route *netlink.Route) error
}

NetlinkAPIWrite interface covers write methods inside linux calls package needed to manage linux ARP entries and routes.

type RouteDetails

type RouteDetails struct {
	Route *linux.Route
	Meta  *RouteMeta
}

RouteDetails is an object combining linux route data based on proto model with additional metadata

type RouteMeta

type RouteMeta struct {
	InterfaceIndex uint32        `json:"interface_index"`
	NetlinkScope   netlink.Scope `json:"link_scope"`
	Protocol       uint32        `json:"protocol"`
	MTU            uint32        `json:"mtu"`
}

RouteMeta represents linux Route metadata

Jump to

Keyboard shortcuts

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