Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for timeout #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mrkschan
Copy link
Collaborator

Resolve #15

@zbindenren
Copy link

@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

@mrkschan
Copy link
Collaborator Author

mrkschan commented Mar 3, 2017

@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 :)

@zbindenren
Copy link

@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

@mrkschan
Copy link
Collaborator Author

mrkschan commented Mar 3, 2017

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?

@crosbymichael
Copy link
Owner

@mrkschan we can use vndr for vendor management, its simple and works

@mrkschan
Copy link
Collaborator Author

mrkschan commented Mar 9, 2017

@crosbymichael Not any chance for dep?

@zbindenren
Copy link

@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

@mrkschan
Copy link
Collaborator Author

mrkschan commented Mar 9, 2017

@zbindenren please use -o 'ConnectTimeout 1' instead of -o 'Timeout 1'.

@mrkschan
Copy link
Collaborator Author

Option format handling is WIP in #18.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants