Add listenport
This commit is contained in:
parent
2a460980d0
commit
6723e086e7
1 changed files with 4 additions and 3 deletions
7
sshd.go
7
sshd.go
|
@ -25,6 +25,7 @@ import (
|
|||
var (
|
||||
authorisedKeys map[string]string
|
||||
|
||||
listenport = flag.Int("listenport", 2200, "Port to listen on for incoming ssh connections")
|
||||
hostkey = flag.String("hostkey", "id_rsa", "Server host key to load")
|
||||
authorisedkeys = flag.String("authorisedkeys", "authorized_keys", "Authorised keys")
|
||||
verbose = flag.Bool("verbose", false, "Enable verbose mode")
|
||||
|
@ -58,13 +59,13 @@ func main() {
|
|||
config.AddHostKey(private)
|
||||
loadAuthorisedKeys(*authorisedkeys)
|
||||
|
||||
listener, err := net.Listen("tcp", "0.0.0.0:2200")
|
||||
listener, err := net.Listen("tcp", fmt.Sprintf("0.0.0.0:%d", *listenport))
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to listen on 2200 (%s)", err)
|
||||
log.Fatalf("Failed to listen on %s (%s)", listenport, err)
|
||||
}
|
||||
|
||||
// Accept all connections
|
||||
log.Print("Listening on 2200...")
|
||||
log.Printf("Listening on %d...", *listenport)
|
||||
for {
|
||||
tcpConn, err := listener.Accept()
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue