manager

package
v0.0.0-...-05f333e Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package manager is responsible for detecting the current network manager service, and writing and rolling back appropriate configurations for each network manager service.

Package manager is responsible for detecting the current network manager service, and writing and rolling back appropriate configurations for each network manager service.

Package manager is responsible for detecting the current network manager service, and writing and rolling back appropriate configurations for each network manager service.

Package manager is responsible for detecting the current network manager service, and writing and rolling back appropriate configurations for each network manager service.

Package manager is responsible for detecting the current network manager service, and writing and rolling back appropriate configurations for each network manager service.

Package manager is responsible for detecting the current network manager service, and writing and rolling back appropriate configurations for each network manager service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInterfaceByMAC

func GetInterfaceByMAC(mac string) (net.Interface, error)

GetInterfaceByMAC gets the interface given the mac string.

func SetupInterfaces

func SetupInterfaces(ctx context.Context, config *cfg.Sections, mds *metadata.Descriptor) error

SetupInterfaces sets up all the network interfaces on the system, applying rules described by osRules and using the native network manager service detected to be managing the primary network interface.

Types

type IPConfig

type IPConfig struct {
	// InterfaceConfig contains the interface's config.
	InterfaceConfig

	// IPVersion is either ipv4 or ipv6.
	IPVersion ipVersion

	// Address is the IP address.
	Address string

	// Gateway is the gateway address (for ipv4 it will be md's gateway entry and for
	// ipv6 it will be populated with GatewayIpv6).
	Gateway string
}

IPConfig wraps the interface's configuration as well as the IP configuration.

type InterfaceConfig

type InterfaceConfig struct {
	// Iface is the interface name.
	Iface string

	// ParentInterface is the name of the vlan's parent interface.
	ParentInterface string

	// MTU is the vlan's MTU value.
	MTU int

	// MacAddress is the vlan's Mac Address.
	MacAddress string

	// Vlan is the vlan's id.
	Vlan int
}

InterfaceConfig wraps the vlan's link and interface's configuration.

type Interfaces

type Interfaces struct {
	// EthernetInterfaces are the regular ethernet interfaces descriptors offered by metadata.
	EthernetInterfaces []metadata.NetworkInterfaces

	// VlanInterfaces are the vLAN interfaces descriptors offered by metadata.
	VlanInterfaces map[int]metadata.VlanInterface
}

Interfaces wraps both ethernet and vlan interfaces.

type Service

type Service interface {
	// Configure gives the opportunity for the Service implementation to adjust its configuration
	// based on the Guest Agent configuration.
	Configure(ctx context.Context, config *cfg.Sections)

	// IsManaging checks whether this network manager service is managing the provided interface.
	IsManaging(ctx context.Context, iface string) (bool, error)

	// Name is the name of the network manager service.
	Name() string

	// SetupEthernetInterface writes the appropriate configurations for the network manager service for all
	// non-primary network interfaces.
	SetupEthernetInterface(ctx context.Context, config *cfg.Sections, nics *Interfaces) error

	// SetupVlanInterface writes the apppropriate vLAN interfaces configuration for the network manager service
	// for all configured interfaces.
	SetupVlanInterface(ctx context.Context, config *cfg.Sections, nics *Interfaces) error

	// Rollback rolls back the changes created in Setup.
	Rollback(ctx context.Context, nics *Interfaces) error
}

Service is an interface for setting up network configurations using different network managing services, such as systemd-networkd and wicked.

Jump to

Keyboard shortcuts

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