gocaptcha

package
v1.2.121 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

验证码

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelClient added in v1.2.108

func DelClient(names ...string)

func Init added in v1.2.85

func Init(configs ...Config) (err error)

可以一次初始化多个实例或者 多次调用初始化多个实例

Types

type CaptchaData

type CaptchaData struct {
	Data      string `json:"data"`
	CaptchaId string `json:"captchaId"`
	Answer    string `json:"answer"`
}

type Config added in v1.2.85

type Config struct {
	Name        string          `json:"name,optional" yaml:"Name"`
	RedisConfig *goredis.Config `json:"redisConfig,optional" yaml:"RedisConfig"`
}

默认内存,分布式用redis等

type GoCaptcha

type GoCaptcha struct {
	// contains filtered or unexported fields
}

func Default added in v1.2.85

func Default() *GoCaptcha

func GetClient added in v1.2.85

func GetClient(names ...string) *GoCaptcha

func New

func New(store base64Captcha.Store) *GoCaptcha

func NewDefault

func NewDefault() *GoCaptcha

func NewRedis

func NewRedis(config goredis.Config) (*GoCaptcha, error)

new other store

func (*GoCaptcha) AudioCaptcha

func (g *GoCaptcha) AudioCaptcha(language string, length int) (*CaptchaData, error)

func (*GoCaptcha) CaptchaVerify

func (g *GoCaptcha) CaptchaVerify(id, code string) bool

验证

func (*GoCaptcha) ChineseCaptcha

func (g *GoCaptcha) ChineseCaptcha(width, height, length int, source string) (*CaptchaData, error)

source是中文英文字列表

func (*GoCaptcha) DigitCaptcha

func (g *GoCaptcha) DigitCaptcha(width, height, length int) (*CaptchaData, error)

func (*GoCaptcha) GetCaptcha

func (g *GoCaptcha) GetCaptcha(param configJsonBody) (*CaptchaData, error)

返回不同类型的验证码

func (*GoCaptcha) MathCaptcha

func (g *GoCaptcha) MathCaptcha(width, height int) (*CaptchaData, error)

数学计算

func (*GoCaptcha) StringCaptcha

func (g *GoCaptcha) StringCaptcha(width, height, length int) (*CaptchaData, error)

type RedisStore

type RedisStore struct {
	Context context.Context
	// contains filtered or unexported fields
}

func (*RedisStore) Get

func (r *RedisStore) Get(id string, clear bool) string

func (*RedisStore) Set

func (r *RedisStore) Set(id string, value string) error

func (*RedisStore) Verify

func (r *RedisStore) Verify(id, answer string, clear bool) bool

Directories

Path Synopsis
example of HTTP server that uses the captcha package.
example of HTTP server that uses the captcha package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL