@@ -22,6 +22,19 @@ type ConnectionHelper struct {
2222//
2323// ssh://<user>@<host> URL requires Docker 18.09 or later on the remote host.
2424func GetConnectionHelper (daemonURL string ) (* ConnectionHelper , error ) {
25+ return getConnectionHelper (daemonURL , nil )
26+ }
27+
28+ // GetConnectionHelperWithSSHOpts returns Docker-specific connection helper for
29+ // the given URL, and accepts additional options for ssh connections. It returns
30+ // nil without error when no helper is registered for the scheme.
31+ //
32+ // Requires Docker 18.09 or later on the remote host.
33+ func GetConnectionHelperWithSSHOpts (daemonURL string , sshFlags []string ) (* ConnectionHelper , error ) {
34+ return getConnectionHelper (daemonURL , sshFlags )
35+ }
36+
37+ func getConnectionHelper (daemonURL string , sshFlags []string ) (* ConnectionHelper , error ) {
2538 u , err := url .Parse (daemonURL )
2639 if err != nil {
2740 return nil , err
@@ -34,7 +47,7 @@ func GetConnectionHelper(daemonURL string) (*ConnectionHelper, error) {
3447 }
3548 return & ConnectionHelper {
3649 Dialer : func (ctx context.Context , network , addr string ) (net.Conn , error ) {
37- return commandconn .New (ctx , "ssh" , sp .Args ("docker" , "system" , "dial-stdio" )... )
50+ return commandconn .New (ctx , "ssh" , append ( sshFlags , sp .Args ("docker" , "system" , "dial-stdio" ) ... )... )
3851 },
3952 Host : "http://docker" ,
4053 }, nil
0 commit comments