strutils

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSize added in v1.0.0

func ParseSize(str string) (int, error)

func SizeWithSuffix added in v1.4.0

func SizeWithSuffix(size int) string

func UTF8FromBPFBytes

func UTF8FromBPFBytes(b []byte) string

UTF8FromBPFBytes transforms bpf (C) strings to valid utf-8 strings

NB(kkourt): strings we get from BPF/kernel are C strings: null-terminated sequence of bytes. They may or may not be valid utf-8 strings. This is true for pathnames (cwd, binary) as well as program arguments. Many of these fields, however, are represented as the protobuf string type, which always has to be utf-8 encoded.

This function ensures that by replacing all invalid runes with '�'.

Note that this approach means that we loose information. Alternatively, we could use strconf.Quote() or similar to quote the strings but this would add overhead and it will also break the way we 've been representing strings up until now. A better solution would be to update the fields in the proto description to be bytes, and let the proto clients (e.g., tetra CLI and JSON writer) choose their preffered approach.

func WriteUTF8FromBPFBytes added in v1.8.0

func WriteUTF8FromBPFBytes(b *strings.Builder, data []byte)

Types

This section is empty.

Jump to

Keyboard shortcuts

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