Documentation ¶
Index ¶
- type RedisClient
- func (r *RedisClient) CheckAvailability() bool
- func (r *RedisClient) CheckBlacklist(ip string) bool
- func (r *RedisClient) IncrementIP(ip string) error
- func (r *RedisClient) IsBlocked(val string) bool
- func (r *RedisClient) LoadBlacklist() ([]string, []string, error)
- func (r *RedisClient) LoadBlockedIDs() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisClient ¶
type RedisClient struct {
// contains filtered or unexported fields
}
func New ¶
func New(ctx context.Context, url, pass, blockedIDsSet, blacklistSet, IPsMap, currentMap string) *RedisClient
func (*RedisClient) CheckAvailability ¶
func (r *RedisClient) CheckAvailability() bool
CheckAvailability checks if redis is available
func (*RedisClient) CheckBlacklist ¶
func (r *RedisClient) CheckBlacklist(ip string) bool
CheckBlacklist checks if the provided IP is in blacklist.
func (*RedisClient) IncrementIP ¶
func (r *RedisClient) IncrementIP(ip string) error
IncrementIP increments the number of requests sent from provided IP.
func (*RedisClient) IsBlocked ¶
func (r *RedisClient) IsBlocked(val string) bool
IsBlocked checks if the provided ID is blocked.
func (*RedisClient) LoadBlacklist ¶
func (r *RedisClient) LoadBlacklist() ([]string, []string, error)
LoadBlacklist loads list of blocked IP addresses from Redis.
func (*RedisClient) LoadBlockedIDs ¶
func (r *RedisClient) LoadBlockedIDs() error
LoadBlockedIDs loads list of blocked IDs from Redis with retries.
Click to show internal directories.
Click to hide internal directories.