Documentation ¶
Index ¶
- func CommonNetworkCreate(n NetUtil, network *types.Network) error
- func CreateBridge(n NetUtil, network *types.Network, usedNetworks []*net.IPNet, ...) error
- func GetBridgeInterfaceNames(n NetUtil) []string
- func GetFreeDeviceName(n NetUtil) (string, error)
- func GetFreeIPv4NetworkSubnet(usedNetworks []*net.IPNet, subnetPools []config.SubnetPool) (*types.Subnet, error)
- func GetFreeIPv6NetworkSubnet(usedNetworks []*net.IPNet) (*types.Subnet, error)
- func GetLiveNetworkNames() ([]string, error)
- func GetUsedNetworkNames(n NetUtil) []string
- func GetUsedSubnets(n NetUtil) ([]*net.IPNet, error)
- func IpamNoneDisableDNS(network *types.Network)
- func NetworkIntersectsWithNetworks(n *net.IPNet, networklist []*net.IPNet) bool
- func NextSubnet(subnet *net.IPNet) (*net.IPNet, error)
- func ParseMTU(mtu string) (int, error)
- func ParseVlan(vlan string) (int, error)
- func ValidateSetupOptions(n NetUtil, namespacePath string, options types.SetupOptions) error
- func ValidateSubnet(s *types.Subnet, addGateway bool, usedNetworks []*net.IPNet) error
- func ValidateSubnets(network *types.Network, addGateway bool, usedNetworks []*net.IPNet) error
- type NetUtil
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBridge ¶
func GetBridgeInterfaceNames ¶
GetBridgeInterfaceNames returns all bridge interface names already used by network configs
func GetFreeDeviceName ¶
GetFreeDeviceName returns a free device name which can be used for new configs as name and bridge interface name. The base name is suffixed by a number
func GetFreeIPv4NetworkSubnet ¶
func GetFreeIPv4NetworkSubnet(usedNetworks []*net.IPNet, subnetPools []config.SubnetPool) (*types.Subnet, error)
GetFreeIPv4NetworkSubnet returns a unused ipv4 subnet
func GetFreeIPv6NetworkSubnet ¶
GetFreeIPv6NetworkSubnet returns a unused ipv6 subnet
func GetLiveNetworkNames ¶
GetLiveNetworkNames returns a list of network interface names on the system
func GetUsedNetworkNames ¶
GetUsedNetworkNames returns all network names already used by network configs
func GetUsedSubnets ¶
GetUsedSubnets returns a list of all used subnets by network configs and interfaces on the host.
func IpamNoneDisableDNS ¶ added in v0.49.0
func NextSubnet ¶
NextSubnet returns subnet incremented by 1
func ValidateSetupOptions ¶
func ValidateSetupOptions(n NetUtil, namespacePath string, options types.SetupOptions) error
func ValidateSubnet ¶
ValidateSubnet will validate a given Subnet. It checks if the given gateway and lease range are part of this subnet. If the gateway is empty and addGateway is true it will get the first available ip in the subnet assigned.
func ValidateSubnets ¶
ValidateSubnets will validate the subnets for this network. It also sets the gateway if the gateway is empty and addGateway is set to true IPv6Enabled to true if at least one subnet is ipv6.
Types ¶
type NetUtil ¶
type NetUtil interface { // ForEach eaxecutes the given function for each network ForEach(func(types.Network)) // Len returns the number of networks Len() int // DefaultInterfaceName return the default interface name, this will be suffixed by a number DefaultInterfaceName() string // Network returns the network with the given name or ID. // It returns an error if the network is not found Network(nameOrID string) (*types.Network, error) }
NetUtil is a helper interface which all network interfaces should implement to allow easy code sharing