Signed-off-by: John Howard <jhoward@microsoft.com>
| ... | ... |
@@ -21,6 +21,6 @@ func (cli *Client) ContainerStats(ctx context.Context, containerID string, strea |
| 21 | 21 |
return types.ContainerStats{}, err
|
| 22 | 22 |
} |
| 23 | 23 |
|
| 24 |
- osType := GetDockerOS(resp.header.Get("Server"))
|
|
| 24 |
+ osType := getDockerOS(resp.header.Get("Server"))
|
|
| 25 | 25 |
return types.ContainerStats{Body: resp.body, OSType: osType}, err
|
| 26 | 26 |
} |
| ... | ... |
@@ -6,7 +6,6 @@ import ( |
| 6 | 6 |
"io" |
| 7 | 7 |
"net/http" |
| 8 | 8 |
"net/url" |
| 9 |
- "regexp" |
|
| 10 | 9 |
"strconv" |
| 11 | 10 |
|
| 12 | 11 |
"golang.org/x/net/context" |
| ... | ... |
@@ -15,8 +14,6 @@ import ( |
| 15 | 15 |
"github.com/docker/docker/api/types/container" |
| 16 | 16 |
) |
| 17 | 17 |
|
| 18 |
-var headerRegexp = regexp.MustCompile(`\ADocker/.+\s\((.+)\)\z`) |
|
| 19 |
- |
|
| 20 | 18 |
// ImageBuild sends request to the daemon to build images. |
| 21 | 19 |
// The Body in the response implement an io.ReadCloser and it's up to the caller to |
| 22 | 20 |
// close it. |
| ... | ... |
@@ -39,7 +36,7 @@ func (cli *Client) ImageBuild(ctx context.Context, buildContext io.Reader, optio |
| 39 | 39 |
return types.ImageBuildResponse{}, err
|
| 40 | 40 |
} |
| 41 | 41 |
|
| 42 |
- osType := GetDockerOS(serverResp.header.Get("Server"))
|
|
| 42 |
+ osType := getDockerOS(serverResp.header.Get("Server"))
|
|
| 43 | 43 |
|
| 44 | 44 |
return types.ImageBuildResponse{
|
| 45 | 45 |
Body: serverResp.body, |
| ... | ... |
@@ -124,13 +121,3 @@ func (cli *Client) imageBuildOptionsToQuery(options types.ImageBuildOptions) (ur |
| 124 | 124 |
|
| 125 | 125 |
return query, nil |
| 126 | 126 |
} |
| 127 |
- |
|
| 128 |
-// GetDockerOS returns the operating system based on the server header from the daemon. |
|
| 129 |
-func GetDockerOS(serverHeader string) string {
|
|
| 130 |
- var osType string |
|
| 131 |
- matches := headerRegexp.FindStringSubmatch(serverHeader) |
|
| 132 |
- if len(matches) > 0 {
|
|
| 133 |
- osType = matches[1] |
|
| 134 |
- } |
|
| 135 |
- return osType |
|
| 136 |
-} |
| 229 | 229 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,15 @@ |
| 0 |
+package client |
|
| 1 |
+ |
|
| 2 |
+import "regexp" |
|
| 3 |
+ |
|
| 4 |
+var headerRegexp = regexp.MustCompile(`\ADocker/.+\s\((.+)\)\z`) |
|
| 5 |
+ |
|
| 6 |
+// getDockerOS returns the operating system based on the server header from the daemon. |
|
| 7 |
+func getDockerOS(serverHeader string) string {
|
|
| 8 |
+ var osType string |
|
| 9 |
+ matches := headerRegexp.FindStringSubmatch(serverHeader) |
|
| 10 |
+ if len(matches) > 0 {
|
|
| 11 |
+ osType = matches[1] |
|
| 12 |
+ } |
|
| 13 |
+ return osType |
|
| 14 |
+} |