config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 16 Imported by: 6

Documentation

Overview

Package config is used for all regclient configuration settings.

Index

Constants

View Source
const (
	// DockerRegistry is the name resolved in docker images on Hub.
	DockerRegistry = "docker.io"
	// DockerRegistryAuth is the name provided in docker's config for Hub.
	DockerRegistryAuth = "https://index.docker.io/v1/"
	// DockerRegistryDNS is the host to connect to for Hub.
	DockerRegistryDNS = "registry-1.docker.io"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cred added in v0.4.3

type Cred struct {
	User, Password, Token string
}

Cred defines a user credential for accessing a registry.

type Host

type Host struct {
	Name          string            `json:"-" yaml:"registry,omitempty"`                  // Name of the registry (required) (yaml configs pass this as a field, json provides this from the object key)
	TLS           TLSConf           `json:"tls,omitempty" yaml:"tls"`                     // TLS setting: enabled (default), disabled, insecure
	RegCert       string            `json:"regcert,omitempty" yaml:"regcert"`             // public pem cert of registry
	ClientCert    string            `json:"clientCert,omitempty" yaml:"clientCert"`       // public pem cert for client (mTLS)
	ClientKey     string            `json:"clientKey,omitempty" yaml:"clientKey"`         // private pem cert for client (mTLS)
	Hostname      string            `json:"hostname,omitempty" yaml:"hostname"`           // hostname of registry, default is the registry name
	User          string            `json:"user,omitempty" yaml:"user"`                   // username, not used with credHelper
	Pass          string            `json:"pass,omitempty" yaml:"pass"`                   // password, not used with credHelper
	Token         string            `json:"token,omitempty" yaml:"token"`                 // token, experimental for specific APIs
	CredHelper    string            `json:"credHelper,omitempty" yaml:"credHelper"`       // credential helper command for requesting logins
	CredExpire    timejson.Duration `json:"credExpire,omitempty" yaml:"credExpire"`       // time until credential expires
	CredHost      string            `json:"credHost" yaml:"credHost"`                     // used when a helper hostname doesn't match Hostname
	PathPrefix    string            `json:"pathPrefix,omitempty" yaml:"pathPrefix"`       // used for mirrors defined within a repository namespace
	Mirrors       []string          `json:"mirrors,omitempty" yaml:"mirrors"`             // list of other Host Names to use as mirrors
	Priority      uint              `json:"priority,omitempty" yaml:"priority"`           // priority when sorting mirrors, higher priority attempted first
	RepoAuth      bool              `json:"repoAuth,omitempty" yaml:"repoAuth"`           // tracks a separate auth per repo
	API           string            `json:"api,omitempty" yaml:"api"`                     // experimental: registry API to use
	APIOpts       map[string]string `json:"apiOpts,omitempty" yaml:"apiOpts"`             // options for APIs
	BlobChunk     int64             `json:"blobChunk,omitempty" yaml:"blobChunk"`         // size of each blob chunk
	BlobMax       int64             `json:"blobMax,omitempty" yaml:"blobMax"`             // threshold to switch to chunked upload, -1 to disable, 0 for regclient.blobMaxPut
	ReqPerSec     float64           `json:"reqPerSec,omitempty" yaml:"reqPerSec"`         // requests per second, default is defaultReqPerSec(10)
	ReqConcurrent int64             `json:"reqConcurrent,omitempty" yaml:"reqConcurrent"` // concurrent requests, default is defaultConcurrent(3)
	Scheme        string            `json:"scheme,omitempty" yaml:"scheme"`               // Deprecated: use TLS instead
	// contains filtered or unexported fields
}

Host defines settings for connecting to a registry.

func DockerLoad added in v0.4.3

func DockerLoad() ([]Host, error)

DockerLoad returns a slice of hosts from the users docker config.

func HostNew

func HostNew() *Host

HostNew creates a default Host entry.

func HostNewName

func HostNewName(name string) *Host

HostNewName creates a default Host with a hostname.

func (*Host) GetCred added in v0.4.3

func (host *Host) GetCred() Cred

GetCred returns the credential, fetching from a credential helper if needed.

func (*Host) Merge

func (host *Host) Merge(newHost Host, log *logrus.Logger) error

Merge adds fields from a new config host entry.

func (*Host) Throttle added in v0.5.0

func (host *Host) Throttle() *throttle.Throttle

type TLSConf

type TLSConf int

TLSConf specifies whether TLS is enabled and verified for a host.

const (
	// TLSUndefined indicates TLS is not passed, defaults to Enabled.
	TLSUndefined TLSConf = iota
	// TLSEnabled uses TLS (https) for the connection.
	TLSEnabled
	// TLSInsecure uses TLS but does not verify CA.
	TLSInsecure
	// TLSDisabled does not use TLS (http).
	TLSDisabled
)

func (TLSConf) MarshalJSON

func (t TLSConf) MarshalJSON() ([]byte, error)

MarshalJSON converts TLSConf to a json string using MarshalText.

func (TLSConf) MarshalText

func (t TLSConf) MarshalText() ([]byte, error)

MarshalText converts TLSConf to a string.

func (*TLSConf) UnmarshalJSON

func (t *TLSConf) UnmarshalJSON(b []byte) error

UnmarshalJSON converts TLSConf from a json string.

func (*TLSConf) UnmarshalText

func (t *TLSConf) UnmarshalText(b []byte) error

UnmarshalText converts TLSConf from a string.

Jump to

Keyboard shortcuts

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