Documentation
¶
Index ¶
- Constants
- func AttachInterface(netName string, devName string) error
- func DefaultGatewaySubnetV4() (*net.IPNet, string, error)
- func DetachInterface(netName 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 GetIP(subnet *net.IPNet, host int64) net.IP
- func GetLeaseAddresses(s *state.State, networkName string, hwaddr string) ([]api.InstanceStateNetworkAddress, error)
- func GetMACSlice(hwaddr string) []string
- func IsInUse(c instance.Instance, networkName string) bool
- func UpdateDNSMasqStatic(s *state.State, networkName string) error
- func UsesIPv4Firewall(netConfig map[string]string) bool
- func UsesIPv6Firewall(netConfig map[string]string) bool
- type DHCPRange
- type Network
- func (n *Network) Config() map[string]string
- func (n *Network) DHCPv4Ranges() []DHCPRange
- func (n *Network) DHCPv6Ranges() []DHCPRange
- func (n *Network) Delete(withDatabase bool) error
- func (n *Network) HasDHCPv4() bool
- func (n *Network) HasDHCPv6() bool
- func (n *Network) HasIPv4Firewall() bool
- func (n *Network) HasIPv6Firewall() bool
- func (n *Network) IsRunning() bool
- func (n *Network) IsUsed() bool
- func (n *Network) Name() string
- func (n *Network) RefreshForkdnsServerAddresses(heartbeatData *cluster.APIHeartbeat) error
- func (n *Network) Rename(name string) error
- func (n *Network) Start() error
- func (n *Network) Stop() error
- func (n *Network) Update(newNetwork api.NetworkPut, notify bool) error
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 ¶
This section is empty.
Functions ¶
func AttachInterface ¶
AttachInterface attaches an interface to a bridge.
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 GetIP ¶
GetIP returns a net.IP representing the IP belonging to the subnet for the host number supplied.
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 IsInUse ¶
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 ¶
UpdateDNSMasqStatic rebuilds the DNSMasq static allocations.
func UsesIPv4Firewall ¶
UsesIPv4Firewall returns whether network config will need to use the IPv4 firewall.
func UsesIPv6Firewall ¶
UsesIPv6Firewall returns whether network config will need to use the IPv6 firewall.
Types ¶
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
Network represents a LXD network.
func LoadByName ¶
LoadByName loads the network info from the database by name.
func (*Network) DHCPv4Ranges ¶
DHCPv4Ranges returns a parsed set of DHCPv4 ranges for this network.
func (*Network) DHCPv6Ranges ¶
DHCPv6Ranges returns a parsed set of DHCPv6 ranges for this network.
func (*Network) HasDHCPv6 ¶
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 ¶
HasIPv4Firewall indicates whether the network has IPv4 firewall enabled.
func (*Network) HasIPv6Firewall ¶
HasIPv6Firewall indicates whether the network has IPv6 firewall enabled.
func (*Network) RefreshForkdnsServerAddresses ¶
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.