encoder

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidEvent       = errors.New("invalid event")
	ErrMissingProcessInfo = errors.New("process field is not set")
	ErrUnknownEventType   = errors.New("unknown event type")
)
View Source
var (
	CLONE_NEWCGROUP = 0x2000000
	CLONE_NEWIPC    = 0x8000000
	CLONE_NEWNET    = 0x40000000
	CLONE_NEWNS     = 0x20000
	CLONE_NEWPID    = 0x20000000
	CLONE_NEWTIME   = 0x80
	CLONE_NEWUSER   = 0x10000000
	CLONE_NEWUTS    = 0x4000000
)

Functions

func CapTrailorPrinter

func CapTrailorPrinter(str string, caps string) string

func HumanStackTrace added in v1.0.0

func HumanStackTrace(response *tetragon.GetEventsResponse, colorer *Colorer) string

func PrintNS

func PrintNS(ns int32) string

Types

type ColorMode

type ColorMode string

ColorMode defines color mode flags for compact output.

const (
	Always ColorMode = "always" // always enable colored output.
	Never  ColorMode = "never"  // disable colored output.
	Auto   ColorMode = "auto"   // automatically enable / disable colored output based on terminal settings.
)

type Colorer

type Colorer struct {
	Colors  []*color.Color
	Red     *color.Color
	Green   *color.Color
	Blue    *color.Color
	Cyan    *color.Color
	Magenta *color.Color
	Yellow  *color.Color
}

func NewColorer

func NewColorer(when ColorMode) *Colorer

func (*Colorer) ProcessInfo

func (c *Colorer) ProcessInfo(host string, process *tetragon.Process) (string, string)

type CompactEncoder

type CompactEncoder struct {
	Writer      io.Writer
	Colorer     *Colorer
	Timestamps  bool
	StackTraces bool
}

CompactEncoder encodes tetragon.GetEventsResponse in a short format with emojis and colors.

func NewCompactEncoder

func NewCompactEncoder(w io.Writer, colorMode ColorMode, timestamps bool, stackTraces bool) *CompactEncoder

NewCompactEncoder initializes and returns a pointer to CompactEncoder.

func (*CompactEncoder) Encode

func (p *CompactEncoder) Encode(v interface{}) error

Encode implements EventEncoder.Encode.

func (*CompactEncoder) EventToString

func (p *CompactEncoder) EventToString(response *tetragon.GetEventsResponse) (string, error)

type EventEncoder

type EventEncoder interface {
	Encode(v interface{}) error
}

EventEncoder is an interface for encoding tetragon.GetEventsResponse.

type ProtojsonEncoder added in v0.10.0

type ProtojsonEncoder struct {
	// contains filtered or unexported fields
}

func NewProtojsonEncoder added in v0.10.0

func NewProtojsonEncoder(w io.Writer) *ProtojsonEncoder

func (*ProtojsonEncoder) Encode added in v0.10.0

func (p *ProtojsonEncoder) Encode(v interface{}) error

type TtyEncoder added in v0.10.0

type TtyEncoder struct {
	Writer io.Writer
	Tty    string
}

func NewTtyEncoder added in v0.10.0

func NewTtyEncoder(w io.Writer, tty string) *TtyEncoder

func (*TtyEncoder) Encode added in v0.10.0

func (p *TtyEncoder) Encode(v interface{}) error

Encode implements EventEncoder.Encode.

Jump to

Keyboard shortcuts

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