registry

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PING_ENDPOINT        = "v2/"
	CATALOG_ENDPOINT     = "v2/_catalog"
	TAG_LISTING_ENDPOINT = "v2/%s/tags/list"
	MANIFEST_ENDPOINT    = "v2/%s/manifests/%s"
	PATCH_SUFFIX         = "patched"
)

Variables

View Source
var COMMAND_TEMPLATE = `` /* 128-byte string literal not displayed */
View Source
var EMPTY_STARTER = `` /* 134-byte string literal not displayed */
View Source
var ENTRYPOINT_COMMAND_TEMPLATE = `` /* 146-byte string literal not displayed */
View Source
var ENTRYPOINT_TEMPLATE = `` /* 136-byte string literal not displayed */

Functions

func SetAuthToken

func SetAuthToken(token string)

SetAuthToken sets the auth token

func SetHttpRetry

func SetHttpRetry(retry int)

SetHttpRetry sets the http retry

func SetHttpTimeout

func SetHttpTimeout(timeout int)

SetHttpTimeout sets the http timeout

func SetUserAgent

func SetUserAgent(ua string)

SetUserAgent sets the user agent

Types

type AddAuthTransport

type AddAuthTransport struct {
	T http.RoundTripper
	// contains filtered or unexported fields
}

AddAuthTransport is a transport that adds an auth token to the request

func NewAddAuth

func NewAddAuth(T http.RoundTripper, auth string) *AddAuthTransport

func (*AddAuthTransport) RoundTrip

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

type AddUserAgentTransport

type AddUserAgentTransport struct {
	T http.RoundTripper
	// contains filtered or unexported fields
}

AddUserAgentTransport is a transport that adds a user agent to the request

func NewUserAgentTransport

func NewUserAgentTransport(T http.RoundTripper, ua string) *AddUserAgentTransport

func (*AddUserAgentTransport) RoundTrip

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

type CatalogEndpointResponse

type CatalogEndpointResponse struct {
	Repositories []string `json:"repositories,omitempty"`
}

type HistoryEntry

type HistoryEntry struct {
	Architecture string `json:"architecture,omitempty"`
	Config       struct {
		Hostname     string      `json:"Hostname,omitempty"`
		Domainname   string      `json:"Domainname,omitempty"`
		User         string      `json:"User,omitempty"`
		AttachStdin  bool        `json:"AttachStdin,omitempty"`
		AttachStdout bool        `json:"AttachStdout,omitempty"`
		AttachStderr bool        `json:"AttachStderr,omitempty"`
		Digest       string      `json:"Digest,omitempty"`
		Tty          bool        `json:"Tty,omitempty"`
		OpenStdin    bool        `json:"OpenStdin,omitempty"`
		StdinOnce    bool        `json:"StdinOnce,omitempty"`
		Env          []string    `json:"Env,omitempty"`
		Cmd          []string    `json:"Cmd,omitempty"`
		Image        string      `json:"Image,omitempty"`
		Volumes      interface{} `json:"Volumes,omitempty"`
		WorkingDir   string      `json:"WorkingDir,omitempty"`
		Entrypoint   []string    `json:"Entrypoint,omitempty"`
		OnBuild      interface{} `json:"OnBuild,omitempty"`
		Labels       struct {
			OrgOpencontainersImageRefName string `json:"org.opencontainers.image.ref.name,omitempty"`
			OrgOpencontainersImageVersion string `json:"org.opencontainers.image.version,omitempty"`
		} `json:"Labels,omitempty"`
	} `json:"config,omitempty"`
	Container       string `json:"container,omitempty"`
	ContainerConfig struct {
		Hostname     string      `json:"Hostname,omitempty"`
		Domainname   string      `json:"Domainname,omitempty"`
		User         string      `json:"User,omitempty"`
		AttachStdin  bool        `json:"AttachStdin,omitempty"`
		AttachStdout bool        `json:"AttachStdout,omitempty"`
		AttachStderr bool        `json:"AttachStderr,omitempty"`
		Tty          bool        `json:"Tty,omitempty"`
		OpenStdin    bool        `json:"OpenStdin,omitempty"`
		StdinOnce    bool        `json:"StdinOnce,omitempty"`
		Env          []string    `json:"Env,omitempty"`
		Cmd          []string    `json:"Cmd,omitempty"`
		Image        string      `json:"Image,omitempty"`
		Volumes      interface{} `json:"Volumes,omitempty"`
		WorkingDir   string      `json:"WorkingDir,omitempty"`
		Entrypoint   interface{} `json:"Entrypoint,omitempty"`
		OnBuild      interface{} `json:"OnBuild,omitempty"`
		Labels       struct {
			OrgOpencontainersImageRefName string `json:"org.opencontainers.image.ref.name,omitempty"`
			OrgOpencontainersImageVersion string `json:"org.opencontainers.image.version,omitempty"`
		} `json:"Labels,omitempty"`
	} `json:"container_config,omitempty"`
	Created       string `json:"created,omitempty"`
	DockerVersion string `json:"docker_version,omitempty"`
	ID            string `json:"id,omitempty"`
	OS            string `json:"os,omitempty"`
	Parent        string `json:"parent,omitempty"`
	Throwaway     bool   `json:"throwaway,omitempty"`
	Variant       string `json:"variant,omitempty"`
}

func (*HistoryEntry) Clone

func (h *HistoryEntry) Clone() *HistoryEntry

type Image

type Image struct {
	Name string
	Tags []Tag
}

type Manifest

type Manifest struct {
	SchemaVersion int    `json:"schemaVersion"`
	Name          string `json:"name"`
	Tag           string `json:"tag"`
	Architecture  string `json:"architecture"`
	FsLayers      []struct {
		BlobSum string `json:"blobSum"`
	} `json:"fsLayers"`
	History []struct {
		V1Compatibility string `json:"v1Compatibility"`
		HistoryEntry    *HistoryEntry
	} `json:"history"`
	Signatures []struct {
		Header struct {
			Jwk struct {
				Crv string `json:"crv"`
				Kid string `json:"kid"`
				Kty string `json:"kty"`
				X   string `json:"x"`
				Y   string `json:"y"`
			} `json:"jwk"`
			Alg string `json:"alg"`
		} `json:"header"`
		Signature string `json:"signature"`
		Protected string `json:"protected"`
	} `json:"signatures"`
}

func (*Manifest) ParseHistoryEntries

func (m *Manifest) ParseHistoryEntries() ([]*HistoryEntry, error)

ParseHistoryEntry parses the V1Compatibility field of a history entry

type Server

type Server struct {
	Address  string
	Images   []Image
	Protocol string
	Port     string
	// contains filtered or unexported fields
}

func NewServer

func NewServer(address string) *Server

func (*Server) Dump

func (s *Server) Dump(logger *slog.Logger, path string, manifestOnly bool, failCount int32, parallel int) error

Dump downloads the image from the registry to the local machine by fetching the manifest for each image and tag combination and then downloading the layers This is a simplified version of the Docker pull command

func (*Server) FetchImagesAndTags

func (s *Server) FetchImagesAndTags(logger *slog.Logger, parallel int) error

FetchImagesAndTags returns a list of images from the registry server

func (*Server) FetchTags

func (s *Server) FetchTags(image *Image) error

func (*Server) GetService

func (s *Server) GetService() string

func (*Server) GetUrl

func (s *Server) GetUrl() string

func (*Server) Ping

func (s *Server) Ping() error

Ping performs a http request and checks if the server is a registry server. The check is executed only once

type Tag

type Tag struct {
	Name     string
	Manifest *Manifest
}

func (*Tag) Command

func (t *Tag) Command() string

func (*Tag) Entrypoint

func (t *Tag) Entrypoint() string

func (*Tag) GeneratePatchScript

func (t *Tag) GeneratePatchScript(script string) string

func (*Tag) Starter

func (t *Tag) Starter() string

type TagListingEndpointResponse

type TagListingEndpointResponse struct {
	Tags []string `json:"tags"`
}

Jump to

Keyboard shortcuts

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