network

package
v0.0.0-...-b84de06 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const ForkdnsServersListFile = "servers.conf"

ForkdnsServersListFile file that contains the server candidates list.

View Source
const ForkdnsServersListPath = "forkdns.servers"

ForkdnsServersListPath defines the path that contains the forkdns server candidate file.

Variables

View Source
var ErrUnknownDriver = fmt.Errorf("Unknown driver")

ErrUnknownDriver is the "Unknown driver" error

Functions

func AttachInterface

func AttachInterface(bridgeName string, devName string) error

AttachInterface attaches an interface to a bridge.

func BridgeVLANDefaultPVID

func BridgeVLANDefaultPVID(interfaceName string) (string, error)

BridgeVLANDefaultPVID returns the VLAN default port VLAN ID (PVID).

func BridgeVLANFilterSetStatus

func BridgeVLANFilterSetStatus(interfaceName string, status string) error

BridgeVLANFilterSetStatus sets the status of VLAN filtering on a bridge interface.

func BridgeVLANFilteringStatus

func BridgeVLANFilteringStatus(interfaceName string) (string, error)

BridgeVLANFilteringStatus returns whether VLAN filtering is enabled on a bridge interface.

func BridgeVLANSetDefaultPVID

func BridgeVLANSetDefaultPVID(interfaceName string, vlanID string) error

BridgeVLANSetDefaultPVID sets the VLAN default port VLAN ID (PVID).

func DefaultGatewaySubnetV4

func DefaultGatewaySubnetV4() (*net.IPNet, string, error)

DefaultGatewaySubnetV4 returns subnet of default gateway interface.

func DetachInterface

func DetachInterface(bridgeName string, devName string) error

DetachInterface detaches an interface from a bridge.

func FillConfig

func FillConfig(req *api.NetworksPost) error

FillConfig populates the supplied api.NetworkPost with automatically populated values.

func ForkdnsServersList

func ForkdnsServersList(networkName string) ([]string, error)

ForkdnsServersList reads the server list file and returns the list as a slice.

func GetDevMTU

func GetDevMTU(devName string) (uint64, error)

GetDevMTU retrieves the current MTU setting for a named network device.

func GetHostDevice

func GetHostDevice(parent string, vlan string) string

GetHostDevice returns the interface name to use for a combination of parent device name and VLAN ID. If no vlan ID supplied, parent name is returned unmodified. If non-empty VLAN ID is supplied then it will look for an existing VLAN device and return that, otherwise it will return the default "parent.vlan" format as name.

func GetLeaseAddresses

func GetLeaseAddresses(s *state.State, networkName string, hwaddr string) ([]api.InstanceStateNetworkAddress, error)

GetLeaseAddresses returns the lease addresses for a network and hwaddr.

func GetMACSlice

func GetMACSlice(hwaddr string) []string

GetMACSlice parses MAC address.

func IsInUseByInstance

func IsInUseByInstance(s *state.State, c instance.Instance, networkName string) (bool, error)

IsInUseByInstance indicates if network is referenced by an instance's NIC devices. Checks if the device's parent or network properties match the network name.

func IsInUseByProfile

func IsInUseByProfile(s *state.State, profile api.Profile, networkName string) (bool, error)

IsInUseByProfile indicates if network is referenced by a profile's NIC devices. Checks if the device's parent or network properties match the network name.

func IsNativeBridge

func IsNativeBridge(bridgeName string) bool

IsNativeBridge returns whether the bridge name specified is a Linux native bridge.

func UpdateDNSMasqStatic

func UpdateDNSMasqStatic(s *state.State, networkName string) error

UpdateDNSMasqStatic rebuilds the DNSMasq static allocations.

func Validate

func Validate(name string, netType string, config map[string]string) error

Validate validates the supplied network name and configuration for the specified network type.

func ValidateName

func ValidateName(name string, netType string) error

ValidateName validates the supplied network name for the specified network type.

Types

type Network

type Network interface {

	// Config.
	ValidateName(name string) error
	Validate(config map[string]string) error
	ID() int64
	Name() string
	Type() string
	Status() string
	Config() map[string]string
	IsUsed() (bool, error)
	DHCPv4Subnet() *net.IPNet
	DHCPv6Subnet() *net.IPNet
	DHCPv4Ranges() []dhcpalloc.DHCPRange
	DHCPv6Ranges() []dhcpalloc.DHCPRange

	// Actions.
	Create(clusterNotification bool) error
	Start() error
	Stop() error
	Rename(name string) error
	Update(newNetwork api.NetworkPut, targetNode string, clusterNotification bool) error
	HandleHeartbeat(heartbeatData *cluster.APIHeartbeat) error
	Delete(clusterNotification bool) error
	// contains filtered or unexported methods
}

Network represents a LXD network.

func LoadByName

func LoadByName(s *state.State, name string) (Network, error)

LoadByName loads the network info from the database by name.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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