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

Enchanced checks #2

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

Enchanced checks #2

wants to merge 1 commit into from

Conversation

fihuer
Copy link
Member

@fihuer fihuer commented Aug 22, 2017

Depends on #1

@fihuer fihuer requested a review from arno August 22, 2017 12:59
route/route.go Outdated
client, err := ssh.Dial("tcp", hostport, ssh_config)
if err != nil {
re_auth_failure := regexp.MustCompile(`handshake failed: ssh: unable to authenticate`)
if re_auth_failure.MatchString(err.Error()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to merge the two lines i.e. regexp.MustCompile(...).MatchString(...).

chosen_item--
}
} else {
return "", errors.New("No proxied connections, unable to pick a random user..")
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing a trailing dot... 😁

@@ -165,10 +166,41 @@ func (hc *hostChecker) DoCheck(hostport string) State {
if route.CanConnect(hostport) {
state = Up
}
canary_user, err := PickUser()
Copy link
Contributor

Choose a reason for hiding this comment

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

The error is never logged.

Copy link
Contributor

@arno arno left a comment

Choose a reason for hiding this comment

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

BTW, try golint on your modifications.

"time"

"github.com/op/go-logging"

"golang.org/x/crypto/ssh"
Copy link
Contributor

Choose a reason for hiding this comment

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

Use glide to manage this new dependency.

@fihuer fihuer force-pushed the enchanced_checks branch 2 times, most recently from f9f001f to 18401ec Compare July 3, 2018 19:18
@arno arno force-pushed the enchanced_checks branch 2 times, most recently from 1940be1 to fe6017b Compare July 5, 2018 10:17
Copy link
Contributor

@arno arno left a comment

Choose a reason for hiding this comment

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

Did some little cleanup but looks good. Can you add some doc for pickUser() so I can merge?

hc.Update(hostport, state, time.Now())
return state
}

func pickUser() (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing function doc.

Instead of just checking if a port is reachable we try to connect to the
SSH server using an already connected user.
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.

2 participants