remote

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: Apache-2.0, Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package remote provides registry operations using containerd's remotes. This replaces go-containerregistry's remote package.

Index

Constants

View Source
const PullScope = "pull"

PullScope is the scope for pulling from a registry.

View Source
const PushScope = "push,pull"

PushScope is the scope for pushing to a registry.

Variables

View Source
var (
	// DefaultTransport is the default HTTP transport used for registry operations.
	DefaultTransport = http.DefaultTransport
)

Functions

func Descriptor

func Descriptor(ref reference.Reference, opts ...Option) (*oci.Descriptor, error)

Descriptor returns a descriptor for a remote reference without fetching the full manifest.

func FetchHandler

func FetchHandler(store content.Store, fetcher remotes.Fetcher) images.Handler

FetchHandler wraps containerd's FetchHandler for custom progress tracking.

func Image

func Image(ref reference.Reference, opts ...Option) (oci.Image, error)

Image fetches a remote image.

func WithRangeSuccess

func WithRangeSuccess(ctx context.Context, rs *RangeSuccess) context.Context

WithRangeSuccess adds a RangeSuccess tracker to a context.

func WithResumeOffsets

func WithResumeOffsets(ctx context.Context, offsets map[string]int64) context.Context

WithResumeOffsets adds resume offsets to a context.

func Write

func Write(ref reference.Reference, img oci.Image, opts ...Option) error

Write pushes an image to a registry.

Types

type BearerTransport

type BearerTransport struct {
	Transport http.RoundTripper
	Token     string
}

BearerTransport wraps an http.RoundTripper with bearer token authentication.

func (*BearerTransport) RoundTrip

func (t *BearerTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

type Option

type Option func(*options)

Option configures remote operations.

func WithAuth

func WithAuth(auth authn.Authenticator) Option

WithAuth sets the authenticator.

func WithAuthFromKeychain

func WithAuthFromKeychain(kc authn.Keychain) Option

WithAuthFromKeychain sets authentication from a keychain.

func WithContext

func WithContext(ctx context.Context) Option

WithContext sets the context for remote operations.

func WithPlainHTTP

func WithPlainHTTP(plain bool) Option

WithPlainHTTP allows connecting to registries using plain HTTP instead of HTTPS.

func WithProgress

func WithProgress(ch chan<- oci.Update) Option

WithProgress sets a channel for receiving progress updates.

func WithTransport

func WithTransport(t http.RoundTripper) Option

WithTransport sets the HTTP transport.

func WithUserAgent

func WithUserAgent(ua string) Option

WithUserAgent sets the user agent header.

type PingResponse

type PingResponse struct {
	WWWAuthenticate WWWAuthenticate
}

PingResponse contains information from a registry ping.

func Ping

func Ping(ctx context.Context, reg reference.Registry, transport http.RoundTripper) (*PingResponse, error)

Ping pings a registry and returns authentication information.

type RangeSuccess

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

RangeSuccess tracks which digests had successful Range requests.

func GetRangeSuccess

func GetRangeSuccess(ctx context.Context) *RangeSuccess

GetRangeSuccess extracts RangeSuccess from context.

func (*RangeSuccess) Add

func (rs *RangeSuccess) Add(digest string, offset int64)

Add records a successful Range request for a digest.

func (*RangeSuccess) Get

func (rs *RangeSuccess) Get(digest string) (int64, bool)

Get returns the successful offset for a digest, or 0 if not found.

type Token

type Token struct {
	Token       string `json:"token"`
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
}

Token represents an authentication token.

func Exchange

func Exchange(ctx context.Context, reg reference.Registry, auth authn.Authenticator, transport http.RoundTripper, scopes []string, pr *PingResponse) (*Token, error)

Exchange exchanges credentials for a bearer token.

type WWWAuthenticate

type WWWAuthenticate struct {
	Realm   string
	Service string
	Scope   string
}

WWWAuthenticate contains parsed WWW-Authenticate header information.

Jump to

Keyboard shortcuts

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