From 6d396b96844c1c9ab0ad4a7b932a7bbdfe83f437 Mon Sep 17 00:00:00 2001 From: Jacob MacElroy Date: Tue, 5 Oct 2021 12:18:56 -0600 Subject: [PATCH] Creating tcp socket without using go-connections. Signed-off-by: Jacob MacElroy --- cmd/buildkitd/main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/buildkitd/main.go b/cmd/buildkitd/main.go index 91089a95..a0fcf729 100644 --- a/cmd/buildkitd/main.go +++ b/cmd/buildkitd/main.go @@ -23,7 +23,6 @@ import ( "github.com/containerd/containerd/sys" sddaemon "github.com/coreos/go-systemd/v22/daemon" "github.com/docker/docker/pkg/reexec" - "github.com/docker/go-connections/sockets" "github.com/gofrs/flock" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" "github.com/moby/buildkit/cache/remotecache" @@ -542,10 +541,16 @@ func getListener(addr string, uid, gid int, tlsConfig *tls.Config) (net.Listener case "fd": return listenFD(listenAddr, tlsConfig) case "tcp": + l, err := net.Listen("tcp", listenAddr) + if err != nil { + return nil, err + } + if tlsConfig == nil { 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: return nil, errors.Errorf("addr %s not supported", addr) }