Documentation
¶
Overview ¶
Package web is hamstack's browser dashboard: the services and their state, controls, links to the programs' own web UIs, and desktop programs or the whole desktop in the browser through noVNC. The dashboard is the only way in: the VNC servers listen on localhost, and the dashboard relays a browser's WebSocket to them only after a login.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPassword ¶
CheckPassword reports whether pw matches a hash made by HashPassword.
func HashPassword ¶
HashPassword returns "pbkdf2-sha256$ITERATIONS$SALT$KEY" (salt and key in base64).
func SavePasswordHash ¶
SavePasswordHash writes the hash to file, readable by its owner only.
Types ¶
type App ¶
type App struct {
Name string `json:"name"`
Title string `json:"title"`
Package string `json:"package"`
Installed bool `json:"installed"`
Running bool `json:"running"`
Radio bool `json:"radio"` // uses the radio's sound card
}
App is one desktop program the dashboard can open in the browser.
type Backend ¶
type Backend interface {
State() State
Control(service, verb string) error // verb: start, stop, restart
OpenApp(name string) error // start the program on its display (stopping the HF modem first if it needs the radio)
CloseApp(name string) error
OpenDesktop() error
CloseDesktop() error
Target(name string) (port int, ok bool) // the localhost VNC port of a running program, or of "desktop"
}
Backend is what the dashboard needs from hamstack.
type ManagementBackend ¶
type ManagementBackend interface {
ManagementState() any
Manage(ManagementRequest) (any, error)
}
type ManagementRequest ¶
type Options ¶
type Options struct {
Addr string // ":443"
CertFile string
KeyFile string
PasswordFile string
NoVNCPath func() string // dynamically resolve assets after installing them
NoVNCDir string // noVNC's web files; "" if noVNC is not installed
Logf func(format string, args ...any)
}
Options configure the server.
type RemoteCheck ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the dashboard.
func (*Server) ListenAndServe ¶
ListenAndServe serves the dashboard over HTTPS. A renewed certificate is picked up on the next connection, with no restart.
type Service ¶
type Service struct {
Name string `json:"name"` // "rigctld@hf", "pat"
What string `json:"what"` // "rig control"
State string `json:"state"` // "running", "stopped", "failed", "no radio", "starting", "not installed"
Since string `json:"since,omitempty"`
Enabled bool `json:"enabled"` // starts at login/boot
Control bool `json:"control"` // the dashboard may start and stop it
LinkPort int `json:"linkPort,omitempty"` // its own web UI, on this computer, if any
Scheme string `json:"scheme,omitempty"` // "http" or "https"
Note string `json:"note,omitempty"` // for instance "web UI on this computer only"
}
Service is one row of the services table.
type State ¶
type State struct {
BrowserReady bool `json:"browserReady"`
Updates updates.Snapshot `json:"updates"`
Pending []string `json:"pending"`
Notices []string `json:"notices"`
Reboot bool `json:"reboot"`
RemoteChecks []RemoteCheck `json:"remoteChecks"`
DesktopNote string `json:"desktopNote"`
Station string `json:"station"`
Site string `json:"site"`
Grid string `json:"grid"`
RadioUser string `json:"radioUser,omitempty"` // the program that has the radio's sound card now
Services []Service `json:"services"`
Apps []App `json:"apps"`
Desktop bool `json:"desktop"` // the computer's desktop can be shared
DesktopRunning bool `json:"desktopRunning"`
}
State is what the dashboard shows.