networkmanager

package
v0.0.0-...-2b5bdcb Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LookPath          = exec.LookPath
	DiscoverInterface = gateway.DiscoverInterface
	ExecContext       = execShellCommander
)

These global variable is used to be able to mocking the functionality of networking in tests.

View Source
var (
	GetIPSubnet func(networkID string) (allocIPNet *net.IPNet, ip net.IP, err error)
	GetSubnet   func(networkID string) (*net.IPNet, error)
	GetVlanID   func(networkID string) (uint64, error)
)

These global variable is used to be able to mocking the functionality of networking in tests.

Functions

This section is empty.

Types

type FirewallRule

type FirewallRule struct {
	Protocol string
	Port     string
}

FirewallRule represents firewall rule.

type InstanceNetworkInfo

type InstanceNetworkInfo struct {
	aostypes.InstanceIdent
	NetworkInfo
	Rules []FirewallRule
}

InstanceNetworkInfo represents network info for instance.

type NetworkInfo

type NetworkInfo struct {
	aostypes.NetworkParameters
	NetworkID string
}

NetworkInfo represents network info for instance.

type NetworkManager

type NetworkManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

NetworkManager networks manager instance.

func New

func New(storage Storage, nodeManager NodeManager, config *config.Config) (*NetworkManager, error)

New creates network manager instance.

func (*NetworkManager) GetInstances

func (manager *NetworkManager) GetInstances() []aostypes.InstanceIdent

GetInstances gets instances.

func (*NetworkManager) PrepareInstanceNetworkParameters

func (manager *NetworkManager) PrepareInstanceNetworkParameters(
	instanceIdent aostypes.InstanceIdent, networkID string, params NetworkParameters,
) (networkParameters aostypes.NetworkParameters, err error)

PrepareInstanceNetworkParameters prepares network parameters for instance.

func (*NetworkManager) RemoveInstanceNetworkParameters

func (manager *NetworkManager) RemoveInstanceNetworkParameters(instanceIdent aostypes.InstanceIdent, networkID string)

RemoveInstanceNetworkConf removes stored instance network parameters.

func (*NetworkManager) RestartDNSServer

func (manager *NetworkManager) RestartDNSServer() error

Restart restarts DNS server.

func (*NetworkManager) UpdateProviderNetwork

func (manager *NetworkManager) UpdateProviderNetwork(providers []string, nodeID string) error

UpdateProviderNetwork updates provider network.

type NetworkParameters

type NetworkParameters struct {
	Hosts            []string
	AllowConnections []string
	ExposePorts      []string
}

NetworkParameters represents network parameters.

type NodeManager

type NodeManager interface {
	UpdateNetwork(nodeID string, networkParameters []aostypes.NetworkParameters) error
}

NodeManager nodes controller.

type Storage

type Storage interface {
	AddNetworkInstanceInfo(info InstanceNetworkInfo) error
	RemoveNetworkInstanceInfo(instance aostypes.InstanceIdent) error
	GetNetworkInstancesInfo() ([]InstanceNetworkInfo, error)
	RemoveNetworkInfo(networkID string) error
	AddNetworkInfo(info NetworkInfo) error
	GetNetworksInfo() ([]NetworkInfo, error)
}

Storage provides API to create, remove or access information from DB.

Jump to

Keyboard shortcuts

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