1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/docker/listeners/listeners.go
David Calavera 34c29277c2 Move listeners and port allocation outside the server.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-11 14:42:49 -05:00

22 lines
582 B
Go

package listeners
import (
"crypto/tls"
"net"
"github.com/Sirupsen/logrus"
"github.com/docker/go-connections/sockets"
)
func initTCPSocket(addr string, tlsConfig *tls.Config) (l net.Listener, err error) {
if tlsConfig == nil || tlsConfig.ClientAuth != tls.RequireAndVerifyClientCert {
logrus.Warn("/!\\ DON'T BIND ON ANY IP ADDRESS WITHOUT setting -tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING /!\\")
}
if l, err = sockets.NewTCPSocket(addr, tlsConfig); err != nil {
return nil, err
}
if err := allocateDaemonPort(addr); err != nil {
return nil, err
}
return
}