common

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: Apache-2.0 Imports: 5 Imported by: 11

Documentation

Index

Constants

View Source
const (

	// CHeaderFileName is the name of the C header file for BPF programs for a
	// particular endpoint.
	CHeaderFileName = "ep_config.h"

	// EndpointStateFileName is used as the file name for the JSON representation
	// of endpoint state.
	EndpointStateFileName = "ep_config.json"
)

Variables

This section is empty.

Functions

func C2GoArray

func C2GoArray(str string) []byte

C2GoArray transforms an hexadecimal string representation into a byte slice. Example: str := "0x12, 0xff, 0x0, 0x1" fmt.Print(C2GoArray(str)) //`{0x12, 0xFF, 0x0, 0x01}`"

func GoArray2C

func GoArray2C(array []byte) string

GoArray2C transforms a byte slice into its hexadecimal string representation. Example: array := []byte{0x12, 0xFF, 0x0, 0x01} fmt.Print(GoArray2C(array)) // "{ 0x12, 0xff, 0x0, 0x1 }"

func GoArray2CNoSpaces

func GoArray2CNoSpaces(array []byte) string

GoArray2CNoSpaces does the same as GoArray2C, but no spaces are used in the final output. Example: array := []byte{0x12, 0xFF, 0x0, 0x01} fmt.Print(GoArray2CNoSpaces(array)) // "{0x12,0xff,0x0,0x1}"

func MergeChannels added in v1.17.0

func MergeChannels[T any](chans ...<-chan T) <-chan T

func RequireRootPrivilege

func RequireRootPrivilege(cmd string)

RequireRootPrivilege checks if the user running cmd is root. If not, it exits the program

Types

This section is empty.

Directories

Path Synopsis