registry: update some godoc

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-07-07 21:46:24 +02:00
parent 69c19cf0b0
commit 3f8cbd8ec9
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
3 changed files with 14 additions and 8 deletions

View file

@ -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://") {

View file

@ -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)
}

View file

@ -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)