dashboard

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 32 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 dashboard is the local web page behind the tray (design 5): server status, agents, links, adding clients and remotes. It only listens on loopback and only answers the browser that opened its one-time link.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dashboard

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

Dashboard serves the local page.

func Listen

func Listen(opts Options) (*Dashboard, error)

Listen starts the dashboard.

func (*Dashboard) AfterInstall added in v0.1.1

func (d *Dashboard) AfterInstall(preset, action string)

AfterInstall turns a preset on in the server config once it is installed, and off once it is removed. Agents written by hand are left alone.

func (*Dashboard) Close

func (d *Dashboard) Close() error

Close stops the dashboard.

func (*Dashboard) Handler

func (d *Dashboard) Handler() http.Handler

Handler is the dashboard's HTTP handler (exported for tests).

func (d *Dashboard) NewLink() string

NewLink issues a fresh one-time link, for example when the tray is clicked again.

func (*Dashboard) URL

func (d *Dashboard) URL() string

URL is the link that opens the dashboard. Without a password it is a one-time link; open it again through the tray, which calls NewLink.

type Options

type Options struct {
	// Server returns the running server, or nil when this machine runs none (yet).
	Server func() *server.Server
	// ConfigPath is the --config value ("" for the default); ConfigFile is the
	// file the dashboard writes when it sets up a server.
	ConfigPath string
	ConfigFile string
	Version    string
	// StartServer starts the server after the dashboard wrote its config.
	StartServer func() error
	// Reload re-reads the config after the dashboard changed tokens.
	Reload func() error
	// StartTunnel starts the configured tunnel, for example after installing cloudflared.
	StartTunnel func() error
	// TunnelError returns cloudflared's last error line, if any.
	TunnelError func() string

	// Listen is the address to serve on; default a random loopback port.
	Listen string
	// Password switches from one-time links to a login form, for a dashboard
	// reached over the network (Docker). Empty means one-time links.
	Password string
	// Terminal adds a shell in the browser.
	Terminal bool
	// Installer installs agents from the dashboard; nil hides it.
	Installer *installer.Installer
	// Env is the environment of terminal shells; nil means os.Environ().
	Env    []string
	Logger *slog.Logger
}

Options configure the dashboard.

Jump to

Keyboard shortcuts

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