client

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package client talks to the local Boxpool daemon over its unix socket, or to a head over the network with an access token.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a client for the daemon serving one state directory, or for a remote head.

func New

func New(stateDir string) *Client

New returns a client for the daemon whose state directory is stateDir.

func Remote

func Remote(addr, token string) (*Client, error)

Remote returns a client for the head at addr, host:port, with an access token, which also pins the head's CA.

func (*Client) Audit

func (c *Client) Audit(ctx context.Context, before int64, limit int) ([]store.AuditEvent, error)

Audit returns the head's audit events, newest first. This is local-only: scoped remote tokens cannot read other callers' actions.

func (*Client) CheckExpose

func (c *Client) CheckExpose(ctx context.Context) (daemon.ExposeCheck, error)

CheckExpose checks the head's Tailscale prerequisites without creating a URL.

func (*Client) CreateAccessToken

func (c *Client) CreateAccessToken(ctx context.Context, req daemon.AccessTokenRequest) (daemon.AccessToken, error)

CreateAccessToken returns a new access token for this head's API.

func (*Client) CreateJoinToken

func (c *Client) CreateJoinToken(ctx context.Context, req daemon.TokenRequest) (daemon.Token, error)

CreateJoinToken returns a new single-use join token for this node's pool.

func (*Client) CreateSandbox

func (c *Client) CreateSandbox(ctx context.Context, req daemon.CreateRequest) (daemon.Sandbox, error)

CreateSandbox returns the sandbox named req.Name, started, creating it if there is none.

func (*Client) Download

func (c *Client) Download(ctx context.Context, name, src string) (io.ReadCloser, error)

Download returns src in the named sandbox as a tar rooted at its base name. The tar comes from the guest, so it is untrusted. The caller must read to EOF to detect interrupted transfers, then close it.

func (*Client) Exec

func (c *Client) Exec(ctx context.Context, name string, req agent.ExecRequest, stdout, stderr io.Writer) (*agent.Session, error)

Exec starts a command in the named sandbox through the daemon, which relays the agent's exec protocol unchanged.

func (*Client) Expose

func (c *Client) Expose(ctx context.Context, req daemon.ExposeRequest) (daemon.Expose, error)

Expose serves a sandbox's port at a URL on the head.

func (*Client) GetSandbox

func (c *Client) GetSandbox(ctx context.Context, name string) (daemon.Sandbox, error)

GetSandbox returns the sandbox with the given name.

func (*Client) Health

func (c *Client) Health(ctx context.Context) error

Health returns nil when the daemon reports itself healthy.

func (*Client) Info

func (c *Client) Info(ctx context.Context) (daemon.Info, error)

Info returns the daemon's description of itself and its node.

func (*Client) JoinPool

func (c *Client) JoinPool(ctx context.Context, token string) (daemon.JoinPoolResponse, error)

JoinPool joins this node to the pool named in token.

func (*Client) ListAccessTokens

func (c *Client) ListAccessTokens(ctx context.Context) ([]daemon.AccessToken, error)

ListAccessTokens returns this head's access tokens, oldest first.

func (*Client) ListExposes

func (c *Client) ListExposes(ctx context.Context) ([]daemon.Expose, error)

ListExposes returns the head's exposed ports, oldest first.

func (*Client) ListNodes

func (c *Client) ListNodes(ctx context.Context) ([]daemon.Node, error)

ListNodes returns the head of this machine's pool and its nodes.

func (*Client) ListSandboxes

func (c *Client) ListSandboxes(ctx context.Context) ([]daemon.Sandbox, error)

ListSandboxes returns every sandbox on this node, oldest first.

func (*Client) ListSnapshots

func (c *Client) ListSnapshots(ctx context.Context) ([]daemon.Snapshot, error)

ListSnapshots returns every snapshot on this node, oldest first.

func (*Client) Login

func (c *Client) Login(ctx context.Context) error

Login validates this access token and records the login on the head.

func (*Client) Logs

func (c *Client) Logs(ctx context.Context, name string, follow bool) (io.ReadCloser, error)

Logs reads a sandbox's console, or this daemon's log when name is empty. Close the returned stream to stop following it.

func (*Client) PauseSandbox

func (c *Client) PauseSandbox(ctx context.Context, name string) (daemon.Sandbox, error)

PauseSandbox pauses the named sandbox. The result's Warning is set if the backend stopped it instead, losing its memory.

func (*Client) Promote

func (c *Client) Promote(ctx context.Context) (daemon.PromoteResponse, error)

Promote makes this machine its pool's head, from its replica of the pool's state, once the old head is gone.

func (*Client) RemoveSandbox

func (c *Client) RemoveSandbox(ctx context.Context, name string, force bool) (daemon.Sandbox, error)

RemoveSandbox deletes the named sandbox and frees its resources. Without force the daemon refuses a running sandbox; with it, it stops it first.

func (*Client) RemoveSnapshot

func (c *Client) RemoveSnapshot(ctx context.Context, name string) (daemon.Snapshot, error)

RemoveSnapshot deletes the named snapshot. Sandboxes started from it are not affected.

func (*Client) ResumeSandbox

func (c *Client) ResumeSandbox(ctx context.Context, name string) (daemon.Sandbox, error)

ResumeSandbox resumes the named paused sandbox.

func (*Client) RevokeAccessToken

func (c *Client) RevokeAccessToken(ctx context.Context, id string) error

RevokeAccessToken makes the access token with the given ID invalid.

func (*Client) RevokeJoinToken

func (c *Client) RevokeJoinToken(ctx context.Context, token string) error

RevokeJoinToken makes an unused join token invalid. Only its hash is sent to the daemon.

func (*Client) SetLabels

func (c *Client) SetLabels(ctx context.Context, labels []string) ([]string, error)

SetLabels replaces this machine's labels and returns them as stored.

func (*Client) SnapshotSandbox

func (c *Client) SnapshotSandbox(ctx context.Context, name, snapshot string) (daemon.Snapshot, error)

SnapshotSandbox copies the named sandbox's disk to a new snapshot called snapshot. The daemon stops a running sandbox for the copy and starts it again. The result's Warning is set if it did not stop cleanly.

func (*Client) StartDesktop

func (c *Client) StartDesktop(ctx context.Context, name string) (agent.Desktop, error)

StartDesktop starts the on-demand display on the sandbox's owning node.

func (*Client) StartSandbox

func (c *Client) StartSandbox(ctx context.Context, name string) (daemon.Sandbox, error)

StartSandbox boots the named sandbox from its kept disk.

func (*Client) StopSandbox

func (c *Client) StopSandbox(ctx context.Context, name string) (daemon.Sandbox, error)

StopSandbox stops the named sandbox. The result's Warning is set if it did not shut down cleanly.

func (*Client) Unexpose

func (c *Client) Unexpose(ctx context.Context, sandbox string, port int) error

Unexpose stops serving a sandbox's port and revokes its token.

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, name, dest string, tar io.Reader) error

Upload extracts a tar stream into the existing directory dest in the named sandbox.

Jump to

Keyboard shortcuts

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