registry

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageRef

type ImageRef struct {
	Registry  string // e.g., "registry-1.docker.io"
	Namespace string // e.g., "library" for official images, "org" for ghcr
	Name      string // e.g., "nginx"
	Tag       string // e.g., "1.25", "latest", "" if untagged
}

ImageRef represents a parsed container image reference.

func ParseImageRef

func ParseImageRef(raw string) (ImageRef, error)

ParseImageRef parses a raw image reference string into an ImageRef.

It handles the following forms:

  • nginx → registry-1.docker.io/library/nginx:latest
  • nginx:1.25 → registry-1.docker.io/library/nginx:1.25
  • ghcr.io/org/app:v1 → ghcr.io/org/app:v1
  • registry.example.com/foo/bar:2.0 → as-is
  • registry.example.com:5000/foo:1.0 → registry with port

func (ImageRef) FullName

func (r ImageRef) FullName() string

FullName returns the full repository path used in API calls (namespace/name).

func (ImageRef) String

func (r ImageRef) String() string

String returns the fully qualified image reference.

type OCIClient

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

OCIClient implements Registry using the OCI Distribution Spec HTTP API.

func NewOCIClient

func NewOCIClient(httpClient *http.Client) *OCIClient

NewOCIClient creates a new OCI registry client with the given HTTP client. If httpClient is nil, http.DefaultClient is used.

func (*OCIClient) GetRemoteDigest

func (c *OCIClient) GetRemoteDigest(ctx context.Context, image ImageRef, tag string) (string, error)

GetRemoteDigest returns the digest of a specific tag from the remote registry. It uses a HEAD request to the manifests endpoint and reads the Docker-Content-Digest header.

func (*OCIClient) ListTags

func (c *OCIClient) ListTags(ctx context.Context, image ImageRef) ([]string, error)

ListTags returns all tags for an image from the remote registry. It handles pagination via the Link header.

type Registry

type Registry interface {
	// ListTags returns all tags for an image from the remote registry.
	ListTags(ctx context.Context, image ImageRef) ([]string, error)

	// GetRemoteDigest returns the digest of a specific tag from the remote registry.
	GetRemoteDigest(ctx context.Context, image ImageRef, tag string) (string, error)
}

Registry provides read-only access to container image registries.

Jump to

Keyboard shortcuts

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