backup

package
v0.1.90-dev.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 51 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEncryptedArchive

func CreateEncryptedArchive(ctx context.Context, dataDir, snapshotDB string, masterKey []byte, appVersion, recipientText string, created time.Time, dst io.Writer) error

CreateEncryptedArchive snapshots the panel's durable data into an age-encrypted, versioned tar.gz stream. The files of the data directory are streamed into it, not copied first: their hashes are taken in a first pass (the manifest leads the archive), and a file that changes before it is written fails the backup.

func CreateEncryptedArchiveWithRecipient added in v0.1.80

func CreateEncryptedArchiveWithRecipient(ctx context.Context, dataDir, snapshotDB string, masterKey []byte, appVersion string, recipient age.Recipient, created time.Time, dst io.Writer) error

CreateEncryptedArchiveWithRecipient snapshots the panel's durable data into an age-encrypted, versioned tar.gz stream using a prepared age recipient. CreateEncryptedArchive is the recovery-recipient form used by scheduled backups.

func RestoreEncryptedArchive

func RestoreEncryptedArchive(ctx context.Context, src io.Reader, identities []age.Identity, destination string) error

RestoreEncryptedArchive decrypts and validates a v1 backup into a new data directory. It refuses any existing target and never follows archive paths or archive links.

func RunCLI

func RunCLI(args []string, out io.Writer) error

RunCLI runs the offline backup recovery commands. The private identity is read only by restore and is never sent to the running panel or an object store.

Types

type ArchiveInfo added in v0.1.80

type ArchiveInfo struct {
	AppVersion string
	CreatedAt  time.Time
}

ArchiveInfo is the public, non-secret summary carried by a verified archive manifest.

func RestoreEncryptedArchiveWithInfo added in v0.1.80

func RestoreEncryptedArchiveWithInfo(ctx context.Context, src io.Reader, identities []age.Identity, destination string) (ArchiveInfo, error)

RestoreEncryptedArchiveWithInfo is RestoreEncryptedArchive plus the verified manifest's public metadata.

type Config

type Config struct {
	Store     *store.Store
	Vault     *vault.Vault
	DataDir   string
	MasterKey []byte
	StepUp    func(context.Context) error
	// Edge is the edge edition: no scheduled or manual backup runs there yet (R2), so those RPCs refuse.
	Edge bool
	// RestorePanelData hands a prepared stage to the update service's privileged helper.
	RestorePanelData func(context.Context, RestoreRequest, func() error) error
	// DeleteKeptData delegates deletion beside the data directory to the privileged panel-update helper.
	DeleteKeptData func(context.Context, string) error
	// RestoreHelperRunning reports the shared panel-update helper's in-progress state.
	RestoreHelperRunning func() bool
	// OnResult is told how every backup ended: "" when it worked, else the error code (backup_storage_failed, ...). The
	// Telegram alerts hang on it. It must not block.
	OnResult func(code string)
	Log      *slog.Logger
}

type RestoreRequest added in v0.1.80

type RestoreRequest struct {
	StageDir      string
	Source        string
	FileName      string
	MadeByVersion string
	RequestedUnix int64
}

RestoreRequest is the public metadata passed to the VPS restore helper. It contains no recovery key.

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config) (*Service, error)

func (*Service) DownloadHandler added in v0.1.80

func (s *Service) DownloadHandler() (string, http.Handler)

DownloadHandler is mounted beside the Connect admin services under the same session and cross-origin protection.

func (*Service) Handler

func (s *Service) Handler(opts ...connect.HandlerOption) (string, http.Handler)

func (*Service) Run

func (s *Service) Run(ctx context.Context)

Jump to

Keyboard shortcuts

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