mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-07-21 19:48:59 +02:00
fix lint
This commit is contained in:
+5
-5
@@ -256,12 +256,12 @@ func contains(source []string, target string) bool {
|
|||||||
// 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)
|
banned, isCached := cache.Get(clientIP)
|
||||||
banned, err := isBanned.(string)
|
bannedString, isValid := banned.(string)
|
||||||
if ok && err == nil && len(banned) > 0 {
|
if isCached && !isValid && len(bannedString) > 0 {
|
||||||
return isBanned == cacheNoBannedValue, nil
|
return bannedString == cacheNoBannedValue, nil
|
||||||
}
|
}
|
||||||
return false, fmt.Errorf("no data")
|
return false, fmt.Errorf("no cache data")
|
||||||
}
|
}
|
||||||
|
|
||||||
func setDecision(clientIP string, isBanned bool, duration int64) {
|
func setDecision(clientIP string, isBanned bool, duration int64) {
|
||||||
|
|||||||
Reference in New Issue
Block a user