captcha

package
v2.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const GEETEST_API string = "http://gcaptcha4.geetest.com"
View Source
const HCAPTCHA_API = "https://api.hcaptcha.com/siteverify"
View Source
const RECAPTCHA_API = "https://www.google.com/recaptcha/api/siteverify"
View Source
const TURNSTILE_API = "https://challenges.cloudflare.com/turnstile/v0/siteverify"

Variables

This section is empty.

Functions

func RenderIFrame

func RenderIFrame(htmlFilename string, params Map) ([]byte, error)

Types

type CaptchaType

type CaptchaType = int
const (
	Image CaptchaType = iota
	IFrame
)

type Checker

type Checker interface {
	Type() CaptchaType
	Check(value string) (bool, error)
	Get() ([]byte, error)
}

func NewCaptchaChecker

func NewCaptchaChecker(conf *CheckerConf) Checker

type CheckerConf

type CheckerConf struct {
	config.CaptchaConf
	User User
}

type GeetestCaptchaChecker

type GeetestCaptchaChecker struct {
	User       *User
	CaptchaID  string
	CaptchaKey string
}

func NewGeetestChecker

func NewGeetestChecker(conf *config.GeetestConf, user *User) *GeetestCaptchaChecker

func (*GeetestCaptchaChecker) Check

func (c *GeetestCaptchaChecker) Check(value string) (bool, error)

func (*GeetestCaptchaChecker) Get

func (c *GeetestCaptchaChecker) Get() ([]byte, error)

func (*GeetestCaptchaChecker) Type

type GeetestParams

type GeetestParams struct {
	CaptchaID     string `json:"captcha_id"`
	LotNumber     string `json:"lot_number"`
	PassToken     string `json:"pass_token"`
	GenTime       string `json:"gen_time"`
	CaptchaOutput string `json:"captcha_output"`
}

type HCaptchaChecker

type HCaptchaChecker struct {
	User       *User
	SiteKey    string
	SecreteKey string
}

func NewHCaptchaChecker

func NewHCaptchaChecker(conf *config.HCaptchaConf, user *User) *HCaptchaChecker

func (*HCaptchaChecker) Check

func (c *HCaptchaChecker) Check(value string) (bool, error)

func (*HCaptchaChecker) Get

func (c *HCaptchaChecker) Get() ([]byte, error)

func (*HCaptchaChecker) Type

func (c *HCaptchaChecker) Type() CaptchaType

type ImageChecker

type ImageChecker struct {
	User *User
}

func NewImageChecker

func NewImageChecker(user *User) *ImageChecker

func (*ImageChecker) Check

func (c *ImageChecker) Check(value string) (bool, error)

func (*ImageChecker) Get

func (c *ImageChecker) Get() ([]byte, error)

func (*ImageChecker) Type

func (c *ImageChecker) Type() CaptchaType

type Map

type Map = map[string]interface{}

type ReCaptchaChecker

type ReCaptchaChecker struct {
	User       *User
	SiteKey    string
	SecreteKey string
}

func NewReCaptchaChecker

func NewReCaptchaChecker(conf *config.ReCaptchaConf, user *User) *ReCaptchaChecker

func (*ReCaptchaChecker) Check

func (c *ReCaptchaChecker) Check(value string) (bool, error)

func (*ReCaptchaChecker) Get

func (c *ReCaptchaChecker) Get() ([]byte, error)

func (*ReCaptchaChecker) Type

func (c *ReCaptchaChecker) Type() CaptchaType

type TurnstileChecker

type TurnstileChecker struct {
	User       *User
	SiteKey    string
	SecreteKey string
}

func NewTurnstileChecker

func NewTurnstileChecker(conf *config.TurnstileConf, user *User) *TurnstileChecker

func (*TurnstileChecker) Check

func (c *TurnstileChecker) Check(value string) (bool, error)

func (*TurnstileChecker) Get

func (c *TurnstileChecker) Get() ([]byte, error)

func (*TurnstileChecker) Type

func (c *TurnstileChecker) Type() CaptchaType

type User

type User struct {
	ID string
	IP string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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