Merge pull request #2395 from jmacelroy/master

Creating tcp socket without using go-connections.
master
Tõnis Tiigi 2021-10-08 14:00:08 -07:00 committed by GitHub
commit ba673bbdab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -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)
}