Documentation
¶
Overview ¶
Package captcha
@author: xwc1125
Package captcha ¶
@author: xwc1125
Index ¶
- Constants
- Variables
- func Generate(store Store, captchaType string) (id, b64s string, err error)
- func GenerateDefault(captchaType string) (id, b64s string, err error)
- func Verify(store Store, id, answer string, clear bool) bool
- func VerifyDefault(id, answer string, clear bool) bool
- type Driver
- type RedisStore
- type Store
Constants ¶
View Source
const ( Unknown = "unknown" Audio = "audio" String = "string" Math = "math" Chinese = "chinese" )
Variables ¶
View Source
var ( Height = 80 Width = 240 Length = 6 Color = &color.RGBA{R: 254, G: 254, B: 254, A: 254} NoiseCount = 80 DefaultMemStore = base64Captcha.DefaultMemStore DefaultDriverAudio = base64Captcha.DefaultDriverAudio )
View Source
var (
CaptchaPrefixKey = "captcha_"
)
View Source
var ( DefaultDriver = &Driver{ DriverAudio: DefaultDriverAudio, DriverString: base64Captcha.NewDriverString(Height, Width, NoiseCount, base64Captcha.OptionShowHollowLine, Length, base64Captcha.TxtSimpleCharaters, Color, nil, nil), DriverChinese: base64Captcha.NewDriverChinese(Height, Width, NoiseCount, base64Captcha.OptionShowHollowLine, Length, base64Captcha.TxtChineseCharaters, Color, nil, nil), DriverMath: base64Captcha.NewDriverMath(Height, Width, NoiseCount, base64Captcha.OptionShowHollowLine, Color, nil, nil), DriverDigit: base64Captcha.NewDriverDigit(Height, Width, Length, 0.7, 80), } )
Functions ¶
func GenerateDefault ¶
func VerifyDefault ¶
Types ¶
type Driver ¶
type Driver struct { DriverAudio *base64Captcha.DriverAudio DriverString *base64Captcha.DriverString DriverChinese *base64Captcha.DriverChinese DriverMath *base64Captcha.DriverMath DriverDigit *base64Captcha.DriverDigit }
Driver 驱动
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
func NewRedisStore ¶
func NewRedisStore(db *redis.DB) (*RedisStore, error)
func NewRedisStoreByConfig ¶
func NewRedisStoreByConfig(config redis.RedisConfig) (*RedisStore, error)
type Store ¶
type Store base64Captcha.Store
Click to show internal directories.
Click to hide internal directories.