kernel

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 20 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIndexFromName

func GetIndexFromName(name string) (int, error)

GetIndexFromName - Get the index of an interface from its name

Types

type Bridge

type Bridge struct {
	Interface
	// contains filtered or unexported fields
}

func NewBridge

func NewBridge(name string) (*Bridge, error)

func (*Bridge) Delete

func (b *Bridge) Delete() error

func (*Bridge) InterfaceIsLinked added in v1.0.14

func (b *Bridge) InterfaceIsLinked(intf networking.Iface) bool

func (*Bridge) LinkInterface

func (b *Bridge) LinkInterface(intf networking.Iface) error

LinkInterface set the bridge as master of another interface

TODO: InterfaceIsLinked() relies on DeepEqual, thus the same interface might be added multiple times to linkedInterfaces.

func (*Bridge) UnLinkInterface

func (b *Bridge) UnLinkInterface(intf networking.Iface) error

type FWMarkRoute

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

FWMarkRoute -

func NewFWMarkRoute

func NewFWMarkRoute(ip string, fwmark int, tableID int) (*FWMarkRoute, error)

NewFWMarkRoute -

func (*FWMarkRoute) Delete

func (fwmr *FWMarkRoute) Delete() error

Delete -

func (*FWMarkRoute) Verify

func (fwmr *FWMarkRoute) Verify() bool

type FWMarkRouteError added in v1.0.16

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

FWMarkRouteError represents an error occurred during FWMarkRoute route operation

func (*FWMarkRouteError) Error added in v1.0.16

func (e *FWMarkRouteError) Error() string

type FWMarkRouteRuleError added in v1.0.16

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

FWMarkRouteRuleError represents an error occurred during FWMarkRoute rule operation

func (*FWMarkRouteRuleError) Error added in v1.0.16

func (e *FWMarkRouteRuleError) Error() string

type Interface

type Interface struct {
	Name          string
	LocalIPs      []string
	NeighborIPs   []string
	Gateways      []string
	InterfaceType networking.InterfaceType
	// contains filtered or unexported fields
}

func NewInterface

func NewInterface(index int, options ...InterfaceOption) *Interface

func (*Interface) AddLocalPrefix

func (intf *Interface) AddLocalPrefix(prefix string) error

func (*Interface) Equals

func (intf *Interface) Equals(iface networking.Iface) bool

func (*Interface) GetGatewayPrefixes

func (intf *Interface) GetGatewayPrefixes() []string

func (*Interface) GetIndex

func (intf *Interface) GetIndex() int

func (*Interface) GetInterfaceType

func (intf *Interface) GetInterfaceType() networking.InterfaceType

func (*Interface) GetLocalPrefixes

func (intf *Interface) GetLocalPrefixes() []string

func (*Interface) GetName

func (intf *Interface) GetName() string

func (*Interface) GetNameNoLoad added in v1.0.14

func (intf *Interface) GetNameNoLoad() string

GetNameNoLoad - Returns the name of the interface without changing the interface, thus won't interfere with DeepEqual based comparison.

func (*Interface) GetNeighborPrefixes

func (intf *Interface) GetNeighborPrefixes() []string

func (*Interface) RemoveLocalPrefix

func (intf *Interface) RemoveLocalPrefix(prefix string) error

func (*Interface) SetGatewayPrefixes

func (intf *Interface) SetGatewayPrefixes(gateways []string)

func (*Interface) SetInterfaceType

func (intf *Interface) SetInterfaceType(ifaceType networking.InterfaceType)

func (*Interface) SetLocalPrefixes

func (intf *Interface) SetLocalPrefixes(localPrefixes []string)

func (*Interface) SetNeighborPrefixes

func (intf *Interface) SetNeighborPrefixes(neighborPrefixes []string)

type InterfaceMetrics added in v1.0.13

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

func NewInterfaceMetrics added in v1.0.13

func NewInterfaceMetrics(metricAttributes []metric.ObserveOption) *InterfaceMetrics

func (*InterfaceMetrics) Collect added in v1.0.13

func (im *InterfaceMetrics) Collect() error

Collect collects the metrics for the interfaces.

func (*InterfaceMetrics) Register added in v1.0.13

func (im *InterfaceMetrics) Register(interfaceName string)

func (*InterfaceMetrics) Unregister added in v1.0.13

func (im *InterfaceMetrics) Unregister(interfaceName string)

type InterfaceMonitor

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

func NewInterfaceMonitor

func NewInterfaceMonitor() (*InterfaceMonitor, error)

NewInterfaceMonitor -

func (*InterfaceMonitor) Close

func (im *InterfaceMonitor) Close()

Close -

func (*InterfaceMonitor) Subscribe

func (im *InterfaceMonitor) Subscribe(subscriber networking.InterfaceMonitorSubscriber)

Subscribe -

func (*InterfaceMonitor) UnSubscribe

func (im *InterfaceMonitor) UnSubscribe(subscriber networking.InterfaceMonitorSubscriber)

UnSubscribe -

type InterfaceOption added in v0.4.0

type InterfaceOption func(o *interfaceOptions)

func WithInterfaceName added in v0.4.0

func WithInterfaceName(name string) InterfaceOption

type KernelUtils

type KernelUtils struct {
}

func (*KernelUtils) GetIndexFromName

func (ku *KernelUtils) GetIndexFromName(name string) (int, error)

func (*KernelUtils) GetInterfaceMonitor added in v0.4.0

func (ku *KernelUtils) GetInterfaceMonitor(ctx context.Context) networking.InterfaceMonitor

GetInterfaceMonitor - Returns InterfaceMonitor from Context

func (*KernelUtils) NewBridge

func (ku *KernelUtils) NewBridge(name string) (networking.Bridge, error)

func (*KernelUtils) NewFWMarkRoute

func (ku *KernelUtils) NewFWMarkRoute(ip string, fwmark int, tableID int) (networking.FWMarkRoute, error)

func (*KernelUtils) NewInterface

func (ku *KernelUtils) NewInterface(index int) networking.Iface

func (*KernelUtils) NewInterfaceMonitor

func (ku *KernelUtils) NewInterfaceMonitor() (networking.InterfaceMonitor, error)

func (*KernelUtils) NewSourceBasedRoute

func (ku *KernelUtils) NewSourceBasedRoute(tableID int, prefix string) (networking.SourceBasedRoute, error)

func (*KernelUtils) WithInterfaceMonitor added in v0.4.0

func (ku *KernelUtils) WithInterfaceMonitor(parent context.Context, monitor networking.InterfaceMonitor) context.Context

WithInterfaceMonitor - Stores InterfaceMonitor in Context

type NFSetIP added in v0.4.0

type NFSetIP struct {
	*nftables.Set
	// contains filtered or unexported fields
}

NFSetIP is a wrapper for IP type nftables.Set (either IPv4 or IPv6) Supports update of IPs

func NewNFSetIP added in v0.4.0

func NewNFSetIP(name string, family int, table *nftables.Table) (*NFSetIP, error)

func (*NFSetIP) Delete added in v0.4.0

func (nfs *NFSetIP) Delete() error

func (*NFSetIP) Update added in v0.4.0

func (nfs *NFSetIP) Update(ips []string) error

type SourceBasedRoute

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

SourceBasedRoute -

func NewSourceBasedRoute

func NewSourceBasedRoute(tableID int, vip string) (*SourceBasedRoute, error)

NewSourceBasedRoute -

func (*SourceBasedRoute) AddNexthop

func (sbr *SourceBasedRoute) AddNexthop(nexthop string) error

AddNexthop -

func (*SourceBasedRoute) Delete

func (sbr *SourceBasedRoute) Delete() error

func (*SourceBasedRoute) RemoveNexthop

func (sbr *SourceBasedRoute) RemoveNexthop(nexthop string) error

RemoveNexthop -

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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