From 3f8cbd8ec91bc294151574a953f7450d931da9ca Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 7 Jul 2023 21:46:24 +0200 Subject: [PATCH] registry: update some godoc Signed-off-by: Sebastiaan van Stijn --- registry/auth.go | 6 ++++-- registry/config.go | 12 ++++++++---- registry/service.go | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/registry/auth.go b/registry/auth.go index d5ee9bd504..d9962e4530 100644 --- a/registry/auth.go +++ b/registry/auth.go @@ -125,8 +125,10 @@ func v2AuthHTTPClient(endpoint *url.URL, authTransport http.RoundTripper, modifi }, nil } -// ConvertToHostname converts a registry url which has http|https prepended -// to just an hostname. +// ConvertToHostname normalizes a registry URL which has http|https prepended +// to just its hostname. It is used to match credentials, which may be either +// stored as hostname or as hostname including scheme (in legacy configuration +// files). func ConvertToHostname(url string) string { stripped := url if strings.HasPrefix(url, "http://") { diff --git a/registry/config.go b/registry/config.go index 696f3ecf9a..45bb6482a7 100644 --- a/registry/config.go +++ b/registry/config.go @@ -320,7 +320,8 @@ func isCIDRMatch(cidrs []*registry.NetIPNet, URLHost string) bool { return false } -// ValidateMirror validates an HTTP(S) registry mirror +// ValidateMirror validates an HTTP(S) registry mirror. It is used by the daemon +// to validate the daemon configuration. func ValidateMirror(val string) (string, error) { uri, err := url.Parse(val) if err != nil { @@ -340,7 +341,8 @@ func ValidateMirror(val string) (string, error) { return strings.TrimSuffix(val, "/") + "/", nil } -// ValidateIndexName validates an index name. +// ValidateIndexName validates an index name. It is used by the daemon to +// validate the daemon configuration. func ValidateIndexName(val string) (string, error) { // TODO: upstream this to check to reference package if val == "index.docker.io" { @@ -426,8 +428,10 @@ func newRepositoryInfo(config *serviceConfig, name reference.Named) (*Repository }, nil } -// ParseRepositoryInfo performs the breakdown of a repository name into a RepositoryInfo, but -// lacks registry configuration. +// ParseRepositoryInfo performs the breakdown of a repository name into a +// [RepositoryInfo], but lacks registry configuration. +// +// It is used by the Docker cli to interact with registry-related endpoints. func ParseRepositoryInfo(reposName reference.Named) (*RepositoryInfo, error) { return newRepositoryInfo(emptyServiceConfig, reposName) } diff --git a/registry/service.go b/registry/service.go index 752d2e7458..0016304956 100644 --- a/registry/service.go +++ b/registry/service.go @@ -20,8 +20,8 @@ type Service struct { mu sync.RWMutex } -// NewService returns a new instance of defaultService ready to be -// installed into an engine. +// NewService returns a new instance of [Service] ready to be installed into +// an engine. func NewService(options ServiceOptions) (*Service, error) { config, err := newServiceConfig(options)