Documentation ¶
Index ¶
- func AllocateNewCidrBlock(existingCidrBlocks []string) string
- func SetupNetworkInterfaces(network Service, tapDeviceName string, bridgeName string, ipaddress string, ...) error
- func TurnOffNetworkInterfaces(network Service, tapDeviceName string, bridgeName string) error
- type IprouteNetworkService
- func (s *IprouteNetworkService) AddBridge(br string) (string, error)
- func (s *IprouteNetworkService) AddTap(tap string) (string, error)
- func (s *IprouteNetworkService) AddTapToBridge(br, tap string) (string, error)
- func (s *IprouteNetworkService) CheckBridgeHasInterface(bridgeName string, ifcName string) (bool, error)
- func (s *IprouteNetworkService) CheckNetworkInterfaceExists(name string) (bool, error)
- func (s *IprouteNetworkService) DeleteNIC(ifc string) (string, error)
- func (s *IprouteNetworkService) FlushIPFromNI(niName string) (string, error)
- func (s *IprouteNetworkService) GetBridgeInterfacesNames(bridgeName string) ([]string, error)
- func (s *IprouteNetworkService) GetNetworkInterfaceIP(ifcName string) (string, error)
- func (s *IprouteNetworkService) IsNIUp(ifcName string) (bool, error)
- func (s *IprouteNetworkService) ListBridges() (string, error)
- func (s *IprouteNetworkService) SetNIIP(ifc string, ip string, netmask string) (string, error)
- func (s *IprouteNetworkService) TurnNIDown(ifc string) (string, error)
- func (s *IprouteNetworkService) TurnNIUp(ifc string) (string, error)
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllocateNewCidrBlock ¶
AllocateNewCidrBlock returns an unused cidr block
Types ¶
type IprouteNetworkService ¶
type IprouteNetworkService struct { }
IprouteNetworkService uses iproute commands to change network configuration in OS
func NewIprouteNetworkService ¶
func NewIprouteNetworkService() *IprouteNetworkService
NewIprouteNetworkService returns an instance of IprouteNetworkService
func (*IprouteNetworkService) AddBridge ¶
func (s *IprouteNetworkService) AddBridge(br string) (string, error)
AddBridge creates bridge interface
func (*IprouteNetworkService) AddTap ¶
func (s *IprouteNetworkService) AddTap(tap string) (string, error)
AddTap creates tap interface
func (*IprouteNetworkService) AddTapToBridge ¶
func (s *IprouteNetworkService) AddTapToBridge(br, tap string) (string, error)
AddTapToBridge adds tap interface to bridge network
func (*IprouteNetworkService) CheckBridgeHasInterface ¶
func (s *IprouteNetworkService) CheckBridgeHasInterface(bridgeName string, ifcName string) (bool, error)
CheckBridgeHasInterface checks whether interface is listed in bridge network
func (*IprouteNetworkService) CheckNetworkInterfaceExists ¶
func (s *IprouteNetworkService) CheckNetworkInterfaceExists(name string) (bool, error)
CheckNetworkInterfaceExists checks whether network interface exists
func (*IprouteNetworkService) DeleteNIC ¶
func (s *IprouteNetworkService) DeleteNIC(ifc string) (string, error)
DeleteNIC removes network interface
func (*IprouteNetworkService) FlushIPFromNI ¶
func (s *IprouteNetworkService) FlushIPFromNI(niName string) (string, error)
FlushIPFromNI removes every IP assigned to network interface
func (*IprouteNetworkService) GetBridgeInterfacesNames ¶
func (s *IprouteNetworkService) GetBridgeInterfacesNames(bridgeName string) ([]string, error)
GetBridgeInterfacesNames get list of interfaces names in bridge network
func (*IprouteNetworkService) GetNetworkInterfaceIP ¶
func (s *IprouteNetworkService) GetNetworkInterfaceIP(ifcName string) (string, error)
GetNetworkInterfaceIP get IP from network interface
func (*IprouteNetworkService) IsNIUp ¶
func (s *IprouteNetworkService) IsNIUp(ifcName string) (bool, error)
IsNIUp checks whether network interface is on
func (*IprouteNetworkService) ListBridges ¶
func (s *IprouteNetworkService) ListBridges() (string, error)
ListBridges prints a list of bridge network interfaces
func (*IprouteNetworkService) TurnNIDown ¶
func (s *IprouteNetworkService) TurnNIDown(ifc string) (string, error)
TurnNIDown turns off network interface
type Service ¶
type Service interface { AddBridge(br string) (string, error) ListBridges() (string, error) CheckBridgeHasInterface(bridgeName string, ifcName string) (bool, error) GetBridgeInterfacesNames(bridgeName string) ([]string, error) CheckNetworkInterfaceExists(name string) (bool, error) AddTap(tap string) (string, error) AddTapToBridge(br, tap string) (string, error) SetNIIP(ifc string, ip string, netmask string) (string, error) FlushIPFromNI(niName string) (string, error) TurnNIUp(ifc string) (string, error) TurnNIDown(ifc string) (string, error) DeleteNIC(ifc string) (string, error) IsNIUp(ifcName string) (bool, error) GetNetworkInterfaceIP(ifcName string) (string, error) }
Service represents a network service able to apply changes to network configuration