Documentation
¶
Overview ¶
Package remote provides registry operations using containerd's remotes. This replaces go-containerregistry's remote package.
Index ¶
- Constants
- Variables
- func Descriptor(ref reference.Reference, opts ...Option) (*oci.Descriptor, error)
- func FetchHandler(store content.Store, fetcher remotes.Fetcher) images.Handler
- func Image(ref reference.Reference, opts ...Option) (oci.Image, error)
- func WithRangeSuccess(ctx context.Context, rs *RangeSuccess) context.Context
- func WithResumeOffsets(ctx context.Context, offsets map[string]int64) context.Context
- func Write(ref reference.Reference, img oci.Image, opts ...Option) error
- type BearerTransport
- type Option
- func WithAuth(auth authn.Authenticator) Option
- func WithAuthFromKeychain(kc authn.Keychain) Option
- func WithContext(ctx context.Context) Option
- func WithPlainHTTP(plain bool) Option
- func WithProgress(ch chan<- oci.Update) Option
- func WithTransport(t http.RoundTripper) Option
- func WithUserAgent(ua string) Option
- type PingResponse
- type RangeSuccess
- type Token
- type WWWAuthenticate
Constants ¶
const PullScope = "pull"
PullScope is the scope for pulling from a registry.
const PushScope = "push,pull"
PushScope is the scope for pushing to a registry.
Variables ¶
var ( // DefaultTransport is the default HTTP transport used for registry operations. DefaultTransport = http.DefaultTransport )
Functions ¶
func Descriptor ¶
Descriptor returns a descriptor for a remote reference without fetching the full manifest.
func FetchHandler ¶
FetchHandler wraps containerd's FetchHandler for custom progress tracking.
func WithRangeSuccess ¶
func WithRangeSuccess(ctx context.Context, rs *RangeSuccess) context.Context
WithRangeSuccess adds a RangeSuccess tracker to a context.
func WithResumeOffsets ¶
WithResumeOffsets adds resume offsets to a context.
Types ¶
type BearerTransport ¶
type BearerTransport struct {
Transport http.RoundTripper
Token string
}
BearerTransport wraps an http.RoundTripper with bearer token authentication.
type Option ¶
type Option func(*options)
Option configures remote operations.
func WithAuthFromKeychain ¶
WithAuthFromKeychain sets authentication from a keychain.
func WithContext ¶
WithContext sets the context for remote operations.
func WithPlainHTTP ¶
WithPlainHTTP allows connecting to registries using plain HTTP instead of HTTPS.
func WithProgress ¶
WithProgress sets a channel for receiving progress updates.
func WithTransport ¶
func WithTransport(t http.RoundTripper) Option
WithTransport sets the HTTP transport.
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.
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 ¶
WWWAuthenticate contains parsed WWW-Authenticate header information.