mirror of https://github.com/docker/docs.git
documentation.
This commit is contained in:
parent
73e79a3310
commit
cd209f406e
|
@ -112,6 +112,8 @@ func doWithCookies(c *http.Client, req *http.Request) (*http.Response, error) {
|
||||||
return c.Do(req)
|
return c.Do(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the user agent field in the header based on the versions provided
|
||||||
|
// in NewRegistry() and extra.
|
||||||
func (r *Registry) setUserAgent(req *http.Request, extra ...VersionChecker) {
|
func (r *Registry) setUserAgent(req *http.Request, extra ...VersionChecker) {
|
||||||
if len(r.baseVersions)+len(extra) == 0 {
|
if len(r.baseVersions)+len(extra) == 0 {
|
||||||
return
|
return
|
||||||
|
@ -582,6 +584,12 @@ func validVersion(version VersionChecker) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert versions to a string and append the string to the string base.
|
||||||
|
//
|
||||||
|
// Each VersionChecker will be converted to a string in the format of
|
||||||
|
// "product/version", where the "product" is get from the Name() method, while
|
||||||
|
// version is get from the Version() method. Several pieces of verson information
|
||||||
|
// will be concatinated and separated by space.
|
||||||
func appendVersions(base string, versions ...VersionChecker) string {
|
func appendVersions(base string, versions ...VersionChecker) string {
|
||||||
if len(versions) == 0 {
|
if len(versions) == 0 {
|
||||||
return base
|
return base
|
||||||
|
|
|
@ -26,6 +26,11 @@ func (srv *Server) DockerVersion() APIVersion {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// plainVersionChecker is a simple implementation of
|
||||||
|
// the interface VersionChecker, which is used
|
||||||
|
// to provide version information for some product,
|
||||||
|
// component, etc. It stores the product name and the version
|
||||||
|
// in string and returns them on calls to Name() and Version().
|
||||||
type plainVersionChecker struct {
|
type plainVersionChecker struct {
|
||||||
name string
|
name string
|
||||||
version string
|
version string
|
||||||
|
@ -39,6 +44,10 @@ func (v *plainVersionChecker) Version() string {
|
||||||
return v.version
|
return v.version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// versionCheckers() returns version informations of:
|
||||||
|
// docker, go, git-commit (of the docker) and the host's kernel.
|
||||||
|
//
|
||||||
|
// Such information will be used on call to NewRegistry().
|
||||||
func (srv *Server) versionCheckers() []registry.VersionChecker {
|
func (srv *Server) versionCheckers() []registry.VersionChecker {
|
||||||
v := srv.DockerVersion()
|
v := srv.DockerVersion()
|
||||||
ret := make([]registry.VersionChecker, 0, 4)
|
ret := make([]registry.VersionChecker, 0, 4)
|
||||||
|
|
Loading…
Reference in New Issue