Open mrkschan opened 7 years ago
@mrkschan it is not working:
[rz:~/golang/src/github.com/crosbymichael/slex]↥ master ± git fetch origin pull/16/head:add-support-for-timeout
[rz:~/golang/src/github.com/crosbymichael/slex]↥ master ± git checkout add-support-for-timeout
Switched to branch 'add-support-for-timeout'
[rz:~/golang/src/github.com/crosbymichael/slex]↥ add-support-for-timeout ± go build
# github.com/crosbymichael/slex
./ssh.go:83: unknown ssh.ClientConfig field 'Timeout' in struct literal
@zbindenren ClientConfig
should have a Timeout
https://godoc.org/golang.org/x/crypto/ssh#ClientConfig.
Please cd golang.org/x/crypto && git pull
, then build again.
We probably need to adopt a proper dependency management tool :)
@mrkschan compiling works now, but now I get a panic:
./slex -o ConnectTimeout=1 --user zbindenren -A --host trepd101 ls
panic: runtime error: index out of range
goroutine 1 [running]:
panic(0x6597a0, 0xc420014150)
/usr/lib/go/src/runtime/panic.go:500 +0x1a1
main.getOptions(0xc420098000, 0xa)
/home/rz/golang/src/github.com/crosbymichael/slex/main.go:55 +0x150
main.multiplexAction(0xc420098000, 0x0, 0x0)
/home/rz/golang/src/github.com/crosbymichael/slex/main.go:100 +0x3d7
github.com/codegangsta/cli.HandleAction(0x64e160, 0x6bb408, 0xc420098000, 0x0, 0x0)
/home/rz/golang/src/github.com/codegangsta/cli/app.go:485 +0xd4
github.com/codegangsta/cli.(*App).Run(0xc42007c820, 0xc42000c240, 0x9, 0x9, 0x0, 0x0)
/home/rz/golang/src/github.com/codegangsta/cli/app.go:259 +0x74f
main.main()
/home/rz/golang/src/github.com/crosbymichael/slex/main.go:256 +0x83d
Oh, I have a wrong assumption that the option is separated by whitespace ' '.
But this is not the case according to man ssh_config
:(
The configuration file has the following format:
Empty lines and lines starting with ‘#’ are comments. Otherwise a line is of the format
“keyword arguments”. Configuration options may be separated by whitespace or optional
whitespace and exactly one ‘=’; the latter format is useful to avoid the need to quote
whitespace when specifying configuration options using the ssh, scp, and sftp -o option.
Arguments may optionally be enclosed in double quotes (") in order to represent arguments
containing spaces.
Will need to fix the SSH option parsing logic. @zbindenren could you test with -o 'ConnectTimeout 1'
instead?
@mrkschan we can use vndr for vendor management, its simple and works
@mrkschan unfortunately it is not working:
$ time ./slex -o 'Timeout 1' --user zbindenren -A --host <thehost> ls
ERRO[0021] none of the provided authentication methods can establish SSH session successfully host=<thehost>:22
./slex -o 'Timeout 1' --user zbindenren -A --host <thehost> ls 0.00s user 0.02s system 0% cpu 21.029 total
@zbindenren please use -o 'ConnectTimeout 1'
instead of -o 'Timeout 1'
.
Option format handling is WIP in https://github.com/crosbymichael/slex/pull/18.
Resolve #15