diff --git a/Forward.go b/Forward.go index a154dc2..ce0c4ac 100644 --- a/Forward.go +++ b/Forward.go @@ -17,7 +17,7 @@ func forward(localConn net.Conn, config *ssh.ClientConfig) { // Loop for retries: for { - // Try to connect to the SSD server: + // Try to connect to the SSH server: if sshClientConn, err := ssh.Dial(`tcp`, serverAddrString, config); err != nil { // Failed: diff --git a/Main.go b/Main.go index ee702f1..a4c43f5 100644 --- a/Main.go +++ b/Main.go @@ -1,18 +1,33 @@ package main import ( + "fmt" "golang.org/x/crypto/ssh" "runtime" ) func main() { + // Show the current version: + fmt.Println(`SSHTunnel v1.1.0`) + // Allow Go to use all CPUs: runtime.GOMAXPROCS(runtime.NumCPU()) // Read the configuration from the command-line args: readFlags() + // Check if the password was provided: + for true { + if password == `` { + // Promt for the password: + fmt.Println(`Please provide the password for the connection:`) + fmt.Scanln(&password) + } else { + break + } + } + // Create the SSH configuration: config := &ssh.ClientConfig{ User: username, diff --git a/ReadFlags.go b/ReadFlags.go index 453527d..50f670d 100644 --- a/ReadFlags.go +++ b/ReadFlags.go @@ -8,7 +8,7 @@ func readFlags() { flag.StringVar(&serverAddrString, `server`, `127.0.0.1:22`, `The (remote) SSH server, e.g. 'my.host.com', 'my.host.com:22', '127.0.0.1:22', 'localhost:22'.`) flag.StringVar(&localAddrString, `local`, `127.0.0.1:50000`, `The local end-point of the tunnel, e.g. '127.0.0.1:50000', 'localhost:50000'.`) flag.StringVar(&remoteAddrString, `remote`, `127.0.0.1:27017`, `The remote side end-point (e.g. on the machine with the SSH server), e.g. a MongoDB (port 27017) '127.0.0.1:27017', a web server '127.0.0.1:80'`) - flag.StringVar(&username, `user`, `username`, `The user's name for the SSD server.`) - flag.StringVar(&password, `pwd`, `password`, `The user's password for the SSD server.`) + flag.StringVar(&username, `user`, `username`, `The user's name for the SSH server.`) + flag.StringVar(&password, `pwd`, ``, `The user's password for the SSH server.`) flag.Parse() }