serverrelease

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 21 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 serverrelease finds, verifies and downloads a released Checkend server: a GitHub release of Checkend/checkend with a signed manifest (checkend-release.json, format 1), the Worker bundle, the migrations and the digest of the Docker image. `ce server install` installs only a release that this package verified.

The order of the checks: the SSH signature (`ssh-keygen -Y sign`, namespace checkend-server-release) of the exact manifest bytes with a trusted key, then the manifest, then its tag and commit against the GitHub release, then each asset by its size and SHA-256 when it is downloaded.

Index

Constants

View Source
const DefaultAPI = "https://api.github.com/repos/Checkend/checkend"

DefaultAPI is the GitHub API of the server repo.

View Source
const ImageRepository = "ghcr.io/checkend/checkend"

ImageRepository is the only image repository that a manifest can name.

View Source
const Namespace = "checkend-server-release"

Namespace is the SSH signature namespace of a server release manifest. The manifest is signed with `ssh-keygen -Y sign -n checkend-server-release` (the CLI releases use another namespace and another key).

View Source
const NoRelease = "No Checkend server release is published yet."

NoRelease is the message when no server release has a manifest yet.

Variables

View Source
var ProxyRepositories = map[string]string{
	"caddy":       "docker.io/library/caddy",
	"cloudflared": "docker.io/cloudflare/cloudflared",
}

ProxyRepositories are the only repositories that a proxy image can have.

View Source
var TrustedKeys = map[string]string{

	"server-2026": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPLnE0XiMd0q3TgIYSsvGK3FPZZGVMvE/8DCkNm3y3fy",
}

TrustedKeys are the public keys that sign the server releases: key ID to an ed25519 key as `ssh-keygen` prints it ("ssh-ed25519 AAAA…"). A new key is added here before its first release; an old key stays until no supported release uses it.

Functions

func Compare

func Compare(a, b string) int

Compare compares two versions (1.2.3, with an optional -prerelease): -1, 0 or 1. A version that is not valid is the lowest.

Types

type Asset

type Asset struct {
	Name   string `json:"asset"`
	SHA256 string `json:"sha256"`
	Size   int64  `json:"size"`
}

Asset is a file of the release, checked by its size and SHA-256.

type Binding

type Binding struct {
	Type     string `json:"type"`
	Name     string `json:"name"`
	Required bool   `json:"required"`
}

Binding is a binding of the Worker. Optional bindings can be offered by the installer.

type Image

type Image struct {
	Repository string   `json:"repository"`
	Tag        string   `json:"tag"`
	Digest     string   `json:"digest"`
	Platforms  []string `json:"platforms"`
}

Image is the Docker image of the release.

func (Image) Ref

func (i Image) Ref() string

Ref is the image pinned by its digest, for example ghcr.io/checkend/checkend@sha256:….

type Manifest

type Manifest struct {
	Format        int    `json:"format"`
	Version       string `json:"version"`
	Tag           string `json:"tag"`
	Commit        string `json:"commit"`
	PublishedAt   string `json:"published_at"`
	MinCLIVersion string `json:"min_cli_version"`
	Migrations    struct {
		Asset
		Latest string `json:"latest"`
		Count  int    `json:"count"`
	} `json:"migrations"`
	Worker struct {
		Asset
		MainModule         string    `json:"main_module"`
		Modules            []Module  `json:"modules"`
		CompatibilityDate  string    `json:"compatibility_date"`
		CompatibilityFlags []string  `json:"compatibility_flags"`
		Bindings           []Binding `json:"bindings"`
		Crons              []string  `json:"crons"`
		Observability      bool      `json:"observability"`
	} `json:"worker"`
	Image    Image              `json:"image"`
	Settings map[string]Setting `json:"settings"`
	// Proxies are the pinned images of the HTTPS proxies of `ce install ssh` (optional):
	// "caddy" and "cloudflared".
	Proxies map[string]string `json:"proxies,omitempty"`
}

Manifest is checkend-release.json, format 1.

type Module

type Module struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

Module is one module of the Worker bundle.

type Release

type Release struct {
	Manifest Manifest
	// Signer is the ID of the key that signed the manifest.
	Signer string
	// contains filtered or unexported fields
}

Release is a verified release.

func (*Release) Fetch

func (r *Release) Fetch(a Asset) ([]byte, error)

Fetch downloads an asset and checks its size and SHA-256.

func (*Release) Files

func (r *Release) Files(a Asset) (map[string][]byte, error)

Files downloads a .tar.gz asset, checks it, and returns its regular files by name.

type Setting

type Setting struct {
	Secret    bool   `json:"secret"`
	MinLength int    `json:"min_length,omitempty"`
	Format    string `json:"format,omitempty"`
}

Setting is a setting of the server. Secrets never have a default value.

func (*Setting) UnmarshalJSON

func (s *Setting) UnmarshalJSON(data []byte) error

UnmarshalJSON refuses a setting with a default value: the manifest never has one for a secret.

type Source

type Source struct {
	// API is the GitHub API of the repo (DefaultAPI).
	API string
	// Keys are the trusted keys (TrustedKeys).
	Keys map[string]string
	// CLIVersion is the version of this CLI, for min_cli_version.
	CLIVersion string
	HTTP       *http.Client
}

Source is where the releases come from.

func Default

func Default(client *http.Client) Source

Default is the source of a release build.

func (Source) Get

func (s Source) Get(v string) (*Release, error)

Get is the release of a version ("0.3.0" or "v0.3.0").

func (Source) Latest

func (s Source) Latest() (*Release, error)

Latest is the newest release that is not a draft or a prerelease and has a manifest.

Jump to

Keyboard shortcuts

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