recaptchatest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server is a test server that can act as a reCAPTCHA stand-in for unit tests.

func NewServer

func NewServer() *Server

NewServer creates a new test server.

func (*Server) Close

func (s *Server) Close()

Close the server.

func (*Server) NewSite

func (s *Server) NewSite() *Site

NewSite creates a new reCAPTCHA site.

func (*Server) VerifyEndpoint

func (s *Server) VerifyEndpoint() string

VerifyEndpoint returns the URL to use for verifying a token.

type Site

type Site struct {
	PublicKey  string // This is the public key.
	PrivateKey string // This is the private key.
	// contains filtered or unexported fields
}

Site represents a reCAPTCHA site.

func (*Site) GenerateToken

func (s *Site) GenerateToken(tokenData *TokenData) string

GenerateToken generates a new token for the given token data.

func (*Site) NewResponseToken

func (s *Site) NewResponseToken() string

NewResponseToken simulates generating a valid response token.

func (*Site) NewResponseTokenRemoteIP

func (s *Site) NewResponseTokenRemoteIP(remoteIP string) string

NewResponseTokenRemoteIP simulates generating a valid response token for the given remote IP address.

type TokenData

type TokenData struct {
	Used           bool      // Whether or not this token has been used already.
	RemoteIP       string    // (optional) The remote IP address.
	ExpirationDate time.Time // This is when the token expires.
}

TokenData represents the data for a token.

Jump to

Keyboard shortcuts

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