messenger

package
v0.0.0-...-cabf8b7 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageIncomingTopic  string = "message.incoming"
	MessageOutgoingTopic  string = "message.outgoing"
	MessengerStartedTopic string = "messenger.started"
	TraceResponse         string = "trace.response"
	TraceRequest          string = "trace.request"
)

Variables

This section is empty.

Functions

func New

func New(eventBus *eventbus.EventBus, logger logr.Logger) *messenger

Types

type Answer

type Answer struct {
	ID      string `json:"id"`
	Command string `json:"command"`
	Answer  string `json:"answer,omitempty"`
	Error   string `json:"error,omitempty"`
}

type Command

type Command struct {
	Context    CommandContext `json:"task_context,omitempty"`
	ID         string         `json:"id,omitempty"`
	Command    string         `json:"command"`
	Name       string         `json:"name,omitempty"`
	Code       []byte         `json:"code,omitempty"`
	Entrypoint string         `json:"entrypoint,omitempty"`
	Data       string         `json:"data,omitempty"`
	IsMessage  bool           `json:"is_message,omitempty"`
}

func GetCommand

func GetCommand(msg Message) (Command, error)

type CommandContext

type CommandContext struct {
	UID          int          `json:"uid,omitempty"`
	GID          int          `json:"gid,omitempty"`
	PID          int          `json:"pid,omitempty"`
	CommandName  string       `json:"command_name,omitempty"`
	CommandPath  string       `json:"command_path,omitempty"`
	NamespaceIDs NamespaceIDs `json:"namespace_ids,omitempty"`
	CGroupPath   string       `json:"cgroup_path,omitempty"`
}

func (CommandContext) UniqueString

func (c CommandContext) UniqueString() string

type Message

type Message struct {
	Type MessageType `json:"type"`
	Data []byte      `json:"data"`
}

func NewCommand

func NewCommand(cmd Command) Message

func (*Message) SetData

func (m *Message) SetData(v any) error

func (Message) Unmarshal

func (m Message) Unmarshal(v any) error

type MessageType

type MessageType string
const AnswerMessageType MessageType = "answer"
const CommandMessageType MessageType = "command"

type NamespaceIDs

type NamespaceIDs struct {
	UTS     int64 `json:"uts,omitempty"`
	IPC     int64 `json:"ipc,omitempty"`
	Mount   int64 `json:"mount,omitempty"`
	PID     int64 `json:"pid,omitempty"`
	Network int64 `json:"network,omitempty"`
	Time    int64 `json:"time,omitempty"`
	CGroup  int64 `json:"cGroup,omitempty"`
}

type TraceRequestAction

type TraceRequestAction string
const (
	AddTraceRequestAction      TraceRequestAction = "add"
	RemoveTraceRequestAction   TraceRequestAction = "remove"
	ClearAllTraceRequestAction TraceRequestAction = "clear_all"
)

type TraceRequestMessage

type TraceRequestMessage struct {
	*trace_v1_api.TraceRequest `json:",inline"`
	Action                     TraceRequestAction `json:"action"`
}

Jump to

Keyboard shortcuts

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