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 timeout parameter #92

Merged
merged 3 commits into from
Oct 1, 2019

Conversation

ricardoseriani
Copy link
Contributor

Close #12

Signed-off-by: Ricardo Seriani ricardo.seriani@gmail.com

Signed-off-by: Ricardo Seriani <ricardo.seriani@gmail.com>
@ricardoseriani
Copy link
Contributor Author

This PR should close #12

Please, check if it's working as it should.
Also, I don't know if the help text in this option is what you expected. If you don't like, just tell me which message should I use for the help of this option.

Copy link
Owner

@davrodpin davrodpin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to the project, @ricardoseriani. And thank you for your contribution.

It would be nice if the timeout value is persisted in the alias files when the user asks to create one:

$  mole -alias example1 -timeout 10s -v -local :8443 -remote :443 -server mole@example.com
$ cat ~/.mole.conf
[tunnels]
  [tunnels.example1]
    local = [":8443"]
    remote = [":443"]
    server = "mole@example.com"
    key = ""
    verbose = true
    help = false
    version = false
    detach = false
    timeout = 10s

cli/cli.go Outdated Show resolved Hide resolved
Signed-off-by: Ricardo Seriani <ricardo.seriani@gmail.com>
Copy link
Owner

@davrodpin davrodpin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind adding timeout to the debug log that shows all CLI-related values? It's implemented on the String() method of the type App on cli/cli.go. Thanks!

@ricardoseriani
Copy link
Contributor Author

ricardoseriani commented Oct 1, 2019

Do you mind adding timeout to the debug log that shows all CLI-related values? It's implemented on the String() method of the type App on cli/cli.go. Thanks!

No problem.
I already while I'm adding the support to export/import the timeout to the .toml file.
The problem is that when using the time.Duration the toml will generate as integer (in fact, it will be in nanosecond format, like the keep-alive-internal field) for that field:

using: mole -alias example1 -timeout 10s -v -local :8443 -remote :443 -server mole@example.com the mole.conf file will be:

[tunnels]
  [tunnels.example1]
    local = [":8443"]
    remote = [":443"]
    server = "mole@example.com"
    key = ""
    verbose = true
    help = false
    version = false
    detach = false
    insecure = false
    keep-alive-interval = 10000000000
    timeout = 10000000000

@davrodpin
Copy link
Owner

I already while I'm adding the support to export/import the timeout to the .toml file.

Cool, thank you!

The problem is that when using the time.Duration the toml will generate as integer (in fact, it will be in nanosecond format, like the keep-alive-internal field) for that field:

I see not problem on having the time expressed in nanoseconds so the decision to keep it or find a way to have the exact input will be up to you to decide :)

@ricardoseriani
Copy link
Contributor Author

I see not problem on having the time expressed in nanoseconds so the decision to keep it or find a way to have the exact input will be up to you to decide :)

Ok, thanks

Do you mind adding timeout to the debug log that shows all CLI-related values? It's implemented on the String() method of the type App on cli/cli.go. Thanks!

About this, should I add the same timeout on the String() method of the type Alias on storage/storage.go ?

@davrodpin
Copy link
Owner

About this, should I add the same timeout on the String() method of the type Alias on storage/storage.go ?

Yes, please! That helps on debugging issues.

Signed-off-by: Ricardo Seriani <ricardo.seriani@gmail.com>
@davrodpin davrodpin merged commit 9e2e4e4 into davrodpin:master Oct 1, 2019
@davrodpin
Copy link
Owner

Thank you for your contribution, @ricardoseriani!

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.

New feature: Make timeout connection to ssh server configurable
2 participants