1 Star 0 Fork 12

Doer / gocaptcha

forked from hanguofeng / gocaptcha 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
configtypes.go 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
hanguofeng 提交于 2014-01-27 18:37 . fix not used bug
// Copyright 2013 hanguofeng. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package gocaptcha
import (
"time"
)
//CaptchaConfig ,the captcha config
type CaptchaConfig struct {
LifeTime time.Duration
}
//FilterConfigGroup
type FilterConfigGroup struct {
data map[string]string
}
func (this *FilterConfigGroup) Init() {
this.data = map[string]string{}
}
func (this *FilterConfigGroup) GetItem(key string) (string, bool) {
val, ok := this.data[key]
return val, ok
}
func (this *FilterConfigGroup) SetItem(key string, val string) {
this.data[key] = val
}
type FilterConfig struct {
Filters []string
data map[string]*FilterConfigGroup
}
func (this *FilterConfig) Init() {
this.Filters = []string{}
this.data = map[string]*FilterConfigGroup{}
}
func (this *FilterConfig) GetGroup(key string) (FilterConfigGroup, bool) {
val, ok := this.data[key]
if !ok {
val = new(FilterConfigGroup)
}
return *val, ok
}
func (this *FilterConfig) SetGroup(key string, group *FilterConfigGroup) {
this.data[key] = group
}
//ImageConfig ,the image config
type ImageConfig struct {
Width int
Height int
FontSize float64
FontFiles []string
fontManager *FontManager
}
const STORE_ENGINE_BUILDIN = "buildin"
const STORE_ENGINE_MEMCACHE = "memcache"
//StoreConfig ,the store engine config
type StoreConfig struct {
CaptchaConfig
Engine string
Servers []string
GcProbability int
GcDivisor int
}
1
https://gitee.com/Doer/gocaptcha.git
git@gitee.com:Doer/gocaptcha.git
Doer
gocaptcha
gocaptcha
master

搜索帮助