mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-07-21 11:38:59 +02:00
fix lint
This commit is contained in:
+4
-4
@@ -242,7 +242,7 @@ func (a *Bouncer) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
|||||||
// CUSTOM CODE
|
// CUSTOM CODE
|
||||||
// TODO place in another file
|
// TODO place in another file
|
||||||
|
|
||||||
// Decision: Body returned from Crowdsec LAPI
|
// Decision: Body returned from Crowdsec LAPI.
|
||||||
type Decision struct {
|
type Decision struct {
|
||||||
Id int `json:"id"`
|
Id int `json:"id"`
|
||||||
Origin string `json:"origin"`
|
Origin string `json:"origin"`
|
||||||
@@ -254,7 +254,7 @@ type Decision struct {
|
|||||||
Simulated bool `json:"simulated"`
|
Simulated bool `json:"simulated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stream: Body returned from Crowdsec Stream LAPI
|
// Stream: Body returned from Crowdsec Stream LAPI.
|
||||||
type Stream struct {
|
type Stream struct {
|
||||||
Deleted []Decision `json:"deleted"`
|
Deleted []Decision `json:"deleted"`
|
||||||
New []Decision `json:"new"`
|
New []Decision `json:"new"`
|
||||||
@@ -269,8 +269,8 @@ func contains(source []string, target string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Decision check in the cache if the IP has the banned / not banned value
|
// Get Decision check in the cache if the IP has the banned / not banned value.
|
||||||
// Otherwise return with an error to add the IP in cache if we are on
|
// Otherwise return with an error to add the IP in cache if we are on.
|
||||||
func getDecision(clientIP string) (bool, error) {
|
func getDecision(clientIP string) (bool, error) {
|
||||||
isBanned, ok := cache.Get(clientIP)
|
isBanned, ok := cache.Get(clientIP)
|
||||||
if ok && len(isBanned.(string)) > 0 {
|
if ok && len(isBanned.(string)) > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user