Documentation ¶
Index ¶
- Variables
- func RedisAddr(addr string) func(*redis.Options)
- func RedisDB(db int) func(*redis.Options)
- func RedisDialTimeout(timeout time.Duration) func(*redis.Options)
- func RedisIdleCheckFrequency(timeout time.Duration) func(*redis.Options)
- func RedisIdleTimeout(timeout time.Duration) func(*redis.Options)
- func RedisMaxRetries(maxRetries int) func(*redis.Options)
- func RedisNetwork(network string) func(*redis.Options)
- func RedisPassword(password string) func(*redis.Options)
- func RedisPoolSize(poolSize int) func(*redis.Options)
- func RedisPoolTimeout(timeout time.Duration) func(*redis.Options)
- func RedisReadOnly(readOnly bool) func(*redis.Options)
- func RedisReadTimeout(timeout time.Duration) func(*redis.Options)
- func RedisTLSConfig(config *tls.Config) func(*redis.Options)
- func RedisWriteTimeout(timeout time.Duration) func(*redis.Options)
- type Options
- type RateLimiterConfig
- type RedisClient
Constants ¶
This section is empty.
Variables ¶
View Source
var LocalIPs = []string{`127.0.0.1`, `::1`}
Functions ¶
func RedisDialTimeout ¶
func RedisIdleCheckFrequency ¶
func RedisIdleTimeout ¶
func RedisMaxRetries ¶
func RedisMaxRetries(maxRetries int) func(*redis.Options)
func RedisNetwork ¶
func RedisNetwork(network string) func(*redis.Options)
func RedisPassword ¶
func RedisPassword(password string) func(*redis.Options)
func RedisPoolSize ¶
func RedisPoolSize(poolSize int) func(*redis.Options)
func RedisPoolTimeout ¶
func RedisReadOnly ¶
func RedisReadOnly(readOnly bool) func(*redis.Options)
func RedisReadTimeout ¶
func RedisTLSConfig ¶
func RedisWriteTimeout ¶
Types ¶
type Options ¶
type Options struct { On bool //是否启用 PassToken string //通行口令 BlockByDefault bool //默认封锁 AllowedIPs []string //白名单IP BlockedIPs []string //黑名单IP AllowedCountries []string //白名单国家 BlockedCountries []string //黑名单国家 TrustProxy bool // 是否检查代理IP }
func NewOptions ¶
func NewOptions() *Options
type RateLimiterConfig ¶
type RateLimiterConfig struct { On bool // The max count in duration for no policy, default is 100. Max int // Count duration for no policy, default is 1 Minute (60s). Duration int64 //seconds //key prefix, default is "LIMIT:". Prefix string //If request gets a internal limiter error, just skip the limiter and let it go to next middleware SkipInternalError bool RedisAddr string RedisPassword string RedisDB int DBAccountID uint }
func NewRateLimiterConfig ¶
func NewRateLimiterConfig() *RateLimiterConfig
func (*RateLimiterConfig) Apply ¶
func (o *RateLimiterConfig) Apply(opts *ratelimiter.RateLimiterConfig) *RateLimiterConfig
func (*RateLimiterConfig) FromStore ¶
func (o *RateLimiterConfig) FromStore(r echo.H) *RateLimiterConfig
type RedisClient ¶
type RedisClient struct {
*redis.Client
}
RedisClient Implements RedisClient for redis.Client
func NewRedisClient ¶
func NewRedisClient(settings ...func(*redis.Options)) *RedisClient
func (*RedisClient) DeleteKey ¶
func (c *RedisClient) DeleteKey(key string) error
func (*RedisClient) EvalulateSha ¶
func (c *RedisClient) EvalulateSha(sha1 string, keys []string, args ...interface{}) (interface{}, error)
func (*RedisClient) LuaScriptLoad ¶
func (c *RedisClient) LuaScriptLoad(script string) (string, error)
Click to show internal directories.
Click to hide internal directories.