base

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildProfilingStat

func BuildProfilingStat(ps *process.Process) (*profiling.Info, error)

BuildProfilingStat use to build the profiling info for profiling

func DurationMustNotNull

func DurationMustNotNull(err error, confKey, confValue string) (time.Duration, error)

func EntityIsSameWithProtocol

func EntityIsSameWithProtocol(processEntity *api.ProcessEntity, protocolEntity *v3.EBPFProcessEntityMetadata) bool

func ParseLabels

func ParseLabels(labelStr string) []string

func RegexMustNotNull

func RegexMustNotNull(err error, confKey, confValue string) (*regexp.Regexp, error)

func StringMustNotNull

func StringMustNotNull(err error, confKey, confValue string) error

Types

type BuildEBPFProcessContext

type BuildEBPFProcessContext struct {
	HostIP string
}

type FinderBaseConfig

type FinderBaseConfig interface {
	// ActiveFinder to detect process
	ActiveFinder() bool
}

type ProcessFinder

type ProcessFinder interface {
	// Init the finder before Start
	Init(ctx context.Context, conf FinderBaseConfig, manager ProcessManager) error
	// Start to detect process
	Start()
	// Stop the process detect
	Stop() error
	// DetectType of Process is detecting
	DetectType() api.ProcessDetectType

	// ShouldMonitor validate the process needs to be monitored, if true, then add it into the storage
	ShouldMonitor(pid int32) bool

	// ValidateProcessIsSame between two same finder process
	ValidateProcessIsSame(p1, p2 api.DetectedProcess) bool

	// BuildEBPFProcess is transform the process entity as backend protocol data
	BuildEBPFProcess(ctx *BuildEBPFProcessContext, process api.DetectedProcess) *v3.EBPFProcessProperties
	// BuildNecessaryProperties is getting minimize necessary properties when keep alive
	BuildNecessaryProperties(process api.DetectedProcess) []*commonv3.KeyStringValuePair
	// ParseProcessId is means how to read the process id receive from backend
	ParseProcessID(process api.DetectedProcess, downstream *v3.EBPFProcessDownstream) string
}

ProcessFinder is defined how to detect the process and communicate with backend

type ProcessManager

type ProcessManager interface {
	GetModuleManager() *module.Manager
	// SyncAllProcessInFinder is mean synchronized all processes data from current ProcessFinder
	SyncAllProcessInFinder(processes []api.DetectedProcess)
	// AddDetectedProcess only add the specific processes
	AddDetectedProcess(processes []api.DetectedProcess)
}

ProcessManager is an API work for help ProcessFinder synchronized process with backend

type TemplateBuilder

type TemplateBuilder struct {
	Name     string
	Template string
	// contains filtered or unexported fields
}

func NewTemplateBuilder

func NewTemplateBuilder(name, content string) (*TemplateBuilder, error)

func TemplateMustNotNull

func TemplateMustNotNull(err error, confKey, confValue string) (*TemplateBuilder, error)

func (*TemplateBuilder) Execute

func (t *TemplateBuilder) Execute(data interface{}) (string, error)

type TemplateProcess

type TemplateProcess struct {
	*process.Process
}

func NewTemplateProcess

func NewTemplateProcess(manager *module.Manager, p *process.Process) *TemplateProcess

NewTemplateProcess is generated the process context for render

func (*TemplateProcess) CommandLine

func (p *TemplateProcess) CommandLine() (string, error)

CommandLine command line of process

func (*TemplateProcess) ExeFilePath

func (p *TemplateProcess) ExeFilePath() (string, error)

ExeFilePath Execute file path

func (*TemplateProcess) ExeName

func (p *TemplateProcess) ExeName() (string, error)

ExeName Execute file name

func (*TemplateProcess) ExeNameInCommandLine added in v0.3.0

func (p *TemplateProcess) ExeNameInCommandLine() (string, error)

ExeNameInCommandLine means the executed file name in the command line string

func (*TemplateProcess) Pid

func (p *TemplateProcess) Pid() int32

Pid of process

func (*TemplateProcess) WorkDir

func (p *TemplateProcess) WorkDir() (string, error)

WorkDir means which directory to run the execute file

type TemplateRover

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

func NewTemplateRover

func NewTemplateRover(manager *module.Manager) *TemplateRover

NewTemplateRover is generated the Rover context for render

func (*TemplateRover) HostIPV4

func (t *TemplateRover) HostIPV4(name string) (string, error)

HostIPV4 ip v4 address of local machine from appoint net interface name

func (*TemplateRover) HostIPV6

func (t *TemplateRover) HostIPV6(name string) (string, error)

HostIPV6 ip v6 address of local machine from appoint net interface name

func (*TemplateRover) HostName

func (t *TemplateRover) HostName() string

HostName name of local machine

func (*TemplateRover) InstanceID

func (t *TemplateRover) InstanceID() string

InstanceID of rover

Jump to

Keyboard shortcuts

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