Fix some typos and run gofmt on all .go files

This commit is contained in:
Matthew Penner
2020-09-05 13:08:40 -06:00
parent b9f6e17a7d
commit 7ba32aca84
42 changed files with 89 additions and 84 deletions

View File

@@ -59,9 +59,9 @@ func (r *PanelRequest) logDebug(req *http.Request) {
}
log.WithFields(log.Fields{
"method": req.Method,
"method": req.Method,
"endpoint": req.URL.String(),
"headers": headers,
"headers": headers,
}).Debug("making request to external HTTP endpoint")
}

View File

@@ -41,13 +41,13 @@ var validUsernameRegexp = regexp.MustCompile(`^(?i)(.+)\.([a-z0-9]{8})$`)
func (r *PanelRequest) ValidateSftpCredentials(request SftpAuthRequest) (*SftpAuthResponse, error) {
// If the username doesn't meet the expected format that the Panel would even recognize just go ahead
// and bail out of the process here to avoid accidentially brute forcing the panel if a bot decides
// and bail out of the process here to avoid accidentally brute forcing the panel if a bot decides
// to connect to spam username attempts.
if !validUsernameRegexp.MatchString(request.User) {
log.WithFields(log.Fields{
"subsystem": "sftp",
"username": request.User,
"ip": request.IP,
"username": request.User,
"ip": request.IP,
}).Warn("failed to validate user credentials (invalid format)")
return nil, new(sftpInvalidCredentialsError)
@@ -84,4 +84,4 @@ func (r *PanelRequest) ValidateSftpCredentials(request SftpAuthRequest) (*SftpAu
}
return response, nil
}
}