Documentation
¶
Index ¶
Constants ¶
View Source
const ( Whitelist = "whitelist" Blacklist = "blacklist" )
Variables ¶
View Source
var BlacklistFunc = func(ip string) bool { appLogger.Debug("Entering BlacklistFunc") if !isValidCIDR(ip) { appLogger.Warnf("Invalid IP format: %s", ip) return false } inBlacklist, err := db.CheckInRedis(Blacklist, ip) if err != nil { appLogger.Warnf("Error checking blacklist for %s: %v", ip, err) return false } appLogger.Debugf("IP %s blacklisted: %v", ip, inBlacklist) return inBlacklist }
View Source
var ManageListFunc = func(subnet string, listType string, add bool) bool { if !isValidCIDR(subnet) { appLogger.Warnf("Invalid subnet format: %s", subnet) return false } return db.UpdateRedis(listType, subnet, add) }
View Source
var ResetBucketFunc = func(login, ip string) bool { if !isValidCIDR(ip) { appLogger.Warnf("Invalid IP format: %s", ip) return false } limiter.Delete(login) limiter.Delete(ip) return true }
View Source
var WhitelistFunc = func(ip string) bool { appLogger.Debug("Entering WhitelistFunc") if !isValidCIDR(ip) { appLogger.Warnf("Invalid IP format: %s", ip) return false } inWhitelist, err := db.CheckInRedis(Whitelist, ip) if err != nil { appLogger.Warnf("Error checking whitelist for %s: %v", ip, err) return false } appLogger.Debugf("IP %s whitelisted: %v", ip, inWhitelist) return inWhitelist }
Functions ¶
func CheckAuthorization ¶
func InitLogger ¶
func InitRateLimiter ¶
func InitRateLimiter(config config.RateLimiterConfig)
func ResetBucket ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.