func New(image, user, password string) *Repository {
	c := &Repository{
		client:   &http.Client{},
		user:     user,
		password: password,
	}
	p := strings.SplitN(image, "/", 2)
	if strings.Contains(p[0], ".") && len(p) >= 2 {
		c.host = p[0]
		c.repo = p[1]
	} else {
		if !strings.Contains(image, "/") {
			image = "library/" + image
		}
		c.host = dockerHubHost
		c.repo = image
	}
	return c
}
New creates a client for a repository.
package registry
import (
	"encoding/json"
	"fmt"
	"net/http"
	"net/url"
	"regexp"
	"strings"
	"github.com/pkg/errors"
)
const dockerHubHost = "registry-1.docker.io"
type Repository struct {
	client   *http.Client
	host     string
	repo     string
	user     string
	password string
	token    string
}