SSHTunnel/Main.go

32 lines
658 B
Go
Raw Normal View History

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