use SSH tunnel if user specifies bindAddress
parent
faed0ecefd
commit
012146bdbc
|
@ -85,7 +85,7 @@ var tunnelCmd = &cobra.Command{
|
||||||
cancel()
|
cancel()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if driver.NeedsPortForward(co.Config.Driver) && driver.IsKIC(co.Config.Driver) {
|
if useSSHTunnel(co.Config.Driver) {
|
||||||
port, err := oci.ForwardedPort(co.Config.Driver, cname, 22)
|
port, err := oci.ForwardedPort(co.Config.Driver, cname, 22)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exit.Error(reason.DrvPortForward, "error getting ssh port", err)
|
exit.Error(reason.DrvPortForward, "error getting ssh port", err)
|
||||||
|
@ -111,6 +111,16 @@ var tunnelCmd = &cobra.Command{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func useSSHTunnel(driverName string) bool {
|
||||||
|
if !driver.IsKIC(driverName) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if driver.NeedsPortForward(driverName) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return bindAddress != ""
|
||||||
|
}
|
||||||
|
|
||||||
func outputTunnelStarted() {
|
func outputTunnelStarted() {
|
||||||
out.Styled(style.Success, "Tunnel successfully started")
|
out.Styled(style.Success, "Tunnel successfully started")
|
||||||
out.Ln("")
|
out.Ln("")
|
||||||
|
|
Loading…
Reference in New Issue