mirror of https://github.com/docker/cli.git
Revert "connhelper: add ssh multiplexing"
This reverts commit c04dd6e244
.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
29734b9103
commit
2a08462deb
|
@ -5,10 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/docker/cli/cli/config"
|
|
||||||
"github.com/docker/cli/cli/connhelper/commandconn"
|
"github.com/docker/cli/cli/connhelper/commandconn"
|
||||||
"github.com/docker/cli/cli/connhelper/ssh"
|
"github.com/docker/cli/cli/connhelper/ssh"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -37,7 +34,7 @@ func GetConnectionHelper(daemonURL string) (*ConnectionHelper, error) {
|
||||||
}
|
}
|
||||||
return &ConnectionHelper{
|
return &ConnectionHelper{
|
||||||
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||||
return commandconn.New(ctx, "ssh", append(multiplexingArgs(), append(sp.Args(), []string{"--", "docker", "system", "dial-stdio"}...)...)...)
|
return commandconn.New(ctx, "ssh", append(sp.Args(), []string{"--", "docker", "system", "dial-stdio"}...)...)
|
||||||
},
|
},
|
||||||
Host: "http://docker",
|
Host: "http://docker",
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -56,19 +53,3 @@ func GetCommandConnectionHelper(cmd string, flags ...string) (*ConnectionHelper,
|
||||||
Host: "http://docker",
|
Host: "http://docker",
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func multiplexingArgs() []string {
|
|
||||||
if v := os.Getenv("DOCKER_SSH_NO_MUX"); v != "" {
|
|
||||||
if b, err := strconv.ParseBool(v); err == nil && b {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err := os.MkdirAll(config.Dir(), 0700); err != nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
args := []string{"-o", "ControlMaster=auto", "-o", "ControlPath=" + config.Dir() + "/%r@%h:%p"}
|
|
||||||
if v := os.Getenv("DOCKER_SSH_MUX_PERSIST"); v != "" {
|
|
||||||
args = append(args, "-o", "ControlPersist="+v)
|
|
||||||
}
|
|
||||||
return args
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue