Documentation ¶
Overview ¶
Package utils contain utility functions for the Liqonet package.
Index ¶
- func AddAnnotationToObj(obj client.Object, aKey, aValue string) bool
- func AddLabelToObj(obj client.Object, labelKey, labelValue string) bool
- func CheckTep(tep *netv1alpha1.TunnelEndpoint) error
- func FormatLatency(latency time.Duration) string
- func GetAnnotationValueFromObj(obj client.Object, akey string) string
- func GetExternalCIDRS(tep *netv1alpha1.TunnelEndpoint) (localExternalCIDR, remoteExternalCIDR string)
- func GetFirstIP(network string) (string, error)
- func GetMask(network string) uint8
- func GetNodeName() (string, error)
- func GetOverlayIP(ip string) string
- func GetPodCIDRS(tep *netv1alpha1.TunnelEndpoint) (localRemappedPodCIDR, remotePodCIDR string)
- func GetPodIP() (net.IP, error)
- func GetPodNamespace() (string, error)
- func GetTunnelIP(externalCIDR string) (string, error)
- func IsLocalNetworkConfig(networkConfig *netv1alpha1.NetworkConfig) bool
- func IsValidCIDR(cidr string) error
- func MapIPToNetwork(newNetwork, oldIP string) (newIP string, err error)
- func Next(network string) string
- func SetMask(network string, mask uint8) string
- func SplitNetwork(network string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAnnotationToObj ¶
AddAnnotationToObj for a given object it adds the annotation with the given key and value. It return a bool which is true when the annotations has been added or false if the annotation is already present.
func AddLabelToObj ¶
AddLabelToObj for a given object it adds the label with the given key and value. It return a bool which is true when the label has been added or false if the label is already present.
func CheckTep ¶
func CheckTep(tep *netv1alpha1.TunnelEndpoint) error
CheckTep checks validity of TunnelEndpoint resource fields.
func FormatLatency ¶ added in v0.6.0
FormatLatency returns a string representing the given latency in a human readable format.
func GetAnnotationValueFromObj ¶
GetAnnotationValueFromObj for a given object it return the value of the label denoted by the given key. If the key does not exist it returns an empty string.
func GetExternalCIDRS ¶
func GetExternalCIDRS(tep *netv1alpha1.TunnelEndpoint) (localExternalCIDR, remoteExternalCIDR string)
GetExternalCIDRS for a given tep the function retrieves the values for localExternalCIDR and remoteExternalCIDR. Their values depend if the NAT is required or not.
func GetFirstIP ¶
GetFirstIP returns the first IP address of a network.
func GetNodeName ¶
GetNodeName gets the name of the node where the pod is running passed as an environment variable.
func GetOverlayIP ¶
GetOverlayIP given an IP address it is mapped in to the overlay network, described by consts.OverlayNetworkPrefix. It uses the overlay prefix and the last three octets of the original IP address.
func GetPodCIDRS ¶
func GetPodCIDRS(tep *netv1alpha1.TunnelEndpoint) (localRemappedPodCIDR, remotePodCIDR string)
GetPodCIDRS for a given tep the function retrieves the values for localPodCIDR and remotePodCIDR. Their values depend if the NAT is required or not.
func GetPodNamespace ¶
GetPodNamespace gets the namespace of the pod passed as an environment variable.
func GetTunnelIP ¶ added in v0.6.0
GetTunnelIP returns the IP address of the tunnel, which is the first external CIDR ip.
func IsLocalNetworkConfig ¶ added in v0.7.0
func IsLocalNetworkConfig(networkConfig *netv1alpha1.NetworkConfig) bool
IsLocalNetworkConfig checks if the given network configuration is local.
func IsValidCIDR ¶
IsValidCIDR returns an error if the received CIDR is invalid.
func MapIPToNetwork ¶
MapIPToNetwork creates a new IP address obtained by means of the old IP address and the new network.
func SplitNetwork ¶ added in v0.3.1
SplitNetwork returns the two halves that make up a given network.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package links contains utils functions to interact with link in linux systems.
|
Package links contains utils functions to interact with link in linux systems. |
Package signals contains signals utilities which cannot be imported by windows.
|
Package signals contains signals utilities which cannot be imported by windows. |