Documentation ¶
Index ¶
- Variables
- func NewRetryRepository(repo distribution.Repository, retries int, interval time.Duration) distribution.Repository
- type AuthHandlersFunc
- type BasicCredentials
- type Context
- func (c *Context) Copy() *Context
- func (c *Context) Ping(ctx gocontext.Context, registry *url.URL, insecure bool) (http.RoundTripper, *url.URL, error)
- func (c *Context) Repository(ctx gocontext.Context, registry *url.URL, repoName string, insecure bool) (distribution.Repository, error)
- func (c *Context) Reset()
- func (c *Context) WithActions(actions ...string) *Context
- func (c *Context) WithCredentials(credentials auth.CredentialStore) *Context
- func (c *Context) WithScopes(scopes ...auth.Scope) *Context
- type ErrNotV2Registry
- type RefreshTokenStore
- type RepositoryRetriever
Constants ¶
This section is empty.
Variables ¶
var (
NoCredentials auth.CredentialStore = &noopCredentialStore{}
)
Functions ¶
func NewRetryRepository ¶
func NewRetryRepository(repo distribution.Repository, retries int, interval time.Duration) distribution.Repository
NewRetryRepository wraps a distribution.Repository with helpers that will retry authentication failures over a limited time window and duration. This primarily avoids a DockerHub issue where public images unexpectedly return a 401 error due to the JWT token created by the hub being created at the same second, but another server being in the previous second.
Types ¶
type AuthHandlersFunc ¶
type AuthHandlersFunc func(transport http.RoundTripper, registry *url.URL, repoName string) []auth.AuthenticationHandler
type BasicCredentials ¶
type BasicCredentials struct {
// contains filtered or unexported fields
}
func NewBasicCredentials ¶
func NewBasicCredentials() *BasicCredentials
func (*BasicCredentials) Add ¶
func (c *BasicCredentials) Add(url *url.URL, username, password string)
func (BasicCredentials) RefreshToken ¶
type Context ¶
type Context struct { Transport http.RoundTripper InsecureTransport http.RoundTripper Challenges challenge.Manager Scopes []auth.Scope Actions []string Retries int Credentials auth.CredentialStore // contains filtered or unexported fields }
func NewContext ¶
func NewContext(transport, insecureTransport http.RoundTripper) *Context
NewContext is capable of creating RepositoryRetrievers.
func (*Context) Ping ¶
func (c *Context) Ping(ctx gocontext.Context, registry *url.URL, insecure bool) (http.RoundTripper, *url.URL, error)
Ping contacts a registry and returns the transport and URL of the registry or an error.
func (*Context) Repository ¶
func (c *Context) Repository(ctx gocontext.Context, registry *url.URL, repoName string, insecure bool) (distribution.Repository, error)
func (*Context) Reset ¶
func (c *Context) Reset()
Reset clears any cached repository info for this context.
func (*Context) WithActions ¶
func (*Context) WithCredentials ¶
func (c *Context) WithCredentials(credentials auth.CredentialStore) *Context
type ErrNotV2Registry ¶
type ErrNotV2Registry struct {
Registry string
}
ErrNotV2Registry is returned when the server does not report itself as a V2 Docker registry
func (*ErrNotV2Registry) Error ¶
func (e *ErrNotV2Registry) Error() string
type RefreshTokenStore ¶
type RefreshTokenStore interface { RefreshToken(url *url.URL, service string) string SetRefreshToken(url *url.URL, service string, token string) }
func NewRefreshTokenStore ¶
func NewRefreshTokenStore() RefreshTokenStore
type RepositoryRetriever ¶
type RepositoryRetriever interface { // Repository returns a properly authenticated distribution.Repository for the given registry, repository // name, and insecure toleration behavior. Repository(ctx gocontext.Context, registry *url.URL, repoName string, insecure bool) (distribution.Repository, error) }
RepositoryRetriever fetches a Docker distribution.Repository.