common

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: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLogContext

type AccessLogContext struct {
	BPF            *bpf.Loader
	Queue          *Queue
	ConnectionMgr  *ConnectionManager
	Config         *Config
	RuntimeContext context.Context
}

type ActiveConnection

type ActiveConnection struct {
	RandomID       uint64
	PID            uint32
	SocketFD       uint32
	Role           uint32
	SocketFamily   uint32
	Protocol       uint8
	SSL            uint8
	SkipDataUpload uint8
	// PAD for make sure it have same size when marshal data to the BPF
	PAD0 uint8
	PAD1 uint32
}

type CloseEventWithNotify

type CloseEventWithNotify struct {
	*events.SocketCloseEvent
	// contains filtered or unexported fields
}

type Config

type Config struct {
	module.Config

	Active            bool                  `mapstructure:"active"`
	ExcludeNamespaces string                `mapstructure:"exclude_namespaces"`
	ExcludeClusters   string                `mapstructure:"exclude_cluster"`
	Flush             FlushConfig           `mapstructure:"flush"`
	ProtocolAnalyze   ProtocolAnalyzeConfig `mapstructure:"protocol_analyze"`
}

func (*Config) IsActive

func (c *Config) IsActive() bool

type ConnectEventWithSocket

type ConnectEventWithSocket struct {
	*events.SocketConnectEvent
	SocketPair *ip.SocketPair
}

type ConnectionInfo

type ConnectionInfo struct {
	ConnectionID  uint64
	RandomID      uint64
	RPCConnection *v3.AccessLogConnection
	MarkDeletable bool
	PID           uint32
}

type ConnectionManager

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

func NewConnectionManager

func NewConnectionManager(config *Config, moduleMgr *module.Manager, bpfLoader *bpf.Loader) *ConnectionManager

func (*ConnectionManager) AddNewProcess

func (c *ConnectionManager) AddNewProcess(pid int32, entities []api.ProcessInterface)

func (*ConnectionManager) AddProcessListener

func (c *ConnectionManager) AddProcessListener(listener ProcessListener)

func (*ConnectionManager) Find

func (c *ConnectionManager) Find(event events.Event) *ConnectionInfo

func (*ConnectionManager) OnBuildConnectionLogFinished

func (c *ConnectionManager) OnBuildConnectionLogFinished()

OnBuildConnectionLogFinished notify the connection log build finished

func (*ConnectionManager) OnConnectEvent

func (c *ConnectionManager) OnConnectEvent(event *events.SocketConnectEvent, pair *ip.SocketPair)

func (*ConnectionManager) OnConnectionClose

func (c *ConnectionManager) OnConnectionClose(event *events.SocketCloseEvent) *CloseEventWithNotify

func (*ConnectionManager) OnNewProcessExecuting

func (c *ConnectionManager) OnNewProcessExecuting(pid int32)

func (*ConnectionManager) ProcessIsMonitor

func (c *ConnectionManager) ProcessIsMonitor(pid uint32) bool

func (*ConnectionManager) RecheckAllProcesses

func (c *ConnectionManager) RecheckAllProcesses(processes map[int32][]api.ProcessInterface)

func (*ConnectionManager) RegisterProcessor

func (c *ConnectionManager) RegisterProcessor(processor ConnectionProcessor)

func (*ConnectionManager) RemoveProcess

func (c *ConnectionManager) RemoveProcess(pid int32, entities []api.ProcessInterface)

func (*ConnectionManager) SkipAllDataAnalyze

func (c *ConnectionManager) SkipAllDataAnalyze(conID, ranID uint64)

func (*ConnectionManager) Start

func (c *ConnectionManager) Start()

func (*ConnectionManager) Stop

func (c *ConnectionManager) Stop()

type ConnectionProcessFinishCallback

type ConnectionProcessFinishCallback func()

type ConnectionProcessor

type ConnectionProcessor interface {
	OnConnectionClose(event *events.SocketCloseEvent, callback ConnectionProcessFinishCallback)
}

type FlushConfig

type FlushConfig struct {
	MaxCountOneStream int    `mapstructure:"max_count"`
	Period            string `mapstructure:"period"`
}

type KernelLog

type KernelLog struct {
	Type  LogType
	Event events.Event
}

type LogType

type LogType int
const (
	LogTypeConnect LogType = iota
	LogTypeKernelTransfer
	LogTypeClose
)

type ProcessListener

type ProcessListener interface {
	OnNewProcessMonitoring(pid int32)
	OnProcessRemoved(pid int32)
}

type ProtocolAnalyzeConfig

type ProtocolAnalyzeConfig struct {
	PerCPUBufferSize string `mapstructure:"per_cpu_buffer"`
	Parallels        int    `mapstructure:"parallels"`
	QueueSize        int    `mapstructure:"queue_size"`
}

type ProtocolLog

type ProtocolLog struct {
	KernelLogs []*events.SocketDetailEvent
	Protocol   *v3.AccessLogProtocolLogs
}

type Queue

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

func NewQueue

func NewQueue(maxFlushCount int, period time.Duration, consumer QueueConsumer) *Queue

func (*Queue) AppendKernelLog

func (q *Queue) AppendKernelLog(tp LogType, event events.Event)

func (*Queue) AppendProtocolLog

func (q *Queue) AppendProtocolLog(kernelLogs []*events.SocketDetailEvent, protocol *v3.AccessLogProtocolLogs)

func (*Queue) Start

func (q *Queue) Start(ctx context.Context)

type QueueConsumer

type QueueConsumer interface {
	Consume(kernels chan *KernelLog, protocols chan *ProtocolLog)
}

Jump to

Keyboard shortcuts

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