-
Notifications
You must be signed in to change notification settings - Fork 7
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
base: master
Are you sure you want to change the base?
Conversation
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()) { |
There was a problem hiding this comment.
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..") |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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.
There was a problem hiding this 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" |
There was a problem hiding this comment.
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.
f9f001f
to
18401ec
Compare
1940be1
to
fe6017b
Compare
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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.
7ca0082
to
6d3fa42
Compare
dd3157a
to
ddf56a4
Compare
64c8f1a
to
9931db0
Compare
1f35892
to
62fe770
Compare
fb62b12
to
a6f0cc8
Compare
Depends on #1