-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed docker-machine and sshutil to support hostnames with colons i… #625
Changed docker-machine and sshutil to support hostnames with colons i… #625
Conversation
@@ -52,7 +52,7 @@ func NewSSHClient(d drivers.Driver) (*ssh.Client, error) { | |||
return nil, errors.Wrapf(err, "Error creating new native config from ssh using: %s, %s", h.Username, auth) | |||
} | |||
|
|||
client, err := ssh.Dial("tcp", fmt.Sprintf("%s:%d", h.IP, h.Port), &config) | |||
client, err := ssh.Dial("tcp", fmt.Sprintf("[%s]:%d", h.IP, h.Port), &config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're better off using net.JoinHostPort
here.
@@ -166,7 +166,7 @@ func (client *NativeClient) session(command string) (*ssh.Session, error) { | |||
return nil, fmt.Errorf("Error attempting SSH client dial: %s", err) | |||
} | |||
|
|||
conn, err := ssh.Dial("tcp", fmt.Sprintf("%s:%d", client.Hostname, client.Port), &client.Config) | |||
conn, err := ssh.Dial("tcp", fmt.Sprintf("[%s]:%d", client.Hostname, client.Port), &client.Config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use net.JoinHostPort
.
@@ -250,7 +250,7 @@ func (client *NativeClient) Shell(args ...string) error { | |||
var ( | |||
termWidth, termHeight int | |||
) | |||
conn, err := ssh.Dial("tcp", fmt.Sprintf("%s:%d", client.Hostname, client.Port), &client.Config) | |||
conn, err := ssh.Dial("tcp", fmt.Sprintf("[%s]:%d", client.Hostname, client.Port), &client.Config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use net.JoinHostPort
.
…n them, for example ipv6 addresses
1a6519b
to
378e88b
Compare
Now using |
Current coverage is 32.95% (diff: 100%)@@ master #625 diff @@
==========================================
Files 44 44
Lines 1933 1933
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 637 637
Misses 1168 1168
Partials 128 128
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you send a PR to docker machine with this change too?
PR to docker machine is here: |
…n them, for example ipv6 addresses