2015-02-13 14:46:14 -05:00
|
|
|
// +build windows
|
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2015-03-31 16:37:49 -04:00
|
|
|
"errors"
|
|
|
|
"net"
|
2015-02-13 14:46:14 -05:00
|
|
|
|
2015-03-31 16:37:49 -04:00
|
|
|
"github.com/Sirupsen/logrus"
|
2015-02-13 14:46:14 -05:00
|
|
|
"github.com/docker/docker/engine"
|
|
|
|
)
|
|
|
|
|
|
|
|
// NewServer sets up the required Server and does protocol specific checking.
|
|
|
|
func NewServer(proto, addr string, job *engine.Job) (Server, error) {
|
2015-03-31 16:37:49 -04:00
|
|
|
var (
|
|
|
|
err error
|
|
|
|
l net.Listener
|
|
|
|
r = createRouter(
|
|
|
|
job.Eng,
|
|
|
|
job.GetenvBool("Logging"),
|
|
|
|
job.GetenvBool("EnableCors"),
|
|
|
|
job.Getenv("CorsHeaders"),
|
|
|
|
job.Getenv("Version"),
|
|
|
|
)
|
|
|
|
)
|
2015-02-13 14:46:14 -05:00
|
|
|
switch proto {
|
|
|
|
case "tcp":
|
2015-03-31 16:37:49 -04:00
|
|
|
if !job.GetenvBool("TlsVerify") {
|
|
|
|
logrus.Infof("/!\\ DON'T BIND ON ANY IP ADDRESS WITHOUT setting -tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING /!\\")
|
|
|
|
}
|
|
|
|
if l, err = NewTcpSocket(addr, tlsConfigFromJob(job)); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if err := allocateDaemonPort(addr); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2015-02-13 14:46:14 -05:00
|
|
|
default:
|
|
|
|
return nil, errors.New("Invalid protocol format. Windows only supports tcp.")
|
|
|
|
}
|
|
|
|
}
|
2015-02-13 18:08:42 -05:00
|
|
|
|
|
|
|
// Called through eng.Job("acceptconnections")
|
|
|
|
func AcceptConnections(job *engine.Job) engine.Status {
|
|
|
|
// close the lock so the listeners start accepting connections
|
|
|
|
if activationLock != nil {
|
|
|
|
close(activationLock)
|
|
|
|
}
|
|
|
|
return engine.StatusOK
|
|
|
|
}
|