Documentation
¶
Overview ¶
Package bridge is the JavaScript side of the edge Workers' wasm: the init options, the promise and request/response plumbing, the after-response task runner, the adapters for the Worker's bindings (D1, node link, limiter, SSH sockets) and the mgPanel object a Worker script calls. Each Worker has a wasm of its own (cmd/mistgate-edge-*) that calls Run with its Role, which names what it builds and which mgPanel members it has; cmd/mistgate-edge is the one with every role.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpProvision ¶
OpProvision is mgPanel.provision: one pass of the Provisioner's install queue. Only a role with this operation gets the SSH client into its wasm.
Types ¶
type Role ¶
type Role struct {
Name string
// Build assembles the panel of this role (app.Build, app.BuildAdmin ...).
Build func(app.Config) (*app.Panel, error)
// Auth says whether the role needs the auth service: every role but the public one.
Auth bool
// CreatesInstance says whether this Worker creates the instance (the prefixes, the agent name, the WebAuthn identity) on a
// database that has none, and offers the setup token. The admin does; every other Worker answers errNoInstance until the
// admin has been opened once.
CreatesInstance bool
// Ops are the members of mgPanel besides init, which every role has. A role lists only the operations it serves, so the
// code behind the others is not linked into its wasm; calling an operation the role lacks is a TypeError in the Worker.
Ops []Op
}
Role is what one Worker's wasm is: the panel it builds and the members of mgPanel it exposes.