SSHTunnel/Main.go
Thorsten Sommer 6ae3b46fc1 Retry, Refactoring & Doc
+ Refactoring of some functions
+ Added the retrying of all three connections
+ Added the documentation to the code
+ Improved the error messages
2015-01-02 18:01:52 +01:00

32 lines
658 B
Go

package main
import (
"golang.org/x/crypto/ssh"
"runtime"
)
func main() {
// Allow Go to use all CPUs:
runtime.GOMAXPROCS(runtime.NumCPU())
// Read the configuration from the command-line args:
readFlags()
// Create the SSH configuration:
config := &ssh.ClientConfig{
User: username,
Auth: []ssh.AuthMethod{
ssh.Password(password),
ssh.PasswordCallback(passwordCallback),
ssh.KeyboardInteractive(keyboardInteractiveChallenge),
},
}
// Create the local end-point:
localListener := createLocalEndPoint()
// Accept client connections (will block forever):
acceptClients(localListener, config)
}