protocol

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ShutdownReasonSignal = "signal"

Variables

This section is empty.

Functions

This section is empty.

Types

type CompleteMessage

type CompleteMessage struct {
	Type      string          `json:"type"`
	RequestID string          `json:"request_id"`
	TaskID    string          `json:"task_id"`
	ExitCode  int32           `json:"exit_code"`
	Error     string          `json:"error,omitempty"`
	Result    json.RawMessage `json:"result,omitempty"`
	Canceled  bool            `json:"canceled,omitempty"`
}

type ProtocolError

type ProtocolError struct {
	Code      string
	Message   string
	RequestID string
}

func (*ProtocolError) Error

func (e *ProtocolError) Error() string

type Registration

type Registration struct {
	RunnerID    string `json:"runner_id"`
	FleetID     string `json:"fleet_id"`
	AccessToken string `json:"access_token"`
	Ephemeral   bool   `json:"ephemeral"`
}

Registration is the identity and revocable credential returned after the server consumes a generic or task-specific registration token.

func Register

func Register(
	ctx context.Context,
	client *http.Client,
	baseURL string,
	registrationToken string,
	details RegistrationDetails,
) (Registration, error)

type RegistrationDetails

type RegistrationDetails struct {
	Version  string            `json:"version"`
	OS       string            `json:"os"`
	Arch     string            `json:"arch"`
	Hostname string            `json:"hostname"`
	Tags     map[string]string `json:"tags,omitempty"`
}

type Session

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

Session owns reconnects and serializes all writes for each WebSocket.

func NewSession

func NewSession(config SessionConfig) (*Session, error)

func (*Session) Cancellations

func (s *Session) Cancellations() <-chan string

func (*Session) Complete

func (s *Session) Complete(ctx context.Context, message CompleteMessage) error

func (*Session) RequestShutdown

func (s *Session) RequestShutdown(reason string)

func (*Session) Run

func (s *Session) Run(ctx context.Context) error

func (*Session) Tasks

func (s *Session) Tasks() <-chan json.RawMessage

type SessionConfig

type SessionConfig struct {
	BaseURL          string
	Registration     Registration
	Version          string
	ReconnectMin     time.Duration
	ReconnectMax     time.Duration
	ReadTimeout      time.Duration
	WriteTimeout     time.Duration
	HandshakeTimeout time.Duration
	MessageLimit     int64
	Dialer           *websocket.Dialer
}

Jump to

Keyboard shortcuts

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