Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CaptchaHolder ¶
type CaptchaHolder struct { DefaultHeight int // 默认高度 40 DefaultWidth int // 默认宽度 80 DefaultLength int // 默认长度,位数 6 DefaultMaxSkew float64 // 默认倾斜因子 0.7 DefaultDotRate float64 // 默认干扰点比率 25% DriverAudio *base64Captcha.DriverAudio DriverString *base64Captcha.DriverString DriverChinese *base64Captcha.DriverChinese DriverMath *base64Captcha.DriverMath DriverDigit *base64Captcha.DriverDigit // contains filtered or unexported fields }
验证码仓库
func NewCaptchaHolder ¶
func NewCaptchaHolder(options ...Option) *CaptchaHolder
func (*CaptchaHolder) GetCodeCaptcha ¶
func (rs *CaptchaHolder) GetCodeCaptcha(key string) (code string, err error)
生成随机验证码
func (*CaptchaHolder) GetImageCaptcha ¶
func (*CaptchaHolder) VerifyCaptcha ¶
func (rs *CaptchaHolder) VerifyCaptcha(id string, answer string) bool
验证验证码
type Option ¶
type Option func(*CaptchaHolder)
func WithRedisStore ¶
func WithRedisStore(rdb *redis.Client) Option
type RedisStore ¶
type RedisStore struct { Redis *redis.Client // 缓存 15分钟 Expiration time.Duration // 过期时间 PrefixKey string // 前缀 Context context.Context }
验证码存储
func NewRedisStore ¶
func NewRedisStore(rd *redis.Client) *RedisStore
Click to show internal directories.
Click to hide internal directories.