protocol

package
v0.7.0-rc.11 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: AGPL-3.0 Imports: 9 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 protocol defines the signed, versioned managed-release contract. It contains no host execution or caller-selected commands and paths.

Index

Constants

View Source
const Protocol = 1
View Source
const WorkerUnit = "vpn-update.service"

WorkerUnit is the systemd unit that runs an update. Its journal holds the full text of a worker failure.

Variables

View Source
var Components = []Component{Bitcoin, LND, Syncthing}

Functions

func SafeVersion

func SafeVersion(s string) bool

SafeVersion accepts a version in a format this build may not know. Such text is only shown, stored and compared for equality, so it must be short and free of control and path characters.

func ValidDigest

func ValidDigest(s string) bool

func ValidVersion

func ValidVersion(c Component, s string) bool

Types

type Artifact

type Artifact struct {
	Version string `json:"version"`
	SHA256  string `json:"sha256"`
}

Artifact hashes bind upstream downloads to the maintainer's tested bytes. Upstream signatures are also checked before any service is stopped.

type Component

type Component string
const (
	Bitcoin   Component = "bitcoin"
	LND       Component = "lnd"
	Syncthing Component = "syncthing"
)

type Manifest

type Manifest struct {
	Protocol       int         `json:"protocol"`
	Version        string      `json:"version"`
	Platform       string      `json:"platform"`
	Summary        string      `json:"summary"`
	MinimumFreeMiB int64       `json:"minimum_free_mib"`
	Sources        []Versions  `json:"sources"`
	Networks       []string    `json:"networks"`
	Bitcoin        Artifact    `json:"bitcoin"`
	LND            Artifact    `json:"lnd"`
	Syncthing      Artifact    `json:"syncthing"`
	HostSteps      []string    `json:"host_steps"`
	HostServices   []Component `json:"host_services,omitempty"`
	// RecoveryFrom identifies exact failed VPN archive digests. A corrective
	// release must explicitly acknowledge the interrupted release as well as
	// the observed executable combination in Sources.
	RecoveryFrom []string `json:"recovery_from,omitempty"`
	// Bridge optionally names one earlier release. A node this plan does not
	// admit is told to install that release first.
	Bridge string `json:"bridge,omitempty"`
}

func Admission

func Admission(data []byte, selected, current string, source Versions, network, failed string) (Manifest, string, error)

Admission is how an installed helper reads a signed plan. The helper stays in service for later releases, so it ignores fields it does not know; the target worker reads the same plan in full with Decode. Admission returns either a plan that admits this node, or the release to install first.

func Decode

func Decode(data []byte) (Manifest, error)

func (Manifest) Admit

func (m Manifest) Admit(source Versions, network, failedRelease string) error

func (Manifest) AdmitInstalled

func (m Manifest) AdmitInstalled(source Versions, network, failedRelease string) error

AdmitInstalled is Admit for a plan the installed helper read with Admission.

func (Manifest) Affected

func (m Manifest) Affected(source Versions) []Component

Affected includes unchanged dependencies that must be stopped and restarted.

func (Manifest) Artifact

func (m Manifest) Artifact(c Component) Artifact

func (Manifest) Target

func (m Manifest) Target(source Versions) Versions

func (Manifest) Validate

func (m Manifest) Validate() error

Validate is the full check used by release authoring and by the worker.

type Review

type Review struct {
	Token    string   `json:"token"`
	Digest   string   `json:"digest"`
	Manifest Manifest `json:"manifest"`
	Source   Versions `json:"source"`
	Network  string   `json:"network"`
	// UpdateFirst is guidance instead of a review: the selected release does
	// not admit this node, and its plan names this release to install first.
	// Such an answer has no token and cannot be approved.
	UpdateFirst string `json:"update_first,omitempty"`
	// KeyServerUnreachable tells the operator that the release key was
	// checked without the key server, so a revocation published only there
	// was not seen. It belongs to the review and is not kept in a job.
	KeyServerUnreachable bool `json:"key_server_unreachable,omitempty"`
}

type Status

type Status struct {
	ID            string `json:"id"`
	Version       string `json:"version"`
	Phase         string `json:"phase"`
	Step          string `json:"step"`
	Error         string `json:"error,omitempty"`
	Active        bool   `json:"active"`
	Running       bool   `json:"running"`
	Cancellable   bool   `json:"cancellable"`
	WalletNetwork string `json:"wallet_network,omitempty"`
}

Status deliberately excludes local paths, credentials and raw command output.

type Versions

type Versions struct {
	VPN       string `json:"vpn"`
	Bitcoin   string `json:"bitcoin"`
	LND       string `json:"lnd"`
	Syncthing string `json:"syncthing"`
}

Versions is an exact tested combination, not independently combinable ranges. Syncthing is empty only when the optional component is absent.

func (Versions) Get

func (v Versions) Get(c Component) string

Jump to

Keyboard shortcuts

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