Remove dockerversion from registry package
| ... | ... |
@@ -21,6 +21,7 @@ import ( |
| 21 | 21 |
"github.com/docker/distribution/registry/client/transport" |
| 22 | 22 |
"github.com/docker/docker/cliconfig" |
| 23 | 23 |
"github.com/docker/docker/distribution" |
| 24 |
+ "github.com/docker/docker/dockerversion" |
|
| 24 | 25 |
"github.com/docker/docker/pkg/jsonmessage" |
| 25 | 26 |
flag "github.com/docker/docker/pkg/mflag" |
| 26 | 27 |
"github.com/docker/docker/reference" |
| ... | ... |
@@ -139,7 +140,7 @@ func (cli *DockerCli) getNotaryRepository(repoInfo *registry.RepositoryInfo, aut |
| 139 | 139 |
} |
| 140 | 140 |
|
| 141 | 141 |
// Skip configuration headers since request is not going to Docker daemon |
| 142 |
- modifiers := registry.DockerHeaders(http.Header{})
|
|
| 142 |
+ modifiers := registry.DockerHeaders(dockerversion.DockerUserAgent(), http.Header{})
|
|
| 143 | 143 |
authTransport := transport.NewTransport(base, modifiers...) |
| 144 | 144 |
pingClient := &http.Client{
|
| 145 | 145 |
Transport: authTransport, |
| ... | ... |
@@ -41,6 +41,7 @@ import ( |
| 41 | 41 |
"github.com/docker/docker/distribution" |
| 42 | 42 |
dmetadata "github.com/docker/docker/distribution/metadata" |
| 43 | 43 |
"github.com/docker/docker/distribution/xfer" |
| 44 |
+ "github.com/docker/docker/dockerversion" |
|
| 44 | 45 |
derr "github.com/docker/docker/errors" |
| 45 | 46 |
"github.com/docker/docker/image" |
| 46 | 47 |
"github.com/docker/docker/image/tarexport" |
| ... | ... |
@@ -1444,7 +1445,7 @@ func configureVolumes(config *Config, rootUID, rootGID int) (*store.VolumeStore, |
| 1444 | 1444 |
|
| 1445 | 1445 |
// AuthenticateToRegistry checks the validity of credentials in authConfig |
| 1446 | 1446 |
func (daemon *Daemon) AuthenticateToRegistry(authConfig *types.AuthConfig) (string, error) {
|
| 1447 |
- return daemon.RegistryService.Auth(authConfig) |
|
| 1447 |
+ return daemon.RegistryService.Auth(authConfig, dockerversion.DockerUserAgent()) |
|
| 1448 | 1448 |
} |
| 1449 | 1449 |
|
| 1450 | 1450 |
// SearchRegistryForImages queries the registry for images matching |
| ... | ... |
@@ -1452,7 +1453,7 @@ func (daemon *Daemon) AuthenticateToRegistry(authConfig *types.AuthConfig) (stri |
| 1452 | 1452 |
func (daemon *Daemon) SearchRegistryForImages(term string, |
| 1453 | 1453 |
authConfig *types.AuthConfig, |
| 1454 | 1454 |
headers map[string][]string) (*registrytypes.SearchResults, error) {
|
| 1455 |
- return daemon.RegistryService.Search(term, authConfig, headers) |
|
| 1455 |
+ return daemon.RegistryService.Search(term, authConfig, dockerversion.DockerUserAgent(), headers) |
|
| 1456 | 1456 |
} |
| 1457 | 1457 |
|
| 1458 | 1458 |
// IsShuttingDown tells whether the daemon is shutting down or not |
| ... | ... |
@@ -19,7 +19,6 @@ import ( |
| 19 | 19 |
// ImagePullConfig stores pull configuration. |
| 20 | 20 |
type ImagePullConfig struct {
|
| 21 | 21 |
// MetaHeaders stores HTTP headers with metadata about the image |
| 22 |
- // (DockerHeaders with prefix X-Meta- in the request). |
|
| 23 | 22 |
MetaHeaders map[string][]string |
| 24 | 23 |
// AuthConfig holds authentication credentials for authenticating with |
| 25 | 24 |
// the registry. |
| ... | ... |
@@ -14,6 +14,7 @@ import ( |
| 14 | 14 |
"github.com/docker/distribution/registry/client/transport" |
| 15 | 15 |
"github.com/docker/docker/distribution/metadata" |
| 16 | 16 |
"github.com/docker/docker/distribution/xfer" |
| 17 |
+ "github.com/docker/docker/dockerversion" |
|
| 17 | 18 |
"github.com/docker/docker/image" |
| 18 | 19 |
"github.com/docker/docker/image/v1" |
| 19 | 20 |
"github.com/docker/docker/layer" |
| ... | ... |
@@ -47,10 +48,10 @@ func (p *v1Puller) Pull(ctx context.Context, ref reference.Named) error {
|
| 47 | 47 |
tr := transport.NewTransport( |
| 48 | 48 |
// TODO(tiborvass): was ReceiveTimeout |
| 49 | 49 |
registry.NewTransport(tlsConfig), |
| 50 |
- registry.DockerHeaders(p.config.MetaHeaders)..., |
|
| 50 |
+ registry.DockerHeaders(dockerversion.DockerUserAgent(), p.config.MetaHeaders)..., |
|
| 51 | 51 |
) |
| 52 | 52 |
client := registry.HTTPClient(tr) |
| 53 |
- v1Endpoint, err := p.endpoint.ToV1Endpoint(p.config.MetaHeaders) |
|
| 53 |
+ v1Endpoint, err := p.endpoint.ToV1Endpoint(dockerversion.DockerUserAgent(), p.config.MetaHeaders) |
|
| 54 | 54 |
if err != nil {
|
| 55 | 55 |
logrus.Debugf("Could not get v1 endpoint: %v", err)
|
| 56 | 56 |
return fallbackError{err: err}
|
| ... | ... |
@@ -22,7 +22,6 @@ import ( |
| 22 | 22 |
// ImagePushConfig stores push configuration. |
| 23 | 23 |
type ImagePushConfig struct {
|
| 24 | 24 |
// MetaHeaders store HTTP headers with metadata about the image |
| 25 |
- // (DockerHeaders with prefix X-Meta- in the request). |
|
| 26 | 25 |
MetaHeaders map[string][]string |
| 27 | 26 |
// AuthConfig holds authentication credentials for authenticating with |
| 28 | 27 |
// the registry. |
| ... | ... |
@@ -8,6 +8,7 @@ import ( |
| 8 | 8 |
"github.com/docker/distribution/digest" |
| 9 | 9 |
"github.com/docker/distribution/registry/client/transport" |
| 10 | 10 |
"github.com/docker/docker/distribution/metadata" |
| 11 |
+ "github.com/docker/docker/dockerversion" |
|
| 11 | 12 |
"github.com/docker/docker/image" |
| 12 | 13 |
"github.com/docker/docker/image/v1" |
| 13 | 14 |
"github.com/docker/docker/layer" |
| ... | ... |
@@ -38,10 +39,10 @@ func (p *v1Pusher) Push(ctx context.Context) error {
|
| 38 | 38 |
tr := transport.NewTransport( |
| 39 | 39 |
// TODO(tiborvass): was NoTimeout |
| 40 | 40 |
registry.NewTransport(tlsConfig), |
| 41 |
- registry.DockerHeaders(p.config.MetaHeaders)..., |
|
| 41 |
+ registry.DockerHeaders(dockerversion.DockerUserAgent(), p.config.MetaHeaders)..., |
|
| 42 | 42 |
) |
| 43 | 43 |
client := registry.HTTPClient(tr) |
| 44 |
- v1Endpoint, err := p.endpoint.ToV1Endpoint(p.config.MetaHeaders) |
|
| 44 |
+ v1Endpoint, err := p.endpoint.ToV1Endpoint(dockerversion.DockerUserAgent(), p.config.MetaHeaders) |
|
| 45 | 45 |
if err != nil {
|
| 46 | 46 |
logrus.Debugf("Could not get v1 endpoint: %v", err)
|
| 47 | 47 |
return fallbackError{err: err}
|
| ... | ... |
@@ -15,6 +15,7 @@ import ( |
| 15 | 15 |
"github.com/docker/distribution/registry/client/auth" |
| 16 | 16 |
"github.com/docker/distribution/registry/client/transport" |
| 17 | 17 |
"github.com/docker/docker/distribution/xfer" |
| 18 |
+ "github.com/docker/docker/dockerversion" |
|
| 18 | 19 |
"github.com/docker/docker/registry" |
| 19 | 20 |
"github.com/docker/engine-api/types" |
| 20 | 21 |
"golang.org/x/net/context" |
| ... | ... |
@@ -68,7 +69,7 @@ func NewV2Repository(ctx context.Context, repoInfo *registry.RepositoryInfo, end |
| 68 | 68 |
DisableKeepAlives: true, |
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 |
- modifiers := registry.DockerHeaders(metaHeaders) |
|
| 71 |
+ modifiers := registry.DockerHeaders(dockerversion.DockerUserAgent(), metaHeaders) |
|
| 72 | 72 |
authTransport := transport.NewTransport(base, modifiers...) |
| 73 | 73 |
pingClient := &http.Client{
|
| 74 | 74 |
Transport: authTransport, |
| 75 | 75 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,24 @@ |
| 0 |
+package dockerversion |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "runtime" |
|
| 4 |
+ |
|
| 5 |
+ "github.com/docker/docker/pkg/parsers/kernel" |
|
| 6 |
+ "github.com/docker/docker/pkg/useragent" |
|
| 7 |
+) |
|
| 8 |
+ |
|
| 9 |
+// DockerUserAgent is the User-Agent the Docker client uses to identify itself. |
|
| 10 |
+// It is populated from version information of different components. |
|
| 11 |
+func DockerUserAgent() string {
|
|
| 12 |
+ httpVersion := make([]useragent.VersionInfo, 0, 6) |
|
| 13 |
+ httpVersion = append(httpVersion, useragent.VersionInfo{Name: "docker", Version: Version})
|
|
| 14 |
+ httpVersion = append(httpVersion, useragent.VersionInfo{Name: "go", Version: runtime.Version()})
|
|
| 15 |
+ httpVersion = append(httpVersion, useragent.VersionInfo{Name: "git-commit", Version: GitCommit})
|
|
| 16 |
+ if kernelVersion, err := kernel.GetKernelVersion(); err == nil {
|
|
| 17 |
+ httpVersion = append(httpVersion, useragent.VersionInfo{Name: "kernel", Version: kernelVersion.String()})
|
|
| 18 |
+ } |
|
| 19 |
+ httpVersion = append(httpVersion, useragent.VersionInfo{Name: "os", Version: runtime.GOOS})
|
|
| 20 |
+ httpVersion = append(httpVersion, useragent.VersionInfo{Name: "arch", Version: runtime.GOARCH})
|
|
| 21 |
+ |
|
| 22 |
+ return useragent.AppendVersions("", httpVersion...)
|
|
| 23 |
+} |
| ... | ... |
@@ -45,12 +45,12 @@ func scanForAPIVersion(address string) (string, APIVersion) {
|
| 45 | 45 |
|
| 46 | 46 |
// NewEndpoint parses the given address to return a registry endpoint. v can be used to |
| 47 | 47 |
// specify a specific endpoint version |
| 48 |
-func NewEndpoint(index *registrytypes.IndexInfo, metaHeaders http.Header, v APIVersion) (*Endpoint, error) {
|
|
| 48 |
+func NewEndpoint(index *registrytypes.IndexInfo, userAgent string, metaHeaders http.Header, v APIVersion) (*Endpoint, error) {
|
|
| 49 | 49 |
tlsConfig, err := newTLSConfig(index.Name, index.Secure) |
| 50 | 50 |
if err != nil {
|
| 51 | 51 |
return nil, err |
| 52 | 52 |
} |
| 53 |
- endpoint, err := newEndpoint(GetAuthConfigKey(index), tlsConfig, metaHeaders) |
|
| 53 |
+ endpoint, err := newEndpoint(GetAuthConfigKey(index), tlsConfig, userAgent, metaHeaders) |
|
| 54 | 54 |
if err != nil {
|
| 55 | 55 |
return nil, err |
| 56 | 56 |
} |
| ... | ... |
@@ -91,7 +91,7 @@ func validateEndpoint(endpoint *Endpoint) error {
|
| 91 | 91 |
return nil |
| 92 | 92 |
} |
| 93 | 93 |
|
| 94 |
-func newEndpoint(address string, tlsConfig *tls.Config, metaHeaders http.Header) (*Endpoint, error) {
|
|
| 94 |
+func newEndpoint(address string, tlsConfig *tls.Config, userAgent string, metaHeaders http.Header) (*Endpoint, error) {
|
|
| 95 | 95 |
var ( |
| 96 | 96 |
endpoint = new(Endpoint) |
| 97 | 97 |
trimmedAddress string |
| ... | ... |
@@ -112,7 +112,7 @@ func newEndpoint(address string, tlsConfig *tls.Config, metaHeaders http.Header) |
| 112 | 112 |
|
| 113 | 113 |
// TODO(tiborvass): make sure a ConnectTimeout transport is used |
| 114 | 114 |
tr := NewTransport(tlsConfig) |
| 115 |
- endpoint.client = HTTPClient(transport.NewTransport(tr, DockerHeaders(metaHeaders)...)) |
|
| 115 |
+ endpoint.client = HTTPClient(transport.NewTransport(tr, DockerHeaders(userAgent, metaHeaders)...)) |
|
| 116 | 116 |
return endpoint, nil |
| 117 | 117 |
} |
| 118 | 118 |
|
| ... | ... |
@@ -19,7 +19,7 @@ func TestEndpointParse(t *testing.T) {
|
| 19 | 19 |
{"0.0.0.0:5000", "https://0.0.0.0:5000/v0/"},
|
| 20 | 20 |
} |
| 21 | 21 |
for _, td := range testData {
|
| 22 |
- e, err := newEndpoint(td.str, nil, nil) |
|
| 22 |
+ e, err := newEndpoint(td.str, nil, "", nil) |
|
| 23 | 23 |
if err != nil {
|
| 24 | 24 |
t.Errorf("%q: %s", td.str, err)
|
| 25 | 25 |
} |
| ... | ... |
@@ -21,9 +21,6 @@ import ( |
| 21 | 21 |
"github.com/docker/distribution/registry/api/v2" |
| 22 | 22 |
"github.com/docker/distribution/registry/client" |
| 23 | 23 |
"github.com/docker/distribution/registry/client/transport" |
| 24 |
- "github.com/docker/docker/dockerversion" |
|
| 25 |
- "github.com/docker/docker/pkg/parsers/kernel" |
|
| 26 |
- "github.com/docker/docker/pkg/useragent" |
|
| 27 | 24 |
"github.com/docker/go-connections/tlsconfig" |
| 28 | 25 |
) |
| 29 | 26 |
|
| ... | ... |
@@ -34,23 +31,7 @@ var ( |
| 34 | 34 |
errLoginRequired = errors.New("Authentication is required.")
|
| 35 | 35 |
) |
| 36 | 36 |
|
| 37 |
-// dockerUserAgent is the User-Agent the Docker client uses to identify itself. |
|
| 38 |
-// It is populated on init(), comprising version information of different components. |
|
| 39 |
-var dockerUserAgent string |
|
| 40 |
- |
|
| 41 | 37 |
func init() {
|
| 42 |
- httpVersion := make([]useragent.VersionInfo, 0, 6) |
|
| 43 |
- httpVersion = append(httpVersion, useragent.VersionInfo{Name: "docker", Version: dockerversion.Version})
|
|
| 44 |
- httpVersion = append(httpVersion, useragent.VersionInfo{Name: "go", Version: runtime.Version()})
|
|
| 45 |
- httpVersion = append(httpVersion, useragent.VersionInfo{Name: "git-commit", Version: dockerversion.GitCommit})
|
|
| 46 |
- if kernelVersion, err := kernel.GetKernelVersion(); err == nil {
|
|
| 47 |
- httpVersion = append(httpVersion, useragent.VersionInfo{Name: "kernel", Version: kernelVersion.String()})
|
|
| 48 |
- } |
|
| 49 |
- httpVersion = append(httpVersion, useragent.VersionInfo{Name: "os", Version: runtime.GOOS})
|
|
| 50 |
- httpVersion = append(httpVersion, useragent.VersionInfo{Name: "arch", Version: runtime.GOARCH})
|
|
| 51 |
- |
|
| 52 |
- dockerUserAgent = useragent.AppendVersions("", httpVersion...)
|
|
| 53 |
- |
|
| 54 | 38 |
if runtime.GOOS != "linux" {
|
| 55 | 39 |
V2Only = true |
| 56 | 40 |
} |
| ... | ... |
@@ -130,12 +111,13 @@ func ReadCertsDirectory(tlsConfig *tls.Config, directory string) error {
|
| 130 | 130 |
return nil |
| 131 | 131 |
} |
| 132 | 132 |
|
| 133 |
-// DockerHeaders returns request modifiers that ensure requests have |
|
| 134 |
-// the User-Agent header set to dockerUserAgent and that metaHeaders |
|
| 135 |
-// are added. |
|
| 136 |
-func DockerHeaders(metaHeaders http.Header) []transport.RequestModifier {
|
|
| 137 |
- modifiers := []transport.RequestModifier{
|
|
| 138 |
- transport.NewHeaderRequestModifier(http.Header{"User-Agent": []string{dockerUserAgent}}),
|
|
| 133 |
+// DockerHeaders returns request modifiers with a User-Agent and metaHeaders |
|
| 134 |
+func DockerHeaders(userAgent string, metaHeaders http.Header) []transport.RequestModifier {
|
|
| 135 |
+ modifiers := []transport.RequestModifier{}
|
|
| 136 |
+ if userAgent != "" {
|
|
| 137 |
+ modifiers = append(modifiers, transport.NewHeaderRequestModifier(http.Header{
|
|
| 138 |
+ "User-Agent": []string{userAgent},
|
|
| 139 |
+ })) |
|
| 139 | 140 |
} |
| 140 | 141 |
if metaHeaders != nil {
|
| 141 | 142 |
modifiers = append(modifiers, transport.NewHeaderRequestModifier(metaHeaders)) |
| ... | ... |
@@ -25,12 +25,13 @@ const ( |
| 25 | 25 |
|
| 26 | 26 |
func spawnTestRegistrySession(t *testing.T) *Session {
|
| 27 | 27 |
authConfig := &types.AuthConfig{}
|
| 28 |
- endpoint, err := NewEndpoint(makeIndex("/v1/"), nil, APIVersionUnknown)
|
|
| 28 |
+ endpoint, err := NewEndpoint(makeIndex("/v1/"), "", nil, APIVersionUnknown)
|
|
| 29 | 29 |
if err != nil {
|
| 30 | 30 |
t.Fatal(err) |
| 31 | 31 |
} |
| 32 |
+ userAgent := "docker test client" |
|
| 32 | 33 |
var tr http.RoundTripper = debugTransport{NewTransport(nil), t.Log}
|
| 33 |
- tr = transport.NewTransport(AuthTransport(tr, authConfig, false), DockerHeaders(nil)...) |
|
| 34 |
+ tr = transport.NewTransport(AuthTransport(tr, authConfig, false), DockerHeaders(userAgent, nil)...) |
|
| 34 | 35 |
client := HTTPClient(tr) |
| 35 | 36 |
r, err := NewSession(client, authConfig, endpoint) |
| 36 | 37 |
if err != nil {
|
| ... | ... |
@@ -52,7 +53,7 @@ func spawnTestRegistrySession(t *testing.T) *Session {
|
| 52 | 52 |
|
| 53 | 53 |
func TestPingRegistryEndpoint(t *testing.T) {
|
| 54 | 54 |
testPing := func(index *registrytypes.IndexInfo, expectedStandalone bool, assertMessage string) {
|
| 55 |
- ep, err := NewEndpoint(index, nil, APIVersionUnknown) |
|
| 55 |
+ ep, err := NewEndpoint(index, "", nil, APIVersionUnknown) |
|
| 56 | 56 |
if err != nil {
|
| 57 | 57 |
t.Fatal(err) |
| 58 | 58 |
} |
| ... | ... |
@@ -72,7 +73,7 @@ func TestPingRegistryEndpoint(t *testing.T) {
|
| 72 | 72 |
func TestEndpoint(t *testing.T) {
|
| 73 | 73 |
// Simple wrapper to fail test if err != nil |
| 74 | 74 |
expandEndpoint := func(index *registrytypes.IndexInfo) *Endpoint {
|
| 75 |
- endpoint, err := NewEndpoint(index, nil, APIVersionUnknown) |
|
| 75 |
+ endpoint, err := NewEndpoint(index, "", nil, APIVersionUnknown) |
|
| 76 | 76 |
if err != nil {
|
| 77 | 77 |
t.Fatal(err) |
| 78 | 78 |
} |
| ... | ... |
@@ -81,7 +82,7 @@ func TestEndpoint(t *testing.T) {
|
| 81 | 81 |
|
| 82 | 82 |
assertInsecureIndex := func(index *registrytypes.IndexInfo) {
|
| 83 | 83 |
index.Secure = true |
| 84 |
- _, err := NewEndpoint(index, nil, APIVersionUnknown) |
|
| 84 |
+ _, err := NewEndpoint(index, "", nil, APIVersionUnknown) |
|
| 85 | 85 |
assertNotEqual(t, err, nil, index.Name+": Expected error for insecure index") |
| 86 | 86 |
assertEqual(t, strings.Contains(err.Error(), "insecure-registry"), true, index.Name+": Expected insecure-registry error for insecure index") |
| 87 | 87 |
index.Secure = false |
| ... | ... |
@@ -89,7 +90,7 @@ func TestEndpoint(t *testing.T) {
|
| 89 | 89 |
|
| 90 | 90 |
assertSecureIndex := func(index *registrytypes.IndexInfo) {
|
| 91 | 91 |
index.Secure = true |
| 92 |
- _, err := NewEndpoint(index, nil, APIVersionUnknown) |
|
| 92 |
+ _, err := NewEndpoint(index, "", nil, APIVersionUnknown) |
|
| 93 | 93 |
assertNotEqual(t, err, nil, index.Name+": Expected cert error for secure index") |
| 94 | 94 |
assertEqual(t, strings.Contains(err.Error(), "certificate signed by unknown authority"), true, index.Name+": Expected cert error for secure index") |
| 95 | 95 |
index.Secure = false |
| ... | ... |
@@ -155,7 +156,7 @@ func TestEndpoint(t *testing.T) {
|
| 155 | 155 |
} |
| 156 | 156 |
for _, address := range badEndpoints {
|
| 157 | 157 |
index.Name = address |
| 158 |
- _, err := NewEndpoint(index, nil, APIVersionUnknown) |
|
| 158 |
+ _, err := NewEndpoint(index, "", nil, APIVersionUnknown) |
|
| 159 | 159 |
checkNotEqual(t, err, nil, "Expected error while expanding bad endpoint") |
| 160 | 160 |
} |
| 161 | 161 |
} |
| ... | ... |
@@ -28,7 +28,7 @@ func NewService(options *Options) *Service {
|
| 28 | 28 |
// Auth contacts the public registry with the provided credentials, |
| 29 | 29 |
// and returns OK if authentication was successful. |
| 30 | 30 |
// It can be used to verify the validity of a client's credentials. |
| 31 |
-func (s *Service) Auth(authConfig *types.AuthConfig) (string, error) {
|
|
| 31 |
+func (s *Service) Auth(authConfig *types.AuthConfig, userAgent string) (string, error) {
|
|
| 32 | 32 |
addr := authConfig.ServerAddress |
| 33 | 33 |
if addr == "" {
|
| 34 | 34 |
// Use the official registry address if not specified. |
| ... | ... |
@@ -45,7 +45,7 @@ func (s *Service) Auth(authConfig *types.AuthConfig) (string, error) {
|
| 45 | 45 |
endpointVersion = APIVersion2 |
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 |
- endpoint, err := NewEndpoint(index, nil, endpointVersion) |
|
| 48 |
+ endpoint, err := NewEndpoint(index, userAgent, nil, endpointVersion) |
|
| 49 | 49 |
if err != nil {
|
| 50 | 50 |
return "", err |
| 51 | 51 |
} |
| ... | ... |
@@ -72,7 +72,7 @@ func splitReposSearchTerm(reposName string) (string, string) {
|
| 72 | 72 |
|
| 73 | 73 |
// Search queries the public registry for images matching the specified |
| 74 | 74 |
// search terms, and returns the results. |
| 75 |
-func (s *Service) Search(term string, authConfig *types.AuthConfig, headers map[string][]string) (*registrytypes.SearchResults, error) {
|
|
| 75 |
+func (s *Service) Search(term string, authConfig *types.AuthConfig, userAgent string, headers map[string][]string) (*registrytypes.SearchResults, error) {
|
|
| 76 | 76 |
if err := validateNoSchema(term); err != nil {
|
| 77 | 77 |
return nil, err |
| 78 | 78 |
} |
| ... | ... |
@@ -85,7 +85,7 @@ func (s *Service) Search(term string, authConfig *types.AuthConfig, headers map[ |
| 85 | 85 |
} |
| 86 | 86 |
|
| 87 | 87 |
// *TODO: Search multiple indexes. |
| 88 |
- endpoint, err := NewEndpoint(index, http.Header(headers), APIVersionUnknown) |
|
| 88 |
+ endpoint, err := NewEndpoint(index, userAgent, http.Header(headers), APIVersionUnknown) |
|
| 89 | 89 |
if err != nil {
|
| 90 | 90 |
return nil, err |
| 91 | 91 |
} |
| ... | ... |
@@ -129,8 +129,8 @@ type APIEndpoint struct {
|
| 129 | 129 |
} |
| 130 | 130 |
|
| 131 | 131 |
// ToV1Endpoint returns a V1 API endpoint based on the APIEndpoint |
| 132 |
-func (e APIEndpoint) ToV1Endpoint(metaHeaders http.Header) (*Endpoint, error) {
|
|
| 133 |
- return newEndpoint(e.URL, e.TLSConfig, metaHeaders) |
|
| 132 |
+func (e APIEndpoint) ToV1Endpoint(userAgent string, metaHeaders http.Header) (*Endpoint, error) {
|
|
| 133 |
+ return newEndpoint(e.URL, e.TLSConfig, userAgent, metaHeaders) |
|
| 134 | 134 |
} |
| 135 | 135 |
|
| 136 | 136 |
// TLSConfig constructs a client TLS configuration based on server defaults |