Help us shape the future of Go! Take the 2026 Go Developer Survey

registry

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package registry is a deliberately minimal OCI registry client for digest observation: resolve what digest a tag points at, per platform. It is read-only, https-only, anonymous-or-bearer-token only, and fail closed. It never pulls image content.

The index-resolution paths (platform match, ARM variant match) are differential-tested against google/go-containerregistry in differential_test.go. Known deliberate divergence: on zero or multiple platform matches this client errors, where go-containerregistry's WithPlatform has its own fallback behavior.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client resolves image digests over the registry HTTP API.

func New

func New(options ...Option) *Client

New builds a Client with a 20-second default timeout.

func (*Client) ResolveDigest

func (c *Client) ResolveDigest(image domain.ImageReference) (string, error)

ResolveDigest returns the digest the image's tag currently points at, from the Docker-Content-Digest header of a HEAD request. For a multi-arch image this is the index digest; use ResolvePlatformDigest to match what a single-platform engine reports as running.

func (*Client) ResolvePlatformDigest

func (c *Client) ResolvePlatformDigest(image domain.ImageReference, platform Platform) (string, error)

ResolvePlatformDigest returns the manifest digest for one platform. For an index, exactly one child manifest must match the platform; for a single manifest, the image config's platform is verified against the request and a mismatch is an error.

func (*Client) WithContext added in v1.2.0

func (c *Client) WithContext(ctx context.Context) *Client

WithContext returns a copy bound to the caller lifetime.

type Option

type Option func(*Client)

Option configures a Client.

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

WithHTTPClient replaces the underlying HTTP client (tests inject a fake transport here).

type Platform

type Platform struct {
	OS           string
	Architecture string
	Variant      string
}

Platform selects one manifest out of a multi-arch index. Variant is empty when the architecture has no variants.

func (Platform) String

func (p Platform) String() string

Jump to

Keyboard shortcuts

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