kernel

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 53

Documentation

Overview

Package kernel - describe kernel mechanism

Index

Constants

View Source
const (

	// MECHANISM string
	MECHANISM = "KERNEL"

	// LinuxIfMaxLength - Linux has a limit of 15 characters for an interface name
	LinuxIfMaxLength = 15

	// PCIAddressKey - device PCI address property key
	PCIAddressKey = common.PCIAddressKey

	// DeviceTokenIDKey is a device token ID property key
	DeviceTokenIDKey = common.DeviceTokenIDKey

	// NetNSInodeKey - netns inode mechanism property key
	NetNSInodeKey = common.NetNSInodeKey

	// InterfaceNameKey - interface name mechanism property key
	InterfaceNameKey = common.InterfaceNameKey

	// NetNSURL - NetNS URL, it can be either:
	// * file:///proc/${pid}/ns/net - ${pid} process net NS
	// * inode://${dev}/${ino} - while transferring file between processes using grpcfd
	NetNSURL = common.InodeURL

	// NetNSURLScheme - expected scheme of NetNSURLs
	NetNSURLScheme = "file"

	// SupportsVLAN - flag set if the forwarder supports VLAN trunking
	SupportsVLAN = "supportsVlan"

	// VLAN - VLAN ID
	VLAN = "vlan"

	// RouteLocalNet - flag set if route_localnet enabled
	RouteLocalNet = "routeLocalNet"

	// IPTables4NatTemplate - IP Tables ipv4 chains/rules template
	IPTables4NatTemplate = "IPTables4NatTemplate"
)

Variables

This section is empty.

Functions

func New

func New(netnsURL string) *networkservice.Mechanism

New returns *networkservice.Mechanism of type kernel using the given netnsURL (file:///proc/${pid}/ns/net)

Types

type Mechanism

type Mechanism struct {
	*networkservice.Mechanism
}

Mechanism is a kernel mechanism helper

func ToMechanism

func ToMechanism(m *networkservice.Mechanism) *Mechanism

ToMechanism converts unified mechanism to helper If Mechanism m is *not* of type kernel.MECHANISM, it returns nil

func (*Mechanism) EvaluateIPTables4NatTemplate added in v1.4.0

func (m *Mechanism) EvaluateIPTables4NatTemplate(conn *networkservice.Connection) ([]string, error)

EvaluateIPTables4NatTemplate - evaluate IP Table chain/rules template with connection parameters

func (*Mechanism) GetDeviceTokenID added in v1.1.0

func (m *Mechanism) GetDeviceTokenID() string

GetDeviceTokenID returns device token ID

func (*Mechanism) GetIPTables4NatTemplate added in v1.4.0

func (m *Mechanism) GetIPTables4NatTemplate() []string

GetIPTables4NatTemplate - return IP Table chain/rules template, empty string if unset

func (*Mechanism) GetInterfaceName

func (m *Mechanism) GetInterfaceName() string

GetInterfaceName returns the Kernel Interface Name

func (*Mechanism) GetNetNSURL

func (m *Mechanism) GetNetNSURL() string

GetNetNSURL returns the NetNS URL, it can be either: * file:///proc/${pid}/ns/net - ${pid} process net NS * inode://${dev}/${ino} - while transferring file between processes using grpcfd

func (*Mechanism) GetPCIAddress

func (m *Mechanism) GetPCIAddress() string

GetPCIAddress returns the PCI address of the device

func (*Mechanism) GetParameters

func (m *Mechanism) GetParameters() map[string]string

GetParameters returns the map of all parameters to the mechanism

func (*Mechanism) GetRouteLocalNet added in v1.4.0

func (m *Mechanism) GetRouteLocalNet() bool

GetRouteLocalNet - return RouteLocalNet flag value, false if unset or invalid

func (*Mechanism) GetVLAN added in v1.1.0

func (m *Mechanism) GetVLAN() uint32

GetVLAN - return Vlan value - 0 if unset or invalid

func (*Mechanism) SetDeviceTokenID added in v1.1.0

func (m *Mechanism) SetDeviceTokenID(tokenID string)

SetDeviceTokenID sets device token ID

func (*Mechanism) SetIPTables4NatTemplate added in v1.4.0

func (m *Mechanism) SetIPTables4NatTemplate(rules ...string) *Mechanism

SetIPTables4NatTemplate - set IP Table chain/rules template

func (*Mechanism) SetInterfaceName

func (m *Mechanism) SetInterfaceName(interfaceName string)

SetInterfaceName sets the Kernel Interface Name

func (*Mechanism) SetNetNSURL

func (m *Mechanism) SetNetNSURL(urlString string)

SetNetNSURL sets the NetNS URL - file:///proc/${pid}/ns/net

func (*Mechanism) SetRouteLocalNet added in v1.4.0

func (m *Mechanism) SetRouteLocalNet(routeLocalNet bool) *Mechanism

SetRouteLocalNet - set RouteLocalNet flag

func (*Mechanism) SetSupportsVLAN added in v1.1.0

func (m *Mechanism) SetSupportsVLAN(supportsVlan bool)

SetSupportsVLAN set SupportsVLAN flag

func (*Mechanism) SetVLAN added in v1.1.0

func (m *Mechanism) SetVLAN(vlan uint32) *Mechanism

SetVLAN - set the VLAN value

func (*Mechanism) SupportsVLAN added in v1.1.0

func (m *Mechanism) SupportsVLAN() bool

SupportsVLAN returns SupportsVLAN flag

Jump to

Keyboard shortcuts

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