Documentation ¶
Index ¶
- Constants
- Variables
- func AttachInterface(bridgeName string, devName string) error
- func BridgeVLANDefaultPVID(interfaceName string) (string, error)
- func BridgeVLANFilterSetStatus(interfaceName string, status string) error
- func BridgeVLANFilteringStatus(interfaceName string) (string, error)
- func BridgeVLANSetDefaultPVID(interfaceName string, vlanID string) error
- func DefaultGatewaySubnetV4() (*net.IPNet, string, error)
- func DetachInterface(bridgeName string, devName string) error
- func FillConfig(req *api.NetworksPost) error
- func ForkdnsServersList(networkName string) ([]string, error)
- func GetDevMTU(devName string) (uint64, error)
- func GetHostDevice(parent string, vlan string) string
- func GetLeaseAddresses(s *state.State, networkName string, hwaddr string) ([]api.InstanceStateNetworkAddress, error)
- func GetMACSlice(hwaddr string) []string
- func IsInUseByInstance(s *state.State, c instance.Instance, networkName string) (bool, error)
- func IsInUseByProfile(s *state.State, profile api.Profile, networkName string) (bool, error)
- func IsNativeBridge(bridgeName string) bool
- func UpdateDNSMasqStatic(s *state.State, networkName string) error
- func Validate(name string, netType string, config map[string]string) error
- func ValidateName(name string, netType string) error
- type Network
Constants ¶
const ForkdnsServersListFile = "servers.conf"
ForkdnsServersListFile file that contains the server candidates list.
const ForkdnsServersListPath = "forkdns.servers"
ForkdnsServersListPath defines the path that contains the forkdns server candidate file.
Variables ¶
var ErrUnknownDriver = fmt.Errorf("Unknown driver")
ErrUnknownDriver is the "Unknown driver" error
Functions ¶
func AttachInterface ¶
AttachInterface attaches an interface to a bridge.
func BridgeVLANDefaultPVID ¶
BridgeVLANDefaultPVID returns the VLAN default port VLAN ID (PVID).
func BridgeVLANFilterSetStatus ¶
BridgeVLANFilterSetStatus sets the status of VLAN filtering on a bridge interface.
func BridgeVLANFilteringStatus ¶
BridgeVLANFilteringStatus returns whether VLAN filtering is enabled on a bridge interface.
func BridgeVLANSetDefaultPVID ¶
BridgeVLANSetDefaultPVID sets the VLAN default port VLAN ID (PVID).
func DefaultGatewaySubnetV4 ¶
DefaultGatewaySubnetV4 returns subnet of default gateway interface.
func DetachInterface ¶
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 ¶
ForkdnsServersList reads the server list file and returns the list as a slice.
func GetHostDevice ¶
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 IsInUseByInstance ¶
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 ¶
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 ¶
IsNativeBridge returns whether the bridge name specified is a Linux native bridge.
func UpdateDNSMasqStatic ¶
UpdateDNSMasqStatic rebuilds the DNSMasq static allocations.
func Validate ¶
Validate validates the supplied network name and configuration for the specified network type.
func ValidateName ¶
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.