Help us shape the future of Go! Take the 2026 Go Developer Survey

common

package
v0.8.19 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package common defines shared types and serialization protocols used between the earth debugger client and server.

Index

Constants

View Source
const (

	// TermID is a magic byte to identify the connection is from the terminal.
	TermID = 0x01

	// ShellID is a magic byte to identify the connection is from the shell.
	ShellID = 0x02
)
View Source
const (
	// StartShellSession identifies the start of a shell session data packet.
	StartShellSession = 0x01

	// EndShellSession identifies the end of a shell session data packet.
	EndShellSession = 0x02

	// PtyData identifies the pseudo terminal (pty) data payload packet.
	PtyData = 0x03

	// WinSizeData identifies the terminal window data payload packet.
	WinSizeData = 0x04
)
View Source
const (
	// DebuggerSettingsSecretsKey stores the secrets key name.
	DebuggerSettingsSecretsKey = "earthly_debugger_settings"

	// DebuggerDefaultSocketPath is the default socket to connect to (path is inside the container).
	DebuggerDefaultSocketPath = "/var/run/earthly_interactive"

	// DefaultSaveFileSocketPath is the default socket to connect to when sending back files
	// (path is inside the container).
	DefaultSaveFileSocketPath = "/var/run/earthly_save"
)

Variables

View Source
var (
	// ErrDataOverflow occurs when too much data is sent.
	ErrDataOverflow = errors.New("data overflow")

	// ErrDataUnderflow occurs when too little data is received.
	ErrDataUnderflow = errors.New("data underflow")
)

Functions

func ReadDataPacket

func ReadDataPacket(r io.Reader) (int, []byte, error)

ReadDataPacket decodes a data packet from the reader.

func ReadUint16PrefixedData

func ReadUint16PrefixedData(r io.Reader) ([]byte, error)

ReadUint16PrefixedData first reads a uint16 then reads that many bytes of data.

func SerializeDataPacket

func SerializeDataPacket(payloadID int, data []byte) ([]byte, error)

SerializeDataPacket returns a serialized a data packet.

func WriteDataPacket

func WriteDataPacket(w io.Writer, n int, data []byte) error

WriteDataPacket writes a data packet to the writer.

func WriteUint16PrefixedData

func WriteUint16PrefixedData(w io.Writer, data []byte) error

WriteUint16PrefixedData writes a uint16 representing the size of the data, followed by the data.

Types

type DebuggerSettings

type DebuggerSettings struct {
	SocketPath        string              `json:"socketPath"`
	Term              string              `json:"term"`
	SaveFiles         []SaveFilesSettings `json:"saveFiles"`
	DebugLevelLogging bool                `json:"debugLevel"`
	Enabled           bool                `json:"enabled"`
}

DebuggerSettings is used to pass settings to the debugger.

type SaveFilesSettings

type SaveFilesSettings struct {
	Src      string `json:"src"`
	Dst      string `json:"dst"`
	IfExists bool   `json:"ifExists"`
}

SaveFilesSettings is used to pass SAVE ARTIFACT ... AS LOCAL ... commands to the debugger which sends them back on failure.

Jump to

Keyboard shortcuts

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