Apply gometalinter suggestions

This commit is contained in:
Manuel de Brito Fontes 2018-04-25 18:53:49 -03:00
parent 9533aa45cc
commit 9bf553559c
8 changed files with 19 additions and 32 deletions

View file

@ -37,7 +37,6 @@ var (
annotationPassthrough = parser.GetAnnotationWithPrefix("ssl-passthrough")
annotationAffinityType = parser.GetAnnotationWithPrefix("affinity")
annotationCorsEnabled = parser.GetAnnotationWithPrefix("enable-cors")
annotationCorsAllowOrigin = parser.GetAnnotationWithPrefix("cors-allow-origin")
annotationCorsAllowMethods = parser.GetAnnotationWithPrefix("cors-allow-methods")
annotationCorsAllowHeaders = parser.GetAnnotationWithPrefix("cors-allow-headers")
annotationCorsAllowCredentials = parser.GetAnnotationWithPrefix("cors-allow-credentials")

View file

@ -121,17 +121,17 @@ func (a authReq) Parse(ing *extensions.Ingress) (interface{}, error) {
return nil, ing_errors.NewLocationDenied("an empty string is not a valid URL")
}
authUrl, err := url.Parse(urlString)
authURL, err := url.Parse(urlString)
if err != nil {
return nil, err
}
if authUrl.Scheme == "" {
if authURL.Scheme == "" {
return nil, ing_errors.NewLocationDenied("url scheme is empty")
}
if authUrl.Host == "" {
if authURL.Host == "" {
return nil, ing_errors.NewLocationDenied("url host is empty")
}
if strings.Contains(authUrl.Host, "..") {
if strings.Contains(authURL.Host, "..") {
return nil, ing_errors.NewLocationDenied("invalid url host")
}
@ -162,7 +162,7 @@ func (a authReq) Parse(ing *extensions.Ingress) (interface{}, error) {
return &Config{
URL: urlString,
Host: authUrl.Hostname(),
Host: authURL.Hostname(),
SigninURL: signIn,
Method: authMethod,
ResponseHeaders: responseHeaders,

View file

@ -33,8 +33,8 @@ var luaRestyWAFModes = map[string]bool{"ACTIVE": true, "INACTIVE": true, "SIMULA
type Config struct {
Mode string `json:"mode"`
Debug bool `json:"debug"`
IgnoredRuleSets []string `json: "ignored-rulesets"`
ExtraRulesetString string `json: "extra-ruleset-string"`
IgnoredRuleSets []string `json:"ignored-rulesets"`
ExtraRulesetString string `json:"extra-ruleset-string"`
}
// Equal tests for equality between two Config types