Documentation
¶
Overview ¶
Package server assembles the roles a mainplane-server process runs. Today that is one role, harness.
Index ¶
- Variables
- func Auth(dir string) auth.Store
- func Harness(ctx context.Context, path string) error
- func Install(c *Config, keep bool) error
- func Key(dir string) (ed25519.PrivateKey, error)
- func Reached(key string) (string, error)
- func SetTunnel(t *Tunnel) (string, error)
- func Uninstall() error
- func Up(path string) error
- func Update(v string) error
- type Config
- type DataSharing
- type Network
- type Provider
- type Tunnel
Constants ¶
This section is empty.
Variables ¶
Dir is the installed harness's, and Conf the config it runs from. Admin serves the sessions drive from Dir on Linux.
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, links and drives apply at once.
func Install ¶
Install makes this machine run the harness at every boot, from a copy of an expanded c at Conf, or with keep from the config already there, as it is, which c becomes, and makes it the worker admin. It returns while the tunnel starts: the tokens it prints name no URL, and Reached waits for one. Dir is root's and the operator's alone: the config holds the keys, and admin runs code as the operator so that it may read and edit them.
func Key ¶ added in v0.5.0
func Key(dir string) (ed25519.PrivateKey, error)
Key is the harness key every token carries, made on first use.
func Reached ¶ added in v0.5.2
Reached waits for the pointer to name a URL where the harness with key proves it, through Cloudflare, as a worker finds it, and returns that URL. A tunnel that stops the harness fails it at once.
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, and the worker admin. Dir stays: it holds the sessions.
Types ¶
type Config ¶
type Config struct {
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
Drives map[string]coordinator.Drive `json:"drives,omitempty"` // by name: each one's server and workers
DataSharing *DataSharing `json:"data_sharing,omitempty"` // whether the user has opted in to data sharing; none: not asked yet
}
Config is the self-hosted config file. Provider values are expanded from the environment, so a key can be "$ANTHROPIC_API_KEY". The directory it is in is the harness's: the harness key, the auth table, the mesh and the tunnel are there, and sessions in sessions/ under it, the one directory a drive may ever share.
func Default ¶ added in v0.1.1
func Default() Config
Default is the config install writes when given none and none is installed: the tunnel carries workers and connectors to port 8080 on loopback, and every provider whose key is set in this environment serves. With none set, keys go in the config after install.
type DataSharing ¶ added in v0.5.6
type DataSharing struct {
At time.Time `json:"at,omitzero"`
Via string `json:"via,omitempty"`
Text string `json:"text,omitempty"`
}
DataSharing is the answer to data sharing permission: which, when, through which connector, and to which words.
type Network ¶ added in v0.5.2
Network is what a person types to make a machine a worker of the harness: its name on the pointer, then its device code.
func Cycle ¶ added in v0.5.2
Cycle gives the installed harness a new device code. Its workers stay; a machine joins with the new code only.
func LoadNetwork ¶ added in v0.5.2
LoadNetwork is the network of the harness in dir.
type Provider ¶
type Provider struct {
Shape string `json:"shape"`
Key string `json:"key,omitempty"` // none for a shape that logs in
URL string `json:"url,omitempty"` // the base url its SDK takes; none is the vendor's own
Region string `json:"region,omitempty"` // bedrock
Session string `json:"session,omitempty"` // the header the session's routing key goes in, for a server that routes its cache on one
}
Provider is one the config names. Its name is free, and the catalog's ids are the names connectors know; its shape picks the code.