Documentation
¶
Overview ¶
Package registry provides OCI registry client functionality.
Index ¶
- Constants
- type AuthConfig
- type Client
- func (c *Client) Close()
- func (c *Client) DoRequest(ctx context.Context, method, urlStr string, headers map[string]string, ...) (*http.Response, error)
- func (c *Client) DownloadBlob(registry, name, digest string, writer io.Writer) error
- func (c *Client) GetBlob(registry, name, digest string) ([]byte, error)
- func (c *Client) GetConfig(registry, name string, manifest *ManifestV2) ([]byte, error)
- func (c *Client) GetManifest(registry, name, reference string) (*ManifestV2, string, error)
- func (c *Client) GetTags(registry, repository string) (*TagList, error)
- func (c *Client) HeadBlob(registry, name, digest string) (int64, error)
- func (c *Client) Ping(registry string) error
- func (c *Client) Push(registry, name, tag string, manifest *ManifestV2, config []byte, ...) error
- func (c *Client) ResolveManifest(registry, name, reference string) (*ManifestV2, string, error)
- func (c *Client) SetAuth(username, password string)
- type ImageRef
- type ManifestBlob
- type ManifestList
- type ManifestListEntry
- type ManifestV2
- type Platform
- type TagList
Constants ¶
const ( DefaultRegistry = "registry-1.docker.io" DefaultTag = "latest" AuthService = "registry.docker.io" AuthRealm = "https://auth.docker.io/token" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
ServerAddress string `json:"serveraddress,omitempty"`
IdentityToken string `json:"identitytoken,omitempty"`
}
AuthConfig holds registry authentication credentials.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides access to an OCI/Docker registry.
func (*Client) Close ¶
func (c *Client) Close()
Close releases idle HTTP connections held by the client.
func (*Client) DoRequest ¶
func (c *Client) DoRequest(ctx context.Context, method, urlStr string, headers map[string]string, body io.Reader) (*http.Response, error)
DoRequest performs an authenticated HTTP request to a registry endpoint.
func (*Client) DownloadBlob ¶
DownloadBlob downloads a blob by digest and writes it to the provided writer.
func (*Client) GetConfig ¶
func (c *Client) GetConfig(registry, name string, manifest *ManifestV2) ([]byte, error)
GetConfig downloads the image configuration blob referenced by a manifest and verifies it hashes to manifest.Config.Digest (MED-4).
func (*Client) GetManifest ¶
func (c *Client) GetManifest(registry, name, reference string) (*ManifestV2, string, error)
GetManifest fetches the image manifest for a given reference.
func (*Client) Push ¶
func (c *Client) Push(registry, name, tag string, manifest *ManifestV2, config []byte, layers map[string]io.Reader) error
Push uploads a manifest and its blobs to a registry.
func (*Client) ResolveManifest ¶
func (c *Client) ResolveManifest(registry, name, reference string) (*ManifestV2, string, error)
ResolveManifest resolves a manifest for the current platform (linux/arm64 preferred).
type ImageRef ¶
ImageRef represents a parsed OCI image reference.
func ParseImageRef ¶
ParseImageRef parses an OCI image reference string into its components.
type ManifestBlob ¶
type ManifestBlob struct {
MediaType string `json:"mediaType"`
Size int64 `json:"size"`
Digest string `json:"digest"`
URLs []string `json:"urls,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}
ManifestBlob represents a blob entry within an image manifest.
type ManifestList ¶
type ManifestList struct {
SchemaVersion int `json:"schemaVersion"`
MediaType string `json:"mediaType"`
Manifests []ManifestListEntry `json:"manifests"`
}
ManifestList represents an OCI image index or Docker manifest list.
type ManifestListEntry ¶
type ManifestListEntry struct {
MediaType string `json:"mediaType"`
Size int64 `json:"size"`
Digest string `json:"digest"`
Platform *Platform `json:"platform"`
Annotations map[string]string `json:"annotations,omitempty"`
}
ManifestListEntry represents a single entry in a manifest list.
type ManifestV2 ¶
type ManifestV2 struct {
SchemaVersion int `json:"schemaVersion"`
MediaType string `json:"mediaType"`
Config ManifestBlob `json:"config"`
Layers []ManifestBlob `json:"layers"`
Annotations map[string]string `json:"annotations,omitempty"`
}
ManifestV2 represents an OCI/Docker v2 image manifest.