ip

package
v6.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const FamilyV4 = "-4"

FamilyV4 represents IPv4 protocol family.

View Source
const FamilyV6 = "-6"

FamilyV6 represents IPv6 protocol family.

View Source
const NeighbourIPStateDelay = "DELAY"

NeighbourIPStateDelay neighbor entry validation is currently delayed.

View Source
const NeighbourIPStateFailed = "FAILED"

NeighbourIPStateFailed max number of probes exceeded without success, neighbor validation has ultimately failed.

View Source
const NeighbourIPStateIncomplete = "INCOMPLETE"

NeighbourIPStateIncomplete the neighbour entry has not (yet) been validated/resolved.

View Source
const NeighbourIPStateNoARP = "NOARP"

NeighbourIPStateNoARP the neighbour entry is valid. No attempts to validate this entry will be made but it can be removed when its lifetime expires.

View Source
const NeighbourIPStateNone = "NONE"

NeighbourIPStateNone this is a pseudo state used when initially creating a neighbour entry or after trying to remove it before it becomes free to do so.

View Source
const NeighbourIPStatePermanent = "PERMANENT"

NeighbourIPStatePermanent the neighbour entry is valid forever and can be only be removed administratively.

View Source
const NeighbourIPStateProbe = "PROBE"

NeighbourIPStateProbe neighbor is being probed.

View Source
const NeighbourIPStateReachable = "REACHABLE"

NeighbourIPStateReachable the neighbour entry is valid until the reachability timeout expires.

View Source
const NeighbourIPStateStale = "STALE"

NeighbourIPStateStale the neighbour entry is valid but suspicious.

Variables

This section is empty.

Functions

func DeleteVDPADevice

func DeleteVDPADevice(vDPADevName string) error

DeleteVDPADevice deletes a vDPA management device.

Types

type Action

type Action interface {
	AddAction() []string
}

Action represents an action in filter.

type ActionPolice

type ActionPolice struct {
	Rate  string
	Burst string
	Mtu   string
	Drop  bool
}

ActionPolice represents an action of 'police' type.

func (*ActionPolice) AddAction

func (a *ActionPolice) AddAction() []string

AddAction generates a part of command specific for 'police' action.

type Addr

type Addr struct {
	DevName string
	Address string
	Scope   string
	Family  string
}

Addr represents arguments for address protocol manipulation.

func (*Addr) Add

func (a *Addr) Add() error

Add adds new protocol address.

func (*Addr) Flush

func (a *Addr) Flush() error

Flush flushes protocol addresses.

type Bridge

type Bridge struct {
	Link
}

Bridge represents arguments for link device of type bridge.

func (*Bridge) Add

func (b *Bridge) Add() error

Add adds new virtual link.

type Class

type Class struct {
	Dev     string
	Parent  string
	Classid string
}

Class represents qdisc class object.

type ClassHTB

type ClassHTB struct {
	Class
	Rate string
}

ClassHTB represents htb qdisc class object.

func (*ClassHTB) Add

func (class *ClassHTB) Add() error

Add adds class to a node.

type Dummy

type Dummy struct {
	Link
}

Dummy represents arguments for link device of type dummy.

func (*Dummy) Add

func (d *Dummy) Add() error

Add adds new virtual link.

type Filter

type Filter struct {
	Dev      string
	Parent   string
	Protocol string
	Flowid   string
}

Filter represents filter object.

type Gretap

type Gretap struct {
	Link
	Local  string
	Remote string
}

Gretap represents arguments for link of type gretap.

func (*Gretap) Add

func (g *Gretap) Add() error

Add adds new virtual link.

type Link struct {
	Name          string
	MTU           uint32
	Parent        string
	Address       net.HardwareAddr
	TXQueueLength uint32
	AllMutlicast  bool
	Master        string
	Up            bool
}

Link represents base arguments for link device.

func (*Link) BridgeLinkSetHairpin

func (l *Link) BridgeLinkSetHairpin(hairpin bool) error

BridgeLinkSetHairpin sets bridge 'hairpin' attribute on a port.

func (*Link) BridgeLinkSetIsolated

func (l *Link) BridgeLinkSetIsolated(isolated bool) error

BridgeLinkSetIsolated sets bridge 'isolated' attribute on a port.

func (*Link) BridgeVLANAdd

func (l *Link) BridgeVLANAdd(vid string, pvid bool, untagged bool, self bool) error

BridgeVLANAdd adds a new vlan filter entry.

func (*Link) BridgeVLANDelete

func (l *Link) BridgeVLANDelete(vid string, self bool) error

BridgeVLANDelete removes an existing vlan filter entry.

func (*Link) Delete

func (l *Link) Delete() error

Delete deletes the link device.

func (*Link) GetVFInfo

func (l *Link) GetVFInfo(vfID int) (VirtFuncInfo, error)

GetVFInfo returns info about virtual function.

func (*Link) SetAddress

func (l *Link) SetAddress(address net.HardwareAddr) error

SetAddress sets the address of the link device.

func (*Link) SetAllMulticast

func (l *Link) SetAllMulticast(enabled bool) error

SetAllMulticast when enabled instructs network driver to retrieve all multicast packets from the network to the kernel for further processing.

func (*Link) SetDown

func (l *Link) SetDown() error

SetDown disables the link device.

func (*Link) SetMTU

func (l *Link) SetMTU(mtu uint32) error

SetMTU sets the MTU of the link device.

func (*Link) SetMaster

func (l *Link) SetMaster(master string) error

SetMaster sets the master of the link device.

func (*Link) SetName

func (l *Link) SetName(newName string) error

SetName sets the name of the link device.

func (*Link) SetNetns

func (l *Link) SetNetns(netns string) error

SetNetns moves the link to the selected network namespace.

func (*Link) SetNoMaster

func (l *Link) SetNoMaster() error

SetNoMaster removes the master of the link device.

func (*Link) SetTXQueueLength

func (l *Link) SetTXQueueLength(queueLength uint32) error

SetTXQueueLength sets the txqueuelen of the link device.

func (*Link) SetUp

func (l *Link) SetUp() error

SetUp enables the link device.

func (*Link) SetVfAddress

func (l *Link) SetVfAddress(vf string, address string) error

SetVfAddress changes the address for the specified vf.

func (*Link) SetVfSpoofchk

func (l *Link) SetVfSpoofchk(vf string, mode string) error

SetVfSpoofchk turns packet spoof checking on or off for the specified VF.

func (*Link) SetVfVlan

func (l *Link) SetVfVlan(vf string, vlan string) error

SetVfVlan changes the assigned VLAN for the specified vf.

type LinkInfo

type LinkInfo struct {
	InterfaceName    string `json:"ifname"`
	Link             string `json:"link"`
	Master           string `json:"master"`
	Address          string `json:"address"`
	TXQueueLength    uint32 `json:"txqlen"`
	MTU              uint32 `json:"mtu"`
	OperationalState string `json:"operstate"`
	Info             struct {
		Kind      string `json:"info_kind"`
		SlaveKind string `json:"info_slave_kind"`
		Data      struct {
			Protocol string `json:"protocol"`
			ID       int    `json:"id"`
		} `json:"info_data"`
	} `json:"linkinfo"`
}

LinkInfo represents the IP link details.

func GetLinkInfoByName

func GetLinkInfoByName(name string) (LinkInfo, error)

GetLinkInfoByName returns the detailed information for the given link.

type Macvlan

type Macvlan struct {
	Link
	Mode string
}

Macvlan represents arguments for link of type macvlan.

func (*Macvlan) Add

func (macvlan *Macvlan) Add() error

Add adds new virtual link.

type Macvtap

type Macvtap struct {
	Macvlan
}

Macvtap represents arguments for link of type macvtap.

func (*Macvtap) Add

func (macvtap *Macvtap) Add() error

Add adds new virtual link.

type MgmtVDPADev

type MgmtVDPADev struct {
	BusName string // e.g. "pci"
	DevName string // e.g. "0000:00:08.2"
}

MgmtVDPADev represents the vDPA management device information.

func ListVDPAMgmtDevices

func ListVDPAMgmtDevices() ([]*MgmtVDPADev, error)

ListVDPAMgmtDevices returns the list of all vDPA management devices.

type Neigh

type Neigh struct {
	DevName string
	Addr    net.IP
	MAC     net.HardwareAddr
	State   NeighbourIPState
}

Neigh represents arguments for neighbour manipulation.

func (*Neigh) Show

func (n *Neigh) Show() ([]Neigh, error)

Show list neighbour entries filtered by DevName and optionally MAC address.

type NeighProxy

type NeighProxy struct {
	DevName string
	Addr    net.IP
}

NeighProxy represents arguments for neighbour proxy manipulation.

func (*NeighProxy) Add

func (n *NeighProxy) Add() error

Add a neighbour proxy entry.

func (*NeighProxy) Delete

func (n *NeighProxy) Delete() error

Delete a neighbour proxy entry.

func (*NeighProxy) Show

func (n *NeighProxy) Show() ([]NeighProxy, error)

Show list neighbour proxy entries.

type NeighbourIPState

type NeighbourIPState string

NeighbourIPState can be { PERMANENT | NOARP | REACHABLE | STALE | NONE | INCOMPLETE | DELAY | PROBE | FAILED }.

type Qdisc

type Qdisc struct {
	Dev     string
	Handle  string
	Root    bool
	Ingress bool
}

Qdisc represents 'queueing discipline' object.

func (*Qdisc) Add

func (qdisc *Qdisc) Add() error

Add adds qdisc to a node.

func (*Qdisc) Delete

func (qdisc *Qdisc) Delete() error

Delete deletes qdisc from node.

type QdiscHTB

type QdiscHTB struct {
	Qdisc
	Default string
}

QdiscHTB represents the hierarchy token bucket qdisc object.

func (*QdiscHTB) Add

func (qdisc *QdiscHTB) Add() error

Add adds qdisc to a node.

type Route

type Route struct {
	DevName string
	Route   string
	Table   string
	Src     string
	Proto   string
	Family  string
	Via     string
}

Route represents arguments for route manipulation.

func (*Route) Add

func (r *Route) Add() error

Add adds new route.

func (*Route) Delete

func (r *Route) Delete() error

Delete deletes routing table.

func (*Route) Flush

func (r *Route) Flush() error

Flush flushes routing tables.

func (*Route) Replace

func (r *Route) Replace(routes []string) error

Replace changes or adds new route.

func (*Route) Show

func (r *Route) Show() ([]string, error)

Show lists routes.

type Tuntap

type Tuntap struct {
	Name       string
	Mode       string
	MultiQueue bool
}

Tuntap represents arguments for tuntap manipulation.

func (*Tuntap) Add

func (t *Tuntap) Add() error

Add adds new tuntap interface.

type U32Filter

type U32Filter struct {
	Filter
	Value   string
	Mask    string
	Actions []Action
}

U32Filter represents universal 32bit traffic control filter.

func (*U32Filter) Add

func (u32 *U32Filter) Add() error

Add adds universal 32bit traffic control filter to a node.

type VDPADev

type VDPADev struct {
	// Name of the vDPA created device. e.g. "vdpa0" (note: the iproute2 associated command would look like `vdpa dev add mgmtdev pci/<PCI_SLOT_NAME> name vdpa0 max_vqp <MAX_VQP>`).
	Name string
	// Max VQs supported by the vDPA device.
	MaxVQs uint32
	// Associated vDPA management device.
	MgmtDev *MgmtVDPADev
	// Associated vhost-vdpa device.
	VhostVDPA *VhostVDPA
}

VDPADev represents the vDPA device information.

func AddVDPADevice

func AddVDPADevice(pciDevSlotName string, volatile map[string]string) (*VDPADev, error)

AddVDPADevice adds a new vDPA device.

func ListVDPADevices

func ListVDPADevices() ([]*VDPADev, error)

ListVDPADevices returns the list of all vDPA devices.

type Veth

type Veth struct {
	Link
	Peer Link
}

Veth represents arguments for link of type veth.

func (*Veth) Add

func (veth *Veth) Add() error

Add adds new virtual link.

type VhostVDPA

type VhostVDPA struct {
	Name string
	Path string
}

VhostVdpa is the vhost-vdpa device information.

type VirtFuncInfo

type VirtFuncInfo struct {
	VF         int              `json:"vf"`
	Address    string           `json:"address"`
	MAC        string           `json:"mac"` // Deprecated
	VLANs      []map[string]int `json:"vlan_list"`
	SpoofCheck bool             `json:"spoofchk"`
}

VirtFuncInfo holds information about vf.

type Vlan

type Vlan struct {
	Link
	VlanID string
	Gvrp   bool
}

Vlan represents arguments for link of type vlan.

func (*Vlan) Add

func (vlan *Vlan) Add() error

Add adds new virtual link.

type Vxlan

type Vxlan struct {
	Link
	VxlanID string
	DevName string
	Local   string
	Remote  string
	Group   string
	DstPort string
	TTL     string
}

Vxlan represents arguments for link of type vxlan.

func (*Vxlan) Add

func (vxlan *Vxlan) Add() error

Add adds new virtual link.

Jump to

Keyboard shortcuts

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