joyCaptcha

package
v0.0.0-...-cda82d8 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptchaVerify

func CaptchaVerify(id string, code string) bool

base64Captcha verify http handler

func GenerateCaptcha

func GenerateCaptcha(param *CaptchaParam) (string, string, error)

base64Captcha create http handler

func InitCaptcha

func InitCaptcha()

Types

type CaptchaParam

type CaptchaParam struct {
	CaptchaType string //audio、string、math、chinese、digit

	Length int //Length random string length.

	//audio
	Language string // Language possible values for lang are "en", "ja", "ru", "zh".

	//string
	Height          int         // Height png height in pixel.
	Width           int         // Width Captcha png width in pixel.
	NoiseCount      int         //NoiseCount text noise count.
	ShowLineOptions int         //  OptionShowHollowLine=2 | OptionShowSlimeLine=4 | OptionShowSineLine=8 .
	Source          string      //Source is a unicode which is the rand string from.
	BgColor         *color.RGBA //BgColor captcha image background color (optional)

	// Digit
	MaxSkew  float64 // MaxSkew max absolute skew factor of a single digit.
	DotCount int     // DotCount Number of background circles.
}

configJsonBody json request body.

type JoyCaptchaStore

type JoyCaptchaStore struct {
	StoreCacheObj *gocache.Cache
}

func (*JoyCaptchaStore) Get

func (store *JoyCaptchaStore) Get(id string, clear bool) string

func (*JoyCaptchaStore) Set

func (store *JoyCaptchaStore) Set(id string, value string)

func (*JoyCaptchaStore) Verify

func (store *JoyCaptchaStore) Verify(id, answer string, clear bool) bool

Jump to

Keyboard shortcuts

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