app

package
v0.1.40 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: 35 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
	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
	// 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.

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.

Jump to

Keyboard shortcuts

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