...

Package ociserver

import "cuelabs.dev/go/oci/ociregistry/ociserver"
Overview
Index

Overview ▾

Package ociserver implements a docker V2 registry and the OCI distribution specification.

It is designed to be used anywhere a low dependency container registry is needed.

Its goal is to be standards compliant and its strictness will increase over time.

func New

func New(backend ociregistry.Interface, opts *Options) http.Handler

New returns a handler which implements the docker registry protocol by making calls to the underlying registry backend r.

If opts is nil, it's equivalent to passing new(Options).

The returned handler should be registered at the site root.

type Options

Options holds options for the server.

type Options struct {
    // DisableReferrersAPI, when true, causes the registry to behave as if
    // it does not understand the referrers API.
    DisableReferrersAPI bool

    // DisableSinglePostUpload, when true, causes the registry
    // to reject uploads with a single POST request.
    // This is useful in combination with LocationsForDescriptor
    // to cause uploaded blob content to flow through
    // another server.
    DisableSinglePostUpload bool

    // MaxListPageSize, if > 0, causes the list endpoints to return an
    // error if the page size is greater than that. This emulates
    // a quirk of AWS ECR where it refuses request for any
    // page size > 1000.
    MaxListPageSize int

    // OmitDigestFromTagGetResponse causes the registry
    // to omit the Docker-Content-Digest header from a tag
    // GET response, mimicking the behavior of registries that
    // do the same (for example AWS ECR).
    OmitDigestFromTagGetResponse bool

    // OmitLinkHeaderFromResponses causes the server
    // to leave out the Link header from list responses.
    OmitLinkHeaderFromResponses bool

    // LocationForUploadID transforms an upload ID as returned by
    // ocirequest.BlobWriter.ID to the absolute URL location
    // as returned by the upload endpoints.
    //
    // By default, when this function is nil, or it returns an empty
    // string, upload IDs are treated as opaque identifiers and the
    // returned locations are always host-relative URLs into the
    // server itself.
    //
    // This can be used to allow clients to fetch and push content
    // directly from some upstream server rather than passing
    // through this server. Clients doing that will need access
    // rights to that remote location.
    LocationForUploadID func(string) (string, error)

    // LocationsForDescriptor returns a set of possible download
    // URLs for the given descriptor.
    // If it's nil, then all locations returned by the server
    // will refer to the server itself.
    //
    // If not, then the Location header of responses will be
    // set accordingly (to an arbitrary value from the
    // returned slice if there are multiple).
    //
    // Returning a location from this function will also
    // cause GET requests to return a redirect response
    // to that location.
    //
    // TODO perhaps the redirect behavior described above
    // isn't always what is wanted?
    LocationsForDescriptor func(isManifest bool, desc ociregistry.Descriptor) ([]string, error)

    DebugID string
}

type ParseError

ParseError represents an error that can happen when parsing. The Err field holds one of the possible error values below.

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