package module
Version: v0.0.0-...-d62492e Latest Latest

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

Go to latest
Published: Apr 19, 2015 License: MIT Imports: 5 Imported by: 0




This package handles reCaptcha ( form submissions in Go (


Install the package in your environment:

go get -u

To use it within your own code, import "" and call:

recaptcha.Init (recaptcha_private_key)

once, to set the reCaptcha private key for your domain, then:

recaptcha.Confirm (client_ip_address, g_recaptcha_response_field)

for each reCaptcha form input you need to check, using the g-recaptcha-response value obtained by reading the form's POST parameter.

The recaptcha.Confirm() function returns either true (i.e., the captcha was completed correctly) or false.

Usage Example

Included with this repo is example.go, a simple HTTP server which creates the reCaptcha form and tests the input.

Build the example after installing the recaptcha package:

go build example.go

Run the server by invoking the executable:

./example <reCaptcha public key> <reCaptcha private key>

You can access the page from http://localhost:9001/ in your browser.



Package recaptcha handles reCaptcha ( form submissions

This package is designed to be called from within an HTTP server or web framework which offers reCaptcha form inputs and requires them to be evaluated for correctness

Edit the recaptcha_private_key constant before building and using



This section is empty.


This section is empty.


func Confirm

func Confirm(remoteip, response string) bool

Confirm is the public interface function. It calls check, which the client ip address, the challenge code from the reCaptcha form, and the client's response input to that challenge to determine whether or not the client answered the reCaptcha input question correctly. It returns a boolean value indicating whether or not the client answered correctly.

func Init

func Init(secret string)

Init allows the webserver or code evaluating the reCaptcha form input to set the reCaptcha secret (string) value.


This section is empty.

Source Files


Path Synopsis
example.go A simple HTTP server which presents a reCaptcha input form and evaulates the result, using the package.
example.go A simple HTTP server which presents a reCaptcha input form and evaulates the result, using the package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL