mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Move api-specific code to the api package
This facilitates the refactoring of commands.go. Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
This commit is contained in:
@@ -27,6 +27,7 @@ import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// FIXME: move code common to client and server to common.go
|
||||
const (
|
||||
APIVERSION = 1.9
|
||||
DEFAULTHTTPHOST = "127.0.0.1"
|
||||
@@ -34,6 +35,14 @@ const (
|
||||
DEFAULTUNIXSOCKET = "/var/run/docker.sock"
|
||||
)
|
||||
|
||||
func ValidateHost(val string) (string, error) {
|
||||
host, err := utils.ParseHost(DEFAULTHTTPHOST, DEFAULTHTTPPORT, DEFAULTUNIXSOCKET, val)
|
||||
if err != nil {
|
||||
return val, err
|
||||
}
|
||||
return host, nil
|
||||
}
|
||||
|
||||
type HttpApiFunc func(eng *engine.Engine, version float64, w http.ResponseWriter, r *http.Request, vars map[string]string) error
|
||||
|
||||
func init() {
|
||||
|
||||
Reference in New Issue
Block a user