image

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package image handles cloud image download, verification, and conversion.

Index

Constants

This section is empty.

Variables

View Source
var Catalog = map[string]ImageInfo{
	"debian-12": {
		URLs: map[string]string{
			"amd64": "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.raw",
			"arm64": "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-arm64.raw",
		},
		SHA256: "",
	},
	"ubuntu-24.04": {
		URLs: map[string]string{
			"amd64": "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img",
			"arm64": "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-arm64.img",
		},
		SHA256: "",
	},
}

Catalog maps image aliases to a per-GOARCH URL and an optional SHA256. The arch tokens in the URLs (amd64/arm64) match Go's GOARCH, so the same alias resolves to the right image on macOS Apple Silicon and on Linux amd64/arm64.

Functions

func CopyDisk

func CopyDisk(src, dst string, sizeBytes int64) error

CopyDisk copies the source disk image to the destination with the given size. If size is larger than the source, the file is extended (sparse).

func Ensure

func Ensure(cacheDir, urlOrAlias string) (string, error)

Ensure downloads and prepares an image, returning the path to the raw disk. If the image is already cached and verified, returns immediately. If url is a known alias (e.g., "debian-12"), uses the catalog.

Types

type ImageInfo

type ImageInfo struct {
	URLs   map[string]string
	SHA256 string
}

ImageInfo describes a cloud image: a URL per GOARCH and an optional SHA256 (empty means "latest, unverified").

Jump to

Keyboard shortcuts

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