admin

package
v0.14.0 Latest Latest
Warning

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

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

Documentation

Overview

Package admin is the local unix-socket administration API used by the CLI while the agent holds its lock.

Index

Constants

View Source
const SocketName = "admin.sock"

SocketName is the socket file name inside the state directory.

Variables

This section is empty.

Functions

func Handler

func Handler(b Backend) http.Handler

Handler exposes the backend over HTTP.

func Serve

func Serve(ctx context.Context, dir string, b Backend) error

Serve listens on dir/admin.sock (mode 0600) until ctx ends.

Types

type Backend

type Backend interface {
	Status(ctx context.Context) (any, error)
	Investigate(ctx context.Context, req InvestigateRequest) (any, error)
	// Export writes an export file (protocol.ExportWriter format) of spooled records above fromSeq.
	Export(ctx context.Context, fromSeq uint64, w io.Writer) error
	Deenroll(ctx context.Context, reason string) error
	Commit(ctx context.Context, r CommitReceipt) error
}

Backend is implemented by each role.

type Client

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

Client talks to a running agent's admin socket.

func Dial

func Dial(dir string) *Client

Dial returns a client for dir/admin.sock.

func (*Client) Commit

func (c *Client) Commit(ctx context.Context, r CommitReceipt) error

Commit applies an air-gap commit receipt.

func (*Client) Deenroll

func (c *Client) Deenroll(ctx context.Context, reason string) error

Deenroll asks the agent to de-enroll.

func (*Client) Export

func (c *Client) Export(ctx context.Context, fromSeq uint64, w io.Writer) error

Export streams an export file into w.

func (*Client) Investigate

func (c *Client) Investigate(ctx context.Context, req InvestigateRequest) (json.RawMessage, error)

Investigate runs a tool and returns its JSON result.

func (*Client) Status

func (c *Client) Status(ctx context.Context) (json.RawMessage, error)

Status returns the agent status document.

type CommitReceipt

type CommitReceipt struct {
	Epoch     string `json:"epoch"`
	Seq       uint64 `json:"seq"`
	ChainHash string `json:"chain_hash"`
}

CommitReceipt is an air-gap import receipt confirming the committed head.

type InvestigateRequest

type InvestigateRequest struct {
	Tool string          `json:"tool"`
	Args json.RawMessage `json:"args"`
}

InvestigateRequest runs one investigation tool locally.

Jump to

Keyboard shortcuts

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