utils

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TCP_PROTOCOL_NUMBER             = 6
	UDP_PROTOCOL_NUMBER             = 17
	SCTP_PROTOCOL_NUMBER            = 132
	ICMP_PROTOCOL_NUMBER            = 1
	RESERVED_IP_PROTOCOL_NUMBER     = 255 // 255 is a reserved protocol value in the IP header
	ANY_IP_PROTOCOL                 = 254
	TRIE_KEY_LENGTH                 = 8
	TRIE_V6_KEY_LENGTH              = 20
	TRIE_VALUE_LENGTH               = 96
	BPF_PROGRAMS_PIN_PATH_DIRECTORY = "/sys/fs/bpf/globals/aws/programs/"
	BPF_MAPS_PIN_PATH_DIRECTORY     = "/sys/fs/bpf/globals/aws/maps/"
	TC_INGRESS_PROG                 = "handle_ingress"
	TC_EGRESS_PROG                  = "handle_egress"
	TC_INGRESS_MAP                  = "ingress_map"
	TC_EGRESS_MAP                   = "egress_map"

	CATCH_ALL_PROTOCOL   corev1.Protocol = "ANY_IP_PROTOCOL"
	DEFAULT_CLUSTER_NAME                 = "k8s-cluster"
	ErrFileExists                        = " file exists"
	ErrInvalidFilterList                 = "failed to get filter list"
	ErrMissingFilter                     = "no active filter to detach"
)

Functions

func ComputeTrieKey

func ComputeTrieKey(n net.IPNet, isIPv6Enabled bool) []byte

func ComputeTrieValue

func ComputeTrieValue(l4Info []v1alpha1.Port, log logr.Logger, allowAll, denyAll bool) []byte

func ConvByteArrayToIP

func ConvByteArrayToIP(ipInInt uint32) string

func ConvByteToIPv6

func ConvByteToIPv6(ipaddr [16]byte) net.IP

func ConvConntrackV6ToByte

func ConvConntrackV6ToByte(key ConntrackKeyV6) []byte

func ConvIPv4ToInt

func ConvIPv4ToInt(ipaddr net.IP) uint32

func ConvIPv6ToByte

func ConvIPv6ToByte(ipaddr net.IP) []byte

func ConvIntToIPv4

func ConvIntToIPv4(ipaddr uint32) net.IP

func ConvIntToIPv4NetworkOrder

func ConvIntToIPv4NetworkOrder(ipaddr uint32) net.IP

func CopyV6Bytes

func CopyV6Bytes(dest *[16]byte, src [16]byte)

func GetBPFMapPinPathFromPodIdentifier

func GetBPFMapPinPathFromPodIdentifier(podIdentifier string, direction string) string

func GetBPFPinPathFromPodIdentifier

func GetBPFPinPathFromPodIdentifier(podIdentifier string, direction string) string

func GetHostVethName

func GetHostVethName(podName, podNamespace string) string

func GetPodIdentifier

func GetPodIdentifier(podName, podNamespace string) string

func GetPodIdentifierFromBPFPinPath

func GetPodIdentifierFromBPFPinPath(pinPath string) (string, string)

func GetPodNamespacedName

func GetPodNamespacedName(podName, podNamespace string) string

func GetPolicyEndpointIdentifier

func GetPolicyEndpointIdentifier(policyName, policyNamespace string) string

func IsCatchAllIPEntry

func IsCatchAllIPEntry(ipAddr string) bool

func IsFileExistsError

func IsFileExistsError(error string) bool

func IsInvalidFilterListError

func IsInvalidFilterListError(error string) bool

func IsMissingFilterError

func IsMissingFilterError(error string) bool

func IsNonHostCIDR

func IsNonHostCIDR(ipAddr string) bool

Types

type ConntrackKeyV6

type ConntrackKeyV6 struct {
	Source_ip   [16]byte
	Source_port uint16
	Dest_ip     [16]byte
	Dest_port   uint16
	Protocol    uint8
}

func ConvByteToConntrackV6

func ConvByteToConntrackV6(keyByte []byte) ConntrackKeyV6

type ConntrackVal

type ConntrackVal struct {
	Value uint8
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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