lxd: github.com/lxc/lxd/lxd/network Index | Files

package network

import "github.com/lxc/lxd/lxd/network"

Index

Package Files

network.go network_load.go network_utils.go

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.

func AttachInterface Uses

func AttachInterface(netName string, devName string) error

AttachInterface attaches an interface to a bridge.

func DefaultGatewaySubnetV4 Uses

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

DefaultGatewaySubnetV4 returns subnet of default gateway interface.

func DetachInterface Uses

func DetachInterface(netName string, devName string) error

DetachInterface detaches an interface from a bridge.

func FillConfig Uses

func FillConfig(req *api.NetworksPost) error

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

func ForkdnsServersList Uses

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

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

func GetDevMTU Uses

func GetDevMTU(devName string) (uint64, error)

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

func GetHostDevice Uses

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 GetIP Uses

func GetIP(subnet *net.IPNet, host int64) net.IP

GetIP returns a net.IP representing the IP belonging to the subnet for the host number supplied.

func GetLeaseAddresses Uses

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

GetLeaseAddresses returns the lease addresses for a network and hwaddr.

func GetMACSlice Uses

func GetMACSlice(hwaddr string) []string

GetMACSlice parses MAC address.

func IsInUse Uses

func IsInUse(c instance.Instance, networkName string) bool

IsInUse indicates if network is reference by any instance's NIC devices. Checks if the device's parent or network properties match the network name.

func UpdateDNSMasqStatic Uses

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

UpdateDNSMasqStatic rebuilds the DNSMasq static allocations.

func UsesIPv4Firewall Uses

func UsesIPv4Firewall(netConfig map[string]string) bool

UsesIPv4Firewall returns whether network config will need to use the IPv4 firewall.

func UsesIPv6Firewall Uses

func UsesIPv6Firewall(netConfig map[string]string) bool

UsesIPv6Firewall returns whether network config will need to use the IPv6 firewall.

type DHCPRange Uses

type DHCPRange struct {
    Start net.IP
    End   net.IP
}

DHCPRange represents a range of IPs from start to end.

type Network Uses

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

Network represents a LXD network.

func LoadByName Uses

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

LoadByName loads the network info from the database by name.

func (*Network) Config Uses

func (n *Network) Config() map[string]string

Config returns the network config.

func (*Network) DHCPv4Ranges Uses

func (n *Network) DHCPv4Ranges() []DHCPRange

DHCPv4Ranges returns a parsed set of DHCPv4 ranges for this network.

func (*Network) DHCPv6Ranges Uses

func (n *Network) DHCPv6Ranges() []DHCPRange

DHCPv6Ranges returns a parsed set of DHCPv6 ranges for this network.

func (*Network) Delete Uses

func (n *Network) Delete(withDatabase bool) error

Delete deletes a network.

func (*Network) HasDHCPv4 Uses

func (n *Network) HasDHCPv4() bool

HasDHCPv4 indicates whether the network has DHCPv4 enabled.

func (*Network) HasDHCPv6 Uses

func (n *Network) HasDHCPv6() bool

HasDHCPv6 indicates whether the network has DHCPv6 enabled (includes stateless SLAAC router advertisement mode). Technically speaking stateless SLAAC RA mode isn't DHCPv6, but for consistency with LXD's config paradigm, DHCP here means "an ability to automatically allocate IPs and routes", rather than stateful DHCP with leases. To check if true stateful DHCPv6 is enabled check the "ipv6.dhcp.stateful" config key.

func (*Network) HasIPv4Firewall Uses

func (n *Network) HasIPv4Firewall() bool

HasIPv4Firewall indicates whether the network has IPv4 firewall enabled.

func (*Network) HasIPv6Firewall Uses

func (n *Network) HasIPv6Firewall() bool

HasIPv6Firewall indicates whether the network has IPv6 firewall enabled.

func (*Network) IsRunning Uses

func (n *Network) IsRunning() bool

IsRunning returns whether the network is up.

func (*Network) IsUsed Uses

func (n *Network) IsUsed() bool

IsUsed returns whether the network is used by any instances.

func (*Network) Name Uses

func (n *Network) Name() string

Name returns the network name.

func (*Network) RefreshForkdnsServerAddresses Uses

func (n *Network) RefreshForkdnsServerAddresses(heartbeatData *cluster.APIHeartbeat) error

RefreshForkdnsServerAddresses retrieves the IPv4 address of each cluster node (excluding ourselves) for this network. It then updates the forkdns server list file if there are changes.

func (*Network) Rename Uses

func (n *Network) Rename(name string) error

Rename renames a network.

func (*Network) Start Uses

func (n *Network) Start() error

Start starts the network.

func (*Network) Stop Uses

func (n *Network) Stop() error

Stop stops the network.

func (*Network) Update Uses

func (n *Network) Update(newNetwork api.NetworkPut, notify bool) error

Update updates the network.

Package network imports 32 packages (graph) and is imported by 6 packages. Updated 2020-04-05. Refresh now. Tools for package owners.