Creating tcp socket without using go-connections.

Signed-off-by: Jacob MacElroy <jacob@okteto.com>
master
Jacob MacElroy 2021-10-05 12:18:56 -06:00
parent 78e88560e1
commit 6d396b9684
1 changed files with 7 additions and 2 deletions

View File

@ -23,7 +23,6 @@ import (
"github.com/containerd/containerd/sys" "github.com/containerd/containerd/sys"
sddaemon "github.com/coreos/go-systemd/v22/daemon" sddaemon "github.com/coreos/go-systemd/v22/daemon"
"github.com/docker/docker/pkg/reexec" "github.com/docker/docker/pkg/reexec"
"github.com/docker/go-connections/sockets"
"github.com/gofrs/flock" "github.com/gofrs/flock"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
"github.com/moby/buildkit/cache/remotecache" "github.com/moby/buildkit/cache/remotecache"
@ -542,10 +541,16 @@ func getListener(addr string, uid, gid int, tlsConfig *tls.Config) (net.Listener
case "fd": case "fd":
return listenFD(listenAddr, tlsConfig) return listenFD(listenAddr, tlsConfig)
case "tcp": case "tcp":
l, err := net.Listen("tcp", listenAddr)
if err != nil {
return nil, err
}
if tlsConfig == nil { if tlsConfig == nil {
logrus.Warnf("TLS is not enabled for %s. enabling mutual TLS authentication is highly recommended", addr) logrus.Warnf("TLS is not enabled for %s. enabling mutual TLS authentication is highly recommended", addr)
return l, nil
} }
return sockets.NewTCPSocket(listenAddr, tlsConfig) return tls.NewListener(l, tlsConfig), nil
default: default:
return nil, errors.Errorf("addr %s not supported", addr) return nil, errors.Errorf("addr %s not supported", addr)
} }