localstatus

package
v0.1.0-alpha.1 Latest Latest
Warning

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

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

Documentation

Overview

Package localstatus is the small channel between a running hub and the tools on the same machine (the console and `regulus status`): a Unix socket in the data directory, readable only by the user that runs the hub. It carries no login; the file permissions are the proof of who may ask.

Index

Constants

View Source
const SocketName = "regulus.sock"

SocketName is the file name of the socket inside the data directory.

Variables

This section is empty.

Functions

func Handler

func Handler(get func() Status) http.Handler

Handler serves the status as JSON at /status.

func SocketPath

func SocketPath(dataDir string) string

SocketPath is where the hub of dataDir listens for local tools.

Types

type Agent

type Agent struct {
	ID            string    `json:"id"`
	Hostname      string    `json:"hostname,omitempty"`
	Version       string    `json:"version,omitempty"`
	Status        string    `json:"status"`
	LastHeartbeat time.Time `json:"last_heartbeat,omitzero"`
}

Agent is a connected agent.

type Status

type Status struct {
	Version   string    `json:"version"`
	StartedAt time.Time `json:"started_at"`
	// Addr is where the dashboard is bound; AgentAddr where remote agents
	// connect, or "" while that is off.
	Addr         string `json:"addr"`
	AgentAddr    string `json:"agent_addr,omitempty"`
	BuiltinAgent bool   `json:"builtin_agent"`
	// SetupToken is the one-time token to create the first admin; it is
	// empty once the admin exists.
	SetupToken string  `json:"setup_token,omitempty"`
	Agents     []Agent `json:"agents"`
}

Status is what a running hub reports about itself.

func Fetch

func Fetch(ctx context.Context, dataDir string) (Status, error)

Fetch asks the hub of dataDir for its status. The error is not nil when no hub is listening there.

Jump to

Keyboard shortcuts

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