checksum

package
v0.3.20 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package checksum sources a sha256 for a value=sha256 follower. The source is selectable (digest, checksums file, or download-and-hash) with an auto chain and a verify cross-check; see Resolve.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetch

func Fetch(ctx context.Context, client *http.Client, rawURL, version, pat string) (string, error)

Fetch downloads the checksum file at rawURL (with <version> expanded) and returns the sha256 for the asset matching pat. An empty pat is allowed only when the file holds a single entry.

func Resolve

func Resolve(ctx context.Context, client *http.Client, req Request) (string, error)

Resolve sources a sha256 for the asset the request selects, per its source (defaulting to auto). The sources are constant.Sha256{Digest,Checksums, Download}; auto tries them in that order, and verify cross-checks the digest against a checksums file.

Types

type DownloadFunc added in v0.3.10

type DownloadFunc func(ctx context.Context, asset model.Asset) (io.ReadCloser, error)

DownloadFunc streams a release asset's content through the producer provider's authenticated channel, reaching assets a plain GET of the public URL cannot (a private repository).

type Request

type Request struct {
	Source   string
	Assets   []model.Asset
	Pattern  string
	URL      string
	Version  string
	Download DownloadFunc
}

Request describes how to source a follower's sha256: the source method, the producer's release assets, an asset-selecting pattern, an optional explicit checksums-file URL, and an optional authenticated download (nil falls back to a plain GET of the asset's public URL).

type Resolver added in v0.1.1

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

Resolver sources sha256 values with a run-scoped cache of parsed checksum files, so many followers can choose from one downloaded checksum list.

func NewResolver added in v0.1.1

func NewResolver(client *http.Client) *Resolver

NewResolver returns a checksum resolver using client for HTTP downloads.

func (*Resolver) Resolve added in v0.1.1

func (r *Resolver) Resolve(ctx context.Context, req Request) (string, error)

Resolve sources a sha256 for the asset the request selects, reusing parsed checksum files across calls on the resolver.

Jump to

Keyboard shortcuts

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