Versions in this module Expand all Collapse all v1 v1.0.0 Jun 11, 2023 Changes in this version + const DEFAULT_FONT_SIZE + const DEFAULT_GC_DIVISOR + const DEFAULT_GC_PROBABILITY + const DEFAULT_HEIGHT + const DEFAULT_LIFE_TIME + const DEFAULT_WIDTH + const IMAGE_FILTER_NOISE_LINE + const IMAGE_FILTER_NOISE_POINT + const IMAGE_FILTER_STRIKE + const MC_KEY_PREFIX + const STORE_ENGINE_BUILDIN + const STORE_ENGINE_MEMCACHE + func RegisterImageFilter(id string, f func(FilterConfigGroup) ImageFilter) bool + func RegisterStore(name string, f func(*StoreConfig) (StoreInterface, error)) bool + type CImage struct + func CreateCImage(config *ImageConfig) *CImage + type CStore struct + func CreateCStore(expiresTime time.Duration, gcProbability int, gcDivisor int) *CStore + func (store *CStore) Add(captcha *CaptchaInfo) string + func (store *CStore) Del(key string) + func (store *CStore) Destroy() + func (store *CStore) Dump(file string) error + func (store *CStore) Get(key string) *CaptchaInfo + func (store *CStore) LoadDumped(file string) error + func (store *CStore) OnConstruct() + func (store *CStore) OnDestruct() + func (store *CStore) Update(key string, captcha *CaptchaInfo) bool + type Captcha struct + func CreateCaptcha(wordManager *WordManager, captchaConfig *CaptchaConfig, ...) (*Captcha, error) + func CreateCaptchaFromConfigFile(configFile string) (*Captcha, error) + func (captcha *Captcha) CreateImage(text string) *CImage + func (captcha *Captcha) GetImage(key string) (image.Image, error) + func (captcha *Captcha) GetKey(length int) (string, error) + func (captcha *Captcha) Verify(key, textToVerify string) (bool, string) + type CaptchaConfig struct + CaseSensitive bool + ChangeTextOnRefresh bool + LifeTime time.Duration + type CaptchaInfo struct + CreateTime time.Time + ShownTimes int + Text string + type CaptchaRedisStore struct + func (this *CaptchaRedisStore) Add(captcha *CaptchaInfo) string + func (this *CaptchaRedisStore) Del(key string) + func (this *CaptchaRedisStore) Destroy() + func (this *CaptchaRedisStore) Get(key string) *CaptchaInfo + func (this *CaptchaRedisStore) OnConstruct() + func (this *CaptchaRedisStore) OnDestruct() + func (this *CaptchaRedisStore) Update(key string, captcha *CaptchaInfo) bool + type FilterConfig struct + Filters []string + func (this *FilterConfig) GetGroup(key string) (FilterConfigGroup, bool) + func (this *FilterConfig) Init() + func (this *FilterConfig) SetGroup(key string, group *FilterConfigGroup) + type FilterConfigGroup struct + func (this *FilterConfigGroup) GetItem(key string) (string, bool) + func (this *FilterConfigGroup) Init() + func (this *FilterConfigGroup) SetItem(key string, val string) + type FontManager struct + func CreateFontManager() *FontManager + func (fm *FontManager) AddFont(pathToFontFile string) error + func (fm *FontManager) GetFont(pathToFontFile string) *truetype.Font + func (fm *FontManager) GetRandomFont() *truetype.Font + type ImageConfig struct + FontFiles []string + FontSize float64 + Height int + Width int + type ImageFilter interface + GetConfig func() FilterConfigGroup + GetId func() string + Proc func(cimage *CImage) + SetConfig func(FilterConfigGroup) + type ImageFilterBase struct + func (filter *ImageFilterBase) GetConfig() FilterConfigGroup + func (filter *ImageFilterBase) GetId() string + func (filter *ImageFilterBase) Proc(cimage *CImage) + func (filter *ImageFilterBase) SetConfig(config FilterConfigGroup) + type ImageFilterManager struct + func CreateImageFilterManager() *ImageFilterManager + func CreateImageFilterManagerByConfig(config *FilterConfig) *ImageFilterManager + func (manager *ImageFilterManager) AddFilter(filter ImageFilter) + func (manager *ImageFilterManager) GetFilters() []ImageFilter + type ImageFilterNoiseLine struct + func (filter *ImageFilterNoiseLine) GetId() string + func (filter *ImageFilterNoiseLine) Proc(cimage *CImage) + type ImageFilterNoisePoint struct + func (filter *ImageFilterNoisePoint) GetId() string + func (filter *ImageFilterNoisePoint) Proc(cimage *CImage) + type ImageFilterStrike struct + func (filter *ImageFilterStrike) GetId() string + func (filter *ImageFilterStrike) Proc(cimage *CImage) + type MCStore struct + func CreateMCStore(expiresTime time.Duration, servers []string) *MCStore + func (store *MCStore) Add(captcha *CaptchaInfo) string + func (store *MCStore) Del(key string) + func (store *MCStore) Destroy() + func (store *MCStore) Get(key string) *CaptchaInfo + func (store *MCStore) OnConstruct() + func (store *MCStore) OnDestruct() + func (store *MCStore) Update(key string, captcha *CaptchaInfo) bool + type StoreConfig struct + Engine string + GcDivisor int + GcProbability int + Servers []string + type StoreInterface interface + Add func(captcha *CaptchaInfo) string + Del func(key string) + Destroy func() + Get func(key string) *CaptchaInfo + OnConstruct func() + OnDestruct func() + Update func(key string, captcha *CaptchaInfo) bool + func CreateCaptchaRedisStore(config *StoreConfig) (StoreInterface, error) + type WordManager struct + func CreateWordManagerFromDataFile(filename string) (*WordManager, error) + func (mgr *WordManager) Get(length int) (string, error) + func (mgr *WordManager) SetWords(words []string)