bridge

package
v0.1.46 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: AGPL-3.0 Imports: 38 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Rendered for js/wasm

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 OpCron

func OpCron(api js.Value)

OpCron is mgPanel.cron: the scheduled work (EdgeTick).

func OpFetch

func OpFetch(api js.Value)

OpFetch is mgPanel.fetch: one buffered HTTP request through the role's handler.

func OpLink(api js.Value)

OpLink is mgPanel.link: one step of the agent link for the NodeLink Durable Object.

func OpProvision

func OpProvision(api js.Value)

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.

func Run

func Run(role Role)

Run publishes mgPanel for the role and keeps the program alive. It does not return.

Types

type Op

type Op func(api js.Value)

Op adds one member to mgPanel.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL