utils

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotExist = HybridnetDaemonError("not exist")
)

Variables

This section is empty.

Functions

func AddRoute added in v0.4.0

func AddRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link) error

AddRoute adds a universally-scoped route. If no direct route contains gw IP, add single route for gw.

func CheckDefaultRouteExist added in v0.4.0

func CheckDefaultRouteExist(table int, family int) (bool, error)

func CheckIPIsGlobalUnicast added in v0.4.0

func CheckIPIsGlobalUnicast(ip net.IP) bool

func CheckIPv6Disabled added in v0.4.0

func CheckIPv6Disabled(nicName string) (bool, error)

func CheckIPv6GlobalDisabled added in v0.4.0

func CheckIPv6GlobalDisabled() (bool, error)
func CheckIfContainerNetworkLink(linkName string) bool

func CheckPodNeighExist added in v0.4.0

func CheckPodNeighExist(podIP net.IP, forwardNodeIfIndex int, family int) (bool, error)

func CheckPodRuleExist added in v0.4.0

func CheckPodRuleExist(podCidr *net.IPNet, family int) (bool, int, error)

func ConfigureIface added in v0.4.0

func ConfigureIface(ifName string, res *current.Result) error

ConfigureIface takes the result of IPAM plugin and applies to the ifName interface.

func EnableIPForward added in v0.4.0

func EnableIPForward(family int) error

func EnsureIPReachable added in v0.7.0

func EnsureIPReachable(ip net.IP) error

func EnsureIPv6RouteGCParameters added in v0.7.4

func EnsureIPv6RouteGCParameters(routeCacheMaxSize, gcThresh int) error

func EnsureNeighGCThresh added in v0.4.0

func EnsureNeighGCThresh(family int, neighGCThresh1, neighGCThresh2, neighGCThresh3 int) error

func EnsureRpFilter added in v0.7.8

func EnsureRpFilter(containerIfs ...string) error

func EnsureVlanIf added in v0.4.0

func EnsureVlanIf(nodeIfName string, vlanID *int32) (string, error)

func FindSubnetExcludeIPBlocks

func FindSubnetExcludeIPBlocks(cidr *net.IPNet, includedRanges []*IPRange, gateway net.IP,
	excludeIPs []net.IP) ([]*net.IPNet, error)

Translate a subnet range into a series ip block description.

func GenerateIPListString added in v0.4.0

func GenerateIPListString(addrList []netlink.Addr) string

func GenerateIPStringList added in v0.7.5

func GenerateIPStringList(addrList []netlink.Addr) []string

func GenerateVlanNetIfName added in v0.4.0

func GenerateVlanNetIfName(parentName string, vlanID *int32) (string, error)

func GenerateVxlanNetIfName added in v0.4.0

func GenerateVxlanNetIfName(parentName string, vlanID *int32) (string, error)

func GetDefaultInterface added in v0.4.0

func GetDefaultInterface(family int) (*net.Interface, error)

func GetDefaultRoute added in v0.4.0

func GetDefaultRoute(family int) (*netlink.Route, error)

func GetInterfaceByPreferString added in v0.4.0

func GetInterfaceByPreferString(preferString string) (*net.Interface, error)

GetInterfaceByPreferString return first valid interface by prefer string.

func GetSysctl

func GetSysctl(sysctlPath string) (int, error)

GetSysctl modifies the specified sysctl flag to the new value

func IsDefaultRoute added in v0.4.0

func IsDefaultRoute(route *netlink.Route, family int) bool

func IsFs

func IsFs(path string, magic int64) bool

func IsNsFS

func IsNsFS(path string) bool

func IsProcFS

func IsProcFS(path string) bool

func LastIP

func LastIP(cidr *net.IPNet) net.IP

func ListAllGlobalUnicastAddress added in v0.7.4

func ListAllGlobalUnicastAddress(link netlink.Link) ([]netlink.Addr, error)

func ListGlobalUnicastAddress added in v0.7.4

func ListGlobalUnicastAddress(link netlink.Link, family int) ([]netlink.Addr, error)
func ListLocalAddressExceptLink(exceptLinkName string) ([]netlink.Addr, error)

func SetSysctl

func SetSysctl(sysctlPath string, newVal int) error

SetSysctl modifies the specified sysctl flag to the new value

func SetSysctlIgnoreNotExist

func SetSysctlIgnoreNotExist(sysctlPath string, newVal int) error

func ValidDockerNetnsDir

func ValidDockerNetnsDir(path string) bool

Types

type HybridnetDaemonError added in v0.3.0

type HybridnetDaemonError string

func (HybridnetDaemonError) Error added in v0.3.0

func (e HybridnetDaemonError) Error() string

type IPInfo added in v0.4.0

type IPInfo struct {
	Addr  net.IP
	Gw    net.IP
	Cidr  *net.IPNet
	NetID *int32
}

type IPRange

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

func CreateIPRange

func CreateIPRange(start, end net.IP) (*IPRange, error)

func (*IPRange) TryAddIP

func (ir *IPRange) TryAddIP(ipAddr net.IP) (success bool)

Jump to

Keyboard shortcuts

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