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 ¶
- type Client
- func (c *Client) Audit(ctx context.Context, before int64, limit int) ([]store.AuditEvent, error)
- func (c *Client) CheckExpose(ctx context.Context) (daemon.ExposeCheck, error)
- func (c *Client) CreateAccessToken(ctx context.Context, req daemon.AccessTokenRequest) (daemon.AccessToken, error)
- func (c *Client) CreateJoinToken(ctx context.Context, req daemon.TokenRequest) (daemon.Token, error)
- func (c *Client) CreateSandbox(ctx context.Context, req daemon.CreateRequest) (daemon.Sandbox, error)
- func (c *Client) Download(ctx context.Context, name, src string) (io.ReadCloser, error)
- func (c *Client) Exec(ctx context.Context, name string, req agent.ExecRequest, ...) (*agent.Session, error)
- func (c *Client) Expose(ctx context.Context, req daemon.ExposeRequest) (daemon.Expose, error)
- func (c *Client) GetSandbox(ctx context.Context, name string) (daemon.Sandbox, error)
- func (c *Client) Health(ctx context.Context) error
- func (c *Client) Info(ctx context.Context) (daemon.Info, error)
- func (c *Client) JoinPool(ctx context.Context, token string) (daemon.JoinPoolResponse, error)
- func (c *Client) ListAccessTokens(ctx context.Context) ([]daemon.AccessToken, error)
- func (c *Client) ListExposes(ctx context.Context) ([]daemon.Expose, error)
- func (c *Client) ListNodes(ctx context.Context) ([]daemon.Node, error)
- func (c *Client) ListSandboxes(ctx context.Context) ([]daemon.Sandbox, error)
- func (c *Client) ListSnapshots(ctx context.Context) ([]daemon.Snapshot, error)
- func (c *Client) Login(ctx context.Context) error
- func (c *Client) Logs(ctx context.Context, name string, follow bool) (io.ReadCloser, error)
- func (c *Client) PauseSandbox(ctx context.Context, name string) (daemon.Sandbox, error)
- func (c *Client) Promote(ctx context.Context) (daemon.PromoteResponse, error)
- func (c *Client) RemoveSandbox(ctx context.Context, name string, force bool) (daemon.Sandbox, error)
- func (c *Client) RemoveSnapshot(ctx context.Context, name string) (daemon.Snapshot, error)
- func (c *Client) ResumeSandbox(ctx context.Context, name string) (daemon.Sandbox, error)
- func (c *Client) RevokeAccessToken(ctx context.Context, id string) error
- func (c *Client) RevokeJoinToken(ctx context.Context, token string) error
- func (c *Client) SetLabels(ctx context.Context, labels []string) ([]string, error)
- func (c *Client) SnapshotSandbox(ctx context.Context, name, snapshot string) (daemon.Snapshot, error)
- func (c *Client) StartDesktop(ctx context.Context, name string) (agent.Desktop, error)
- func (c *Client) StartSandbox(ctx context.Context, name string) (daemon.Sandbox, error)
- func (c *Client) StopSandbox(ctx context.Context, name string) (daemon.Sandbox, error)
- func (c *Client) Unexpose(ctx context.Context, sandbox string, port int) error
- func (c *Client) Upload(ctx context.Context, name, dest string, tar io.Reader) error
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 Remote ¶
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 ¶
Audit returns the head's audit events, newest first. This is local-only: scoped remote tokens cannot read other callers' actions.
func (*Client) CheckExpose ¶
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 ¶
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) GetSandbox ¶
GetSandbox returns the sandbox with the given name.
func (*Client) ListAccessTokens ¶
ListAccessTokens returns this head's access tokens, oldest first.
func (*Client) ListExposes ¶
ListExposes returns the head's exposed ports, oldest first.
func (*Client) ListSandboxes ¶
ListSandboxes returns every sandbox on this node, oldest first.
func (*Client) ListSnapshots ¶
ListSnapshots returns every snapshot on this node, oldest first.
func (*Client) Logs ¶
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 ¶
PauseSandbox pauses the named sandbox. The result's Warning is set if the backend stopped it instead, losing its memory.
func (*Client) Promote ¶
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 ¶
RemoveSnapshot deletes the named snapshot. Sandboxes started from it are not affected.
func (*Client) ResumeSandbox ¶
ResumeSandbox resumes the named paused sandbox.
func (*Client) RevokeAccessToken ¶
RevokeAccessToken makes the access token with the given ID invalid.
func (*Client) RevokeJoinToken ¶
RevokeJoinToken makes an unused join token invalid. Only its hash is sent to the daemon.
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 ¶
StartDesktop starts the on-demand display on the sandbox's owning node.
func (*Client) StartSandbox ¶
StartSandbox boots the named sandbox from its kept disk.
func (*Client) StopSandbox ¶
StopSandbox stops the named sandbox. The result's Warning is set if it did not shut down cleanly.