Documentation
¶
Overview ¶
Package server assembles the roles a mainplane-server process runs. Today that is one role, harness.
Index ¶
Constants ¶
const (
Dir = worker.HarnessDir
)
Variables ¶
var Conf = filepath.Join(Dir, "config.json")
Conf is the config the installed harness runs from.
Functions ¶
func Harness ¶
Harness runs the harness role on one loopback port, behind the user's own tunnel or a quick one, until ctx ends or the listener, the mesh node or the tunnel fails: /id proves the harness key to anyone before they send a secret, /ts2021 coordinates the mesh, /derp relays between its nodes, connectors call every other route with an api key, every session that was open on start resumes. The harness joins its own mesh, and workers dial it there. The pointer and the relay map follow the tunnel's URL. The config at path is read again when it changes: providers and links apply at once.
func Install ¶
Install makes this machine run the harness at every boot, from a copy of an expanded c at Conf, and returns its URL once it answers there. Dir is root's alone: the copy holds the keys.
func SetTunnel ¶ added in v0.2.0
SetTunnel makes the installed harness reached through t, or through a quick tunnel when t is nil, restarts it, and returns its URL once it answers there. Workers follow through the pointer.
func Uninstall ¶ added in v0.1.1
func Uninstall() error
Uninstall stops the harness and removes its service and binary. Dir stays: it holds the sessions.
Types ¶
type Config ¶
type Config struct {
Admin string `json:"admin"` // directory holding sessions, the auth table and the tunnel
HTTP string `json:"http"` // loopback address the tunnel carries connectors and workers to
Tunnel *Tunnel `json:"tunnel,omitempty"` // the user's own; none is a quick tunnel
Providers map[string]Provider `json:"providers"`
Links [][2]string `json:"links,omitempty"` // pairs of workers, by name, that reach each other on the mesh
}
Config is the self-hosted config file. Provider values are expanded from the environment, so a key can be "$ANTHROPIC_API_KEY".
func Default ¶ added in v0.1.1
func Default() Config
Default is the config install writes when given none: the tunnel carries workers and connectors to port 8080 on loopback, sessions live under Dir, and every provider whose key is set in this environment serves. With none set, keys go in the config after install.