checksum

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 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 Request

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

Request describes how to source a follower's sha256: the source method, the producer's release assets, an asset-selecting pattern, and an optional explicit checksums-file 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