captcha

package module
v0.0.0-...-d3098d1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 14 Imported by: 0

README

captcha

go 实现的图像扶正验证码

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Captcha

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

Captcha 验证码实例

func NewCaptcha

func NewCaptcha(p Provider, c cache.CURD) *Captcha

NewCaptcha 创建验证码实例

func (*Captcha) Compare

func (i *Captcha) Compare(key string, rad float64) (threshold float64, err error)

Compare 比较角度

func (*Captcha) Draw

func (i *Captcha) Draw(key string, rad float64) (image.Image, error)

Draw 返回一个指定旋转角度的验证码

func (*Captcha) Rand

func (i *Captcha) Rand(key string) (image.Image, float64, error)

Rand 返回一个随机旋转的图片验证码

type Provider

type Provider interface {
	Get() (image.Image, error)
}

Provider 图片提供接口

func LoadDirImage

func LoadDirImage(dirPath string) (Provider, error)

LoadDirImage 加载目录中的图片作为 Provider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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