Version 1.3.0
In case the password must provided interactively, it is now invisible.
This commit is contained in:
parent
a16b99af6e
commit
c85e21231b
13
Main.go
13
Main.go
@ -3,14 +3,17 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/SommerEngineering/SSHTunnel/Tunnel"
|
"github.com/SommerEngineering/SSHTunnel/Tunnel"
|
||||||
|
"github.com/howeyc/gopass"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
// Show the current version:
|
// Show the current version:
|
||||||
fmt.Println(`SSHTunnel v1.2.0`)
|
log.Println(`SSHTunnel v1.3.0`)
|
||||||
|
|
||||||
// Allow Go to use all CPUs:
|
// Allow Go to use all CPUs:
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
@ -23,7 +26,13 @@ func main() {
|
|||||||
if password == `` {
|
if password == `` {
|
||||||
// Promt for the password:
|
// Promt for the password:
|
||||||
fmt.Println(`Please provide the password for the connection:`)
|
fmt.Println(`Please provide the password for the connection:`)
|
||||||
fmt.Scanln(&password)
|
if pass, errPass := gopass.GetPasswd(); errPass != nil {
|
||||||
|
log.Println(`There was an error reading the password securely: ` + errPass.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
password = string(pass)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user