Skip to content

Commit

Permalink
flatten conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronhurt committed Feb 27, 2018
1 parent bd53eba commit 075c49c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions route/access_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ func (t *Target) AccessDeniedHTTP(r *http.Request) bool {
// ensure we only get the ip string
xip = strings.TrimSpace(xip)
// only continue if xip differs from host
if xip != host {
if ip = net.ParseIP(xip); ip == nil {
log.Printf("[WARN] failed to parse xff address %s", xip)
}
// check xff source and return if denied
if t.denyByIP(ip) {
return true
}
if xip == host {
continue
}
if ip = net.ParseIP(xip); ip == nil {
log.Printf("[WARN] failed to parse xff address %s", xip)
}
// check xff source and return if denied
if t.denyByIP(ip) {
return true
}
}
}
Expand Down

0 comments on commit 075c49c

Please sign in to comment.