gojue

package module
v0.0.0-...-4ed1dda Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: Apache-2.0 Imports: 12 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.

README

Go Jue framework

Go, Just Use eBPF

gojue is a Golang Cli application framework

Documentation

Index

Constants

View Source
const (
	ServiceTypeCli      int = 1
	ServiceTypeMicroSrv int = 2
)
View Source
const (
	PROBE_TYPE_UPROBE = "uprobe"
	PROBE_TYPE_KPROBE = "kprobe"
	PROBE_TYPE_TP     = "tracepoint"
	PROBE_TYPE_XDP    = "XDP"
)
View Source
const (
	ELF_TYPE_BIN uint8 = 1
	ELF_TYPE_SO  uint8 = 2
)
View Source
const (
	X86_BINARY_PREFIX    = "/lib/x86_64-linux-gnu"
	OTHERS_BINARY_PREFIX = "/usr/lib"
)
View Source
const KERNEL_LESS_5_2_PREFIX = "_less52.o"

Variables

This section is empty.

Functions

func GetAllModules

func GetAllModules() map[string]IModule

GetModules 获取modules列表

func NewJueServer

func NewJueServer(c *goJueConfig, opts ...RunOption) (*goJueSrv, error)

func Register

func Register(p IModule)

Types

type EventType

type EventType uint8
const (
	// EventTypeOutput upload to server or write to logfile.
	EventTypeOutput EventType = iota

	// EventTypeModuleData set as module cache data
	EventTypeModuleData

	// EventTypeEventProcessor display by event_processor.
	EventTypeEventProcessor
)

type IClose

type IClose interface {
	Close() error
}

type IConfig

type IConfig interface {
	Check() error //检测配置合法性
	GetPid() uint64
	GetUid() uint64
	GetHex() bool
	GetDebug() bool
	GetNoSearch() bool
	SetPid(uint64)
	SetUid(uint64)
	SetHex(bool)
	SetDebug(bool)
	SetNoSearch(bool)
	EnableGlobalVar() bool //
}

type IEventStruct

type IEventStruct interface {
	Decode(payload []byte) (err error)
	Payload() []byte
	PayloadLen() int
	String() string
	StringHex() string
	Clone() IEventStruct
	EventType() EventType
	GetUUID() string
}

type IModule

type IModule interface {
	// Init 初始化
	Init(context.Context, *log.Logger, IConfig) error

	// Name 获取当前module的名字
	Name() string

	// Run 事件监听感知
	Run() error

	// Start 启动模块
	Start() error

	// Stop 停止模块
	Stop() error

	// Close 关闭退出
	Close() error

	SetChild(module IModule)

	Decode(*ebpf.Map, []byte) (IEventStruct, error)

	Events() []*ebpf.Map

	DecodeFun(p *ebpf.Map) (IEventStruct, bool)

	Dispatcher(IEventStruct)
}

func GetModuleByName

func GetModuleByName(modName string) IModule

GetModulesByName 根据模块名获取modules列表

type Module

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

func (*Module) Close

func (this *Module) Close() error

func (*Module) Decode

func (this *Module) Decode(em *ebpf.Map, b []byte) (event IEventStruct, err error)

func (*Module) DecodeFun

func (this *Module) DecodeFun(p *ebpf.Map) (IEventStruct, bool)

func (*Module) Dispatcher

func (this *Module) Dispatcher(e IEventStruct)

写入数据,或者上传到远程数据库,写入到其他chan 等。

func (*Module) Events

func (this *Module) Events() []*ebpf.Map

func (*Module) Init

func (this *Module) Init(ctx context.Context, logger *log.Logger, conf IConfig)

Init 对象初始化

func (*Module) Name

func (this *Module) Name() string

func (*Module) Run

func (this *Module) Run() error

func (*Module) SetChild

func (this *Module) SetChild(module IModule)

func (*Module) Start

func (this *Module) Start() error

func (*Module) Stop

func (this *Module) Stop() error

type RunOption

type RunOption func(*goJueSrv)

RunOption defines the method to customize a Server.

Directories

Path Synopsis
cli
cmd

Jump to

Keyboard shortcuts

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