networkutils

package
v1.0.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsNoSuchRule

func ContainsNoSuchRule(err error) bool

ContainsNoSuchRule report whether the rule is not exist

func GetConfigForDebug

func GetConfigForDebug() map[string]interface{}

GetConfigForDebug returns the active values of the configuration env vars (for debugging purposes).

func GetVPNNet

func GetVPNNet(ip string) string

GetVPNNet return the ip from the vpn tunnel, which in most time is the x.x.255.254

func IsRuleExistsError

func IsRuleExistsError(err error) bool

IsRuleExistsError report whether the rule is exist

func LinkByMac

func LinkByMac(mac string, netLink netlinkwrapper.NetLink, retryInterval time.Duration) (netlink.Link, error)

LinkByMac returns linux netlink based on interface MAC

Types

type NetworkAPIs

type NetworkAPIs interface {
	// SetupNodeNetwork performs node level network configuration
	SetupHostNetwork(vpcCIDR *net.IPNet, vpcCIDRs []*string, primaryMAC string, primaryAddr *net.IP) error
	// SetupNICNetwork performs nic level network configuration
	SetupNICNetwork(nicIP string, mac string, table int, subnetCIDR string) error
	UseExternalSNAT() bool
	GetRuleList() ([]netlink.Rule, error)
	GetRuleListBySrc(ruleList []netlink.Rule, src net.IPNet) ([]netlink.Rule, error)
	UpdateRuleListBySrc(ruleList []netlink.Rule, src net.IPNet, toCIDRs []string, toFlag bool, table int) error
	DeleteRuleListBySrc(src net.IPNet) error
}

NetworkAPIs defines the host level and the nic level network related operations

func New

func New() NetworkAPIs

New creates a linuxNetwork object

func NewFakeNetworkAPI

func NewFakeNetworkAPI(netlink netlinkwrapper.NetLink, iptableIface iptables.IptablesIface, findPrimaryName func(string) (string, error), setProcSys func(string, string) error) NetworkAPIs

NewFakeNetworkAPI is used by unit test

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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