networkmanager

package
v0.0.0-...-15f1d61 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: 29 Imported by: 0

Documentation

Overview

Package networkmanager provides set of API to configure network

Package networkmanager provides set of API to configure network

Package networkmanager provides set of API to configure network

Package networkmanager provides set of API to configure network

Index

Constants

View Source
const (
	MinutePeriod = iota
	HourPeriod
	DayPeriod
	MonthPeriod
	YearPeriod
)

Describes reset traffic period.

Variables

View Source
var (
	ErrEntryNotExist = errors.New("entry does not exist")
	ErrRuleNotExist  = errors.New("chain rule not exist")
)
View Source
var CNIPlugins cni.CNI

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

View Source
var CreateVlan = createVlan

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

View Source
var UpdateIptablesCachePeriod = 1 * time.Minute

UpdateIptablesCachePeriod is used to be able to mocking the functionality of networking in tests.

Functions

This section is empty.

Types

type IPTablesInterface

type IPTablesInterface interface {
	Append(table, chain string, rulespec ...string) error
	Delete(table, chain string, rulespec ...string) error
	NewChain(table, chain string) error
	Insert(table, chain string, pos int, rulespec ...string) error
	ClearChain(table, chain string) error
	DeleteChain(table, chain string) error
	ListChains(table string) ([]string, error)
	ListAllRulesWithCounters(table string) ([]string, error)
}
var (
	IsSamePeriod = isSamePeriod
	IPTables     IPTablesInterface
)

These global variables are used to be able to mocking the functionality in tests.

type NetworkManager

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

NetworkManager network manager instance.

func New

func New(cfg *config.Config, storage Storage) (manager *NetworkManager, err error)

New creates network manager instance.

func (*NetworkManager) AddInstanceToNetwork

func (manager *NetworkManager) AddInstanceToNetwork(instanceID, networkID string, params NetworkParams) (err error)

AddInstanceToNetwork adds instance to network.

func (*NetworkManager) Close

func (manager *NetworkManager) Close() error

Close closes network manager instance.

func (*NetworkManager) GetInstanceIP

func (manager *NetworkManager) GetInstanceIP(instanceID, networkID string) (ip string, err error)

GetInstanceIP return instance IP address.

func (*NetworkManager) GetInstanceTraffic

func (manager *NetworkManager) GetInstanceTraffic(instanceID string) (inputTraffic, outputTraffic uint64, err error)

func (*NetworkManager) GetNetnsPath

func (manager *NetworkManager) GetNetnsPath(instanceID string) (pathToNetNS string)

GetNetnsPath get path to instance network namespace.

func (*NetworkManager) GetSystemTraffic

func (manager *NetworkManager) GetSystemTraffic() (inputTraffic, outputTraffic uint64, err error)

func (*NetworkManager) RemoveInstanceFromNetwork

func (manager *NetworkManager) RemoveInstanceFromNetwork(instanceID, networkID string) error

RemoveInstanceFromNetwork removes instance from network.

func (*NetworkManager) SetTrafficPeriod

func (manager *NetworkManager) SetTrafficPeriod(period int) error

func (*NetworkManager) UpdateNetworks

func (manager *NetworkManager) UpdateNetworks(networkParameters []aostypes.NetworkParameters) error

UpdateNetworks updates networks.

type NetworkParameters

type NetworkParameters struct {
	NetworkID  string
	Subnet     string
	IP         string
	VlanID     uint64
	VlanIfName string
}

NetworkParameters network parameters set for service provider.

type NetworkParams

type NetworkParams struct {
	aostypes.InstanceIdent
	aostypes.NetworkParameters
	Hostname           string
	Aliases            []string
	IngressKbit        uint64
	EgressKbit         uint64
	ExposedPorts       []string
	Hosts              []aostypes.Host
	DNSSevers          []string
	HostsFilePath      string
	ResolvConfFilePath string
	UploadLimit        uint64
	DownloadLimit      uint64
}

NetworkParams network parameters set for instance.

type Storage

type Storage interface {
	// storage for network info
	RemoveNetworkInfo(networkID string) error
	AddNetworkInfo(info NetworkParameters) error
	GetNetworksInfo() ([]NetworkParameters, error)

	// storage for network traffic monitoring
	SetTrafficMonitorData(chain string, timestamp time.Time, value uint64) (err error)
	GetTrafficMonitorData(chain string) (timestamp time.Time, value uint64, err error)
	RemoveTrafficMonitorData(chain string) (err error)
}

Storage interface for network manager.

type Vlan

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

Vlan represents vlan configuration.

Jump to

Keyboard shortcuts

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