common

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2020 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Keys used as names for input elements in captcha form HTML
	IDKey         = "captchouli-id"
	ColourKey     = "captchouli-color"
	BackgroundKey = "captchouli-background"
)

Variables

View Source
var (
	RootDir string
	IsTest  = false
)
View Source
var CryptoSource mRand.Source = new(cryptoSource)

Source of cryptographically secure integers

View Source
var (
	ErrNoMatch = Error{errors.New("no images match tag")}
)

Functions

func DecodeMD5

func DecodeMD5(s string) (buf [16]byte, err error)

Decode hex string to MD5 hash

func RandomInt

func RandomInt(max int) int

Returns a cryptographically secure pseudorandom int in the interval [0;max)

func ThumbPath

func ThumbPath(md5 [16]byte) string

Return filesystem path to thumbnail file

Types

type DataSource

type DataSource uint8

Source of image database to use for captcha image generation

const (
	Gelbooru DataSource = iota
)

func (DataSource) String

func (d DataSource) String() string

type Error

type Error struct {
	Err error
}

Generic error with prefix string

func (Error) Error

func (e Error) Error() string

type FetchRequest

type FetchRequest struct {
	// Initial tag population
	IsInitial bool
	Source    DataSource
	Tag       string
}

Jump to

Keyboard shortcuts

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