remote

package
v0.0.0-...-e436aa5 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License: GPL-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandCompletedType = "command-completed"
	CommandRunningType   = "command-running"
	CommandErroredType   = "command-errored"
	CommandCanceledType  = "command-canceled"
	CommandHeartbeatType = "command-heartbeat"
)

Variables

This section is empty.

Functions

func ListenForConnections

func ListenForConnections()

ListenForConnections is the entrypoint. Listens for, and processes, the remote requests.

func Setup

func Setup(remoteToken string, useWebsockets bool, wpCLIPath string, wpPath string, eventsWebhookURL string)

Setup configures the module (not super ideal, but this module needs some reworking to make it better)

Types

type Clock

type Clock interface {
	Now() time.Time
}

type CommandCompleted

type CommandCompleted struct {
	GUID      string `json:"guid"`
	EventType string `json:"event"`
	Timestamp int64  `json:"timestamp"`
	ExitCode  int    `json:"exit_code"`
	Success   bool   `json:"success"`
}

func (CommandCompleted) EventTypeValue

func (c CommandCompleted) EventTypeValue() string

func (CommandCompleted) GUIDValue

func (c CommandCompleted) GUIDValue() string

type Event

type Event interface {
	GUIDValue() string
	EventTypeValue() string
}

type EventSender

type EventSender interface {
	Send(ctx context.Context, e Event) error
}

type NopSender

type NopSender struct {
}

func NewNopSender

func NewNopSender() *NopSender

func (*NopSender) Send

func (sender *NopSender) Send(ctx context.Context, e Event) error

type WebhookSender

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

func NewWebhookSender

func NewWebhookSender(client *http.Client, endpoint string, token string) *WebhookSender

func (*WebhookSender) Send

func (sender *WebhookSender) Send(ctx context.Context, e Event) error

Jump to

Keyboard shortcuts

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