app

package
v0.1.41 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: AGPL-3.0 Imports: 41 Imported by: 0 modules, 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

Overview

Package app assembles the shared panel services and HTTP surface for each edition.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackgroundJob

type BackgroundJob struct {
	Name string
	Run  func(context.Context)
}

BackgroundJob is one long-lived VPS worker. The edge runs only the bounded phases listed in edge_tick.go.

type Config

type Config struct {
	Store              *store.Store
	Vault              *vault.Vault
	Auth               *auth.Service
	Limiter            securitylimit.Limiter
	MasterKey          []byte
	Clock              func() time.Time
	Logger             *slog.Logger
	Instance           InstanceConfig
	DecoyDir           string
	PanelAddr          string
	DataDir            string
	UpdateService      string
	Title              string
	HealthBlipWindow   time.Duration
	BackgroundStarters []BackgroundJob
	AfterResponse      access.AfterResponseRunner
	// Remote is the edge edition's node link. Setting it makes this the edge edition (fleet does the same): Me says so,
	// and the RPCs that start work the edge does not run yet refuse with unavailable_in_edition.
	Remote fleet.Remote
	// ProvisionForward makes this panel hand SSH installs to the Provisioner (the edge Worker that holds the sockets): the
	// ProvisioningService calls and the install page are answered, after the sign-in check, with a marker that the Worker
	// turns into a request to that object. Without it, and without SSHClient, they are served here (and refused on the edge).
	ProvisionForward bool
	// ProvisionKick wakes the Provisioner (edge: set its alarm). The cron pass calls it while installs are pending; a
	// Provisioner calls it when an install is queued. Nil: nothing to wake.
	ProvisionKick func(context.Context) error
	// SSHClient makes this panel the one that runs the installs (the Provisioner): it dials through it. Nil: the default
	// client of the VPS edition.
	SSHClient *nodeprovision.Client
	// NodeBinaries is where an install gets the agent binary; nil: the update service (the signed bundle on disk).
	NodeBinaries nodeprovision.BinarySource
}

Config contains the edition-specific dependencies and settings for the shared panel.

type InstanceConfig

type InstanceConfig struct {
	PublicURL   string
	AdminHost   string
	AdminPrefix string
	AdminListen string
	RPID        string
	RPOrigins   []string
	AgentSNI    string
	SubPrefix   string
	LinkPrefix  string // secret path prefix of the signed agent WebSocket link; empty = not served by this handler
}

InstanceConfig is the stored reachability and WebAuthn configuration used by the panel.

func (InstanceConfig) AdminURL

func (in InstanceConfig) AdminURL() string

AdminURL is the address the owner opens in a browser.

func (InstanceConfig) MuxPrefix

func (in InstanceConfig) MuxPrefix() string

MuxPrefix is empty unless the admin lives under a secret path prefix.

type Panel

type Panel struct {
	Handler        http.Handler
	Server         *httpserver.Server
	Fleet          *fleet.Fleet
	Access         *access.Service
	Health         *health.Service
	Blocklist      *blocklist.Service
	Update         *update.Service
	Warp           *warp.Service
	Provision      *nodeprovision.Service
	Backup         *backup.Service
	Telegram       *telegram.Service
	Store          *store.Store
	Desired        func(ctx context.Context, nodeID string) ([]statehash.Inbound, error)
	BackgroundJobs []BackgroundJob
	// Surface is what Handler serves (see roles.go).
	Surface Surface
	// contains filtered or unexported fields
}

Panel is the assembled panel: its public HTTP handler, VPS listener adapter and services.

func Build

func Build(c Config) (*Panel, error)

Build wires services into the HTTP handler shared by the VPS and edge editions: every role in one process.

func BuildAdmin added in v0.1.41

func BuildAdmin(c Config) (*Panel, error)

BuildAdmin is the admin Worker: Build without the public mounts, the agent link and the agent endpoint, which other Workers serve (their prefixes are only checked), and with the install calls answered by the marker for the Provisioner.

func BuildJobs added in v0.1.41

func BuildJobs(c Config) (*Panel, error)

BuildJobs is the scheduled-work Worker: the services EdgeTick runs, and no HTTP surface.

func BuildLink(c Config) (*Panel, error)

BuildLink is the link Worker: the agent link under its secret prefix (the node's Durable Object calls the fleet through mgPanel.link; link-only enrolment arrives here as HTTP) and the decoy for everything else.

func BuildProvision added in v0.1.41

func BuildProvision(c Config) (*Panel, error)

BuildProvision is the Provisioner Worker: the admin surface with the ProvisioningService and the install page only, served for real, with the SSH client of c. The admin Worker forwards the calls to it after its own sign-in check.

func BuildPublic added in v0.1.41

func BuildPublic(c Config) (*Panel, error)

BuildPublic is the public Worker: the subscriptions, the person's page, the brand logo and the decoy, under the secret subscription prefix. It builds only the fleet (to tell the nodes that state changed, and who is online) and access that the subscription handler needs, and no auth service: c.Auth may be nil.

func (*Panel) EdgeTick added in v0.1.31

func (p *Panel) EdgeTick(ctx context.Context, now time.Time) error

EdgeTick runs the scheduled work shared by the edge edition. Each pass gets a fresh timeout so one slow job does not consume another job's budget; all passes still inherit the invocation deadline.

type Surface added in v0.1.41

type Surface struct {
	AdminAPI     []string // the Connect services behind the session, as AdminHandler.Path (without the built-in auth and instance services)
	AdminPages   []string
	PublicMounts []string // secret prefixes
	Link         string   // secret prefix of the agent link, "" = none
	MCP          bool
	Preview      bool // the admin's preview of the person's page
}

Surface lists what a Panel serves over HTTP.

Jump to

Keyboard shortcuts

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