Documentation
¶
Overview ¶
Package attach is the chassis head a machine dials with `txco attach` (chassis/attached): three public HTTP routes.
POST /v1/attach/code what a one-use code is for, without spending it POST /v1/attach/enroll spend the code and enroll the key that signed GET /v1/attach the link, a WebSocket carrying yamux streams
OFF by default: `attach` must appear in `--personalities`. It is then served ONE of two ways:
- ON THE WEB HEAD, with no port of its own, when --attach-public-url names a host and --attach-listen-addrs is empty. The web head hands every request for exactly that hostname to this head (MountHost, as the ipp head is mounted) and no stack ever sees one. This is how a fleet runs it: one more hostname at the edge, nothing else.
- ON A LISTENER OF ITS OWN, when --attach-listen-addrs is set. For a chassis that wants the head apart from its web head, and for `txco dev --attach`, where every stack shares the hostname localhost.
The routes authenticate their own callers (a code, then a key), so the head is meant to be reached from the internet, behind the same edge as every other host.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller owns the attach listeners.
func NewController ¶
NewController constructs (but does not start) the head. svc is nil on a chassis that serves no attached workspaces; the head then stays off.
func (*Controller) Addrs ¶
func (c *Controller) Addrs() []string
Addrs returns the addresses the listeners are bound to (":0" resolved).
func (*Controller) Handler ¶ added in v0.2.64
func (c *Controller) Handler() http.Handler
Handler is the head's three routes, for the web head to mount or for a listener of its own to serve.
func (*Controller) MountHost ¶ added in v0.2.64
func (c *Controller) MountHost() string
MountHost is the hostname the web head should hand to this head, or "" when the head is off or has a listener of its own. It is the host of --attach-public-url, without a port: the name machines dial.
func (*Controller) Start ¶
func (c *Controller) Start()
Start binds the head's own listeners, when it has any. Mounted on the web head there is nothing to bind: the web head is already serving it.
func (*Controller) Stop ¶
func (c *Controller) Stop()
Stop closes the listeners and every link. A machine told `shutdown` dials again, to whichever node answers.