utils

package
v0.0.0-...-13344a5 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHasBTF = errors.New("vmlinux has .BTF section")

Functions

func Download

func Download(ctx context.Context, url string, dest io.Writer) error

Download downloads a file from a given URL, and writes it to a given destination, which can be a file or a pipe

func DownloadFile

func DownloadFile(ctx context.Context, url string, file string) error

func Exists

func Exists(p string) bool

func ExtractVmlinuxFromRPM

func ExtractVmlinuxFromRPM(ctx context.Context, rpmPath string, vmlinuxPath string) error
func GetLinks(ctx context.Context, repoURL string) ([]string, error)

GetLinks returns a list of links from a given URL

func HasBTFSection

func HasBTFSection(name string) (bool, error)

HasBTFSection checks if the given ELF file has a .BTF section.

func RunCMD

func RunCMD(ctx context.Context, cwd string, binary string, args ...string) error

func RunZypperCMD

func RunZypperCMD(ctx context.Context, args ...string) (*bytes.Buffer, error)

func SudoCMD

func SudoCMD(binary string, args ...string) (string, []string)

Types

type ProgressCounter

type ProgressCounter struct {
	Ctx  context.Context
	Op   string
	Size uint64
	Name string
	// contains filtered or unexported fields
}

func (*ProgressCounter) Write

func (wc *ProgressCounter) Write(p []byte) (int, error)

Write implements the io.Writer interface and is used to count the number of bytes written to the underlying writer.

Jump to

Keyboard shortcuts

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