redis

package
v0.0.0-...-4009bfd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL