modeles

package
v0.0.0-...-115d41d Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigDigit

type ConfigDigit struct {
	// Height png height in pixel.
	Height int `json:"height"`
	// Width Captcha png width in pixel.
	Width int `json:"width"`
	// DefaultLen Default number of digits in captcha solution.
	CaptchaLen int `json:"captcha_len"`
	// MaxSkew max absolute skew factor of a single digit.
	MaxSkew float64 `json:"max_skew"`
	// DotCount Number of background circles.
	DotCount int `json:"dot_count"`
}

type ConfigJsonBody

type ConfigJsonBody struct {
	Id          string      `json:"id"`
	VerifyValue string      `json:"verifyValue"`
	DigitParams ConfigDigit `json:"digit_params"`
}

configJsonBody json request body.

type Response

type Response struct {
	StatusCode int         `json:"statusCode"`
	Message    string      `json:"message"`
	Payload    interface{} `json:"payload"`
}

type Store

type Store interface {
	// Set sets the digits for the captcha id.
	Set(id string, value string)

	// Get returns stored digits for the captcha id. Clear indicates
	// whether the captcha must be deleted from the store.
	Get(id string, clear bool) string
}

Store An object implementing Store interface can be registered with SetCustomStore function to handle storage and retrieval of captcha ids and solutions for them, replacing the default memory store.

It is the responsibility of an object to delete expired and used captchas when necessary (for example, the default memory store collects them in Set method after the certain amount of captchas has been stored.)

func NewMemoryStore

func NewMemoryStore(collectNum int, expiration time.Duration) Store

NewMemoryStore returns a new standard memory store for captchas with the given collection threshold and expiration time (duration). The returned store must be registered with SetCustomStore to replace the default one.

Jump to

Keyboard shortcuts

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