code: func allEndpoints(namedRef reference.Named, insecure bool) ([]registry.APIEndpoint, error) {
  	repoInfo, err := registry.ParseRepositoryInfo(namedRef)
  	if err != nil {
  		return nil, err
  	}
  
  	var serviceOpts registry.ServiceOptions
  	if insecure {
  		logrus.Debugf("allowing insecure registry for: %s", reference.Domain(namedRef))
  		serviceOpts.InsecureRegistries = []string{reference.Domain(namedRef)}
  	}
  	registryService, err := registry.NewService(serviceOpts)
  	if err != nil {
  		return []registry.APIEndpoint{}, err
  	}
  	endpoints, err := registryService.LookupPullEndpoints(reference.Domain(repoInfo.Name))
  	logrus.Debugf("endpoints for %s: %v", namedRef, endpoints)
  	return endpoints, err
  }
docs: // allEndpoints returns a list of endpoints ordered by priority (v2, https, v1).