Documentation ¶
Index ¶
- Constants
- Variables
- func AddRequiredHeadersToRedirectedRequests(req *http.Request, via []*http.Request) error
- func IndexServerAddress() string
- func Login(authConfig *AuthConfig, factory *utils.HTTPRequestFactory) (string, error)
- func ResolveRepositoryName(reposName string) (string, string, error)
- func SaveConfig(configFile *ConfigFile) error
- type APIVersion
- type AuthConfig
- type ConfigFile
- type Endpoint
- type FSLayer
- type ImgData
- type ManifestData
- type ManifestHistory
- type RegistryInfo
- type RepositoryData
- type SearchResult
- type SearchResults
- type Session
- func (r *Session) GetAuthConfig(withPasswd bool) *AuthConfig
- func (r *Session) GetRemoteHistory(imgID, registry string, token []string) ([]string, error)
- func (r *Session) GetRemoteImageJSON(imgID, registry string, token []string) ([]byte, int, error)
- func (r *Session) GetRemoteImageLayer(imgID, registry string, token []string, imgSize int64) (io.ReadCloser, error)
- func (r *Session) GetRemoteTags(registries []string, repository string, token []string) (map[string]string, error)
- func (r *Session) GetRepositoryData(remote string) (*RepositoryData, error)
- func (r *Session) GetV2ImageBlob(imageName, sumType, sum string, blobWrtr io.Writer, token []string) error
- func (r *Session) GetV2ImageBlobReader(imageName, sumType, sum string, token []string) (io.ReadCloser, int64, error)
- func (r *Session) GetV2ImageManifest(imageName, tagName string, token []string) ([]byte, error)
- func (r *Session) GetV2RemoteTags(imageName string, token []string) ([]string, error)
- func (r *Session) GetV2Version(token []string) (*RegistryInfo, error)
- func (r *Session) LookupRemoteImage(imgID, registry string, token []string) error
- func (r *Session) PostV2ImageMountBlob(imageName, sumType, sum string, token []string) (bool, error)
- func (r *Session) PushImageChecksumRegistry(imgData *ImgData, registry string, token []string) error
- func (r *Session) PushImageJSONIndex(remote string, imgList []*ImgData, validate bool, regs []string) (*RepositoryData, error)
- func (r *Session) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, registry string, token []string) error
- func (r *Session) PushImageLayerRegistry(imgID string, layer io.Reader, registry string, token []string, jsonRaw []byte) (checksum string, checksumPayload string, err error)
- func (r *Session) PushRegistryTag(remote, revision, tag, registry string, token []string) error
- func (r *Session) PutV2ImageBlob(imageName, sumType string, blobRdr io.Reader, token []string) (serverChecksum string, err error)
- func (r *Session) PutV2ImageManifest(imageName, tagName string, manifestRdr io.Reader, token []string) error
- func (r *Session) SearchRepositories(term string) (*SearchResults, error)
- type TimeoutType
Constants ¶
const ( // Where we store the config file CONFIGFILE = ".dockercfg" // Only used for user auth + account creation INDEXSERVER = "https://index.docker.io/v1/" REGISTRYSERVER = "https://registry-1.docker.io/v1/" )
const ( APIVersion1 = iota + 1 APIVersion2 )
Variables ¶
var ( ErrConfigFileMissing = errors.New("The Auth config file is missing") IndexServerURL *url.URL )
Functions ¶
func IndexServerAddress ¶
func IndexServerAddress() string
func Login ¶
func Login(authConfig *AuthConfig, factory *utils.HTTPRequestFactory) (string, error)
try to register/login to the registry server
func ResolveRepositoryName ¶
Resolves a repository name to a hostname + name
Types ¶
type APIVersion ¶
type APIVersion int
var DefaultAPIVersion APIVersion = APIVersion1
func (APIVersion) String ¶
func (av APIVersion) String() string
type AuthConfig ¶
type ConfigFile ¶
type ConfigFile struct { Configs map[string]AuthConfig `json:"configs,omitempty"` // contains filtered or unexported fields }
func LoadConfig ¶
func LoadConfig(rootPath string) (*ConfigFile, error)
load up the auth config information and return values FIXME: use the internal golang config parser
func (*ConfigFile) ResolveAuthConfig ¶
func (config *ConfigFile) ResolveAuthConfig(hostname string) AuthConfig
this method matches a auth configuration to a server address or a url
type Endpoint ¶
type Endpoint struct { URL *url.URL Version APIVersion // contains filtered or unexported fields }
func NewEndpoint ¶
func (Endpoint) Ping ¶
func (e Endpoint) Ping() (RegistryInfo, error)
func (Endpoint) VersionString ¶
func (e Endpoint) VersionString(version APIVersion) string
type ManifestData ¶
type ManifestHistory ¶
type ManifestHistory struct {
V1Compatibility string `json:"v1Compatibility"`
}
type RegistryInfo ¶
type RepositoryData ¶
type SearchResult ¶
type SearchResults ¶
type SearchResults struct { Query string `json:"query"` NumResults int `json:"num_results"` Results []SearchResult `json:"results"` }
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
func NewSession(authConfig *AuthConfig, factory *utils.HTTPRequestFactory, endpoint *Endpoint, timeout bool) (r *Session, err error)
func (*Session) GetAuthConfig ¶
func (r *Session) GetAuthConfig(withPasswd bool) *AuthConfig
func (*Session) GetRemoteHistory ¶
Retrieve the history of a given image from the Registry. Return a list of the parent's json (requested image included)
func (*Session) GetRemoteImageJSON ¶
Retrieve an image from the Registry.
func (*Session) GetRemoteImageLayer ¶
func (*Session) GetRemoteTags ¶
func (*Session) GetRepositoryData ¶
func (r *Session) GetRepositoryData(remote string) (*RepositoryData, error)
func (*Session) GetV2ImageBlob ¶
func (*Session) GetV2ImageBlobReader ¶
func (*Session) GetV2ImageManifest ¶
- Check if TarSum of each layer exists /v2/ 1.a) if 200, continue 1.b) if 300, then push the 1.c) if anything else, err
- PUT the created/signed manifest
func (*Session) GetV2RemoteTags ¶
Given a repository name, returns a json array of string tags
func (*Session) GetV2Version ¶
func (r *Session) GetV2Version(token []string) (*RegistryInfo, error)
func (*Session) LookupRemoteImage ¶
Check if an image exists in the Registry
func (*Session) PostV2ImageMountBlob ¶
func (r *Session) PostV2ImageMountBlob(imageName, sumType, sum string, token []string) (bool, error)
- Succeeded to mount for this image scope - Failed with no error (So continue to Push the Blob) - Failed with error
func (*Session) PushImageChecksumRegistry ¶
func (*Session) PushImageJSONIndex ¶
func (*Session) PushImageJSONRegistry ¶
func (r *Session) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, registry string, token []string) error
Push a local image to the registry
func (*Session) PushImageLayerRegistry ¶
func (*Session) PushRegistryTag ¶
push a tag on the registry. Remote has the format '<user>/<repo>
func (*Session) PutV2ImageBlob ¶
func (r *Session) PutV2ImageBlob(imageName, sumType string, blobRdr io.Reader, token []string) (serverChecksum string, err error)
Push the image to the server for storage. 'layer' is an uncompressed reader of the blob to be pushed. The server will generate it's own checksum calculation.
func (*Session) PutV2ImageManifest ¶
func (r *Session) PutV2ImageManifest(imageName, tagName string, manifestRdr io.Reader, token []string) error
Finally Push the (signed) manifest of the blobs we've just pushed
func (*Session) SearchRepositories ¶
func (r *Session) SearchRepositories(term string) (*SearchResults, error)
type TimeoutType ¶
type TimeoutType uint32
const ( NoTimeout TimeoutType = iota ReceiveTimeout ConnectTimeout )