Documentation
¶
Overview ¶
Package protocol defines the signed, versioned managed-release contract. It contains no host execution or caller-selected commands and paths.
Index ¶
- Constants
- Variables
- func SafeVersion(s string) bool
- func ValidDigest(s string) bool
- func ValidVersion(c Component, s string) bool
- type Artifact
- type Component
- type Failure
- type FailureCode
- type Manifest
- func (m Manifest) Admit(source Versions, network, failedRelease string) error
- func (m Manifest) AdmitInstalled(source Versions, network, failedRelease string) error
- func (m Manifest) Affected(source Versions) []Component
- func (m Manifest) Artifact(c Component) Artifact
- func (m Manifest) Target(source Versions) Versions
- func (m Manifest) Validate() error
- type Review
- type Status
- type Versions
Constants ¶
const Protocol = 1
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 ¶
var Components = []Component{Bitcoin, LND, Syncthing}
Functions ¶
func SafeVersion ¶
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 ValidVersion ¶
Types ¶
type Artifact ¶
Artifact hashes bind upstream downloads to the maintainer's tested bytes. Upstream signatures are also checked before any service is stopped.
type Failure ¶
type Failure struct {
Code FailureCode `json:"code"`
Service Component `json:"service,omitempty"`
}
Failure names an update failure that Node Updates knows how to explain. The worker saves it beside the raw error. The installed screen maps a code it knows to the exact next step and gives its general advice for any other, so a later release may add codes. A code keeps its meaning in every release. A new meaning gets a new code.
type FailureCode ¶
type FailureCode string
FailureCode is the short name of a known failure.
const ( // FailureStopFailed means the service did not stop cleanly, and no new // files were installed. FailureStopFailed FailureCode = "stop_failed" // FailureStartInterrupted means a start was cut off, for example by a // restart, and the service is not running its new program. FailureStartInterrupted FailureCode = "start_interrupted" // FailureServiceNotRunning means the service was not active at the node // check. FailureServiceNotRunning FailureCode = "service_not_running" // FailureServiceChanged means the service was running a different // program than the installed one at the node check. FailureServiceChanged FailureCode = "service_changed" )
The codes this release saves. Service names the service each one is about.
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 (Manifest) AdmitInstalled ¶
AdmitInstalled is Admit for a plan the installed helper read with Admission.
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"`
// Steps and StepNumber are the worker's list and the step in progress,
// counted from 1. Both are empty when the record holds no usable list.
Steps []string `json:"steps,omitempty"`
StepNumber int `json:"step_number,omitempty"`
Error string `json:"error,omitempty"`
Failure *Failure `json:"failure,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.