Documentation ¶
Overview ¶
based on https://www.socketloop.com/tutorials/golang-recaptcha-example
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoCaptcha is returned when the form value 'g-recaptcha-response' is empty ErrNoCaptcha = errors.New("missing recaptcha response in request") // ErrNoSuccess is returned when the recaptcha request was not successful. ErrNoSuccess = errors.New("request was not successful") // ErrScore is returned when the calculated score is below the required score (V3 only). ErrScore = errors.New("request was below the required score") // ErrAction is returned when the action is not the required one (V3 only). ErrAction = errors.New("wrong action") )
Functions ¶
This section is empty.
Types ¶
type OptionV3 ¶
type OptionV3 func(*optionsV3)
OptionV3 are optional settings for reCAPTCHA V3 validations.
type ResponseV2 ¶
type ResponseV2 struct { Success bool `json:"success"` ChallengeTS time.Time `json:"challenge_ts"` // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ) Hostname string `json:"hostname"` // the hostname of the site where the reCAPTCHA was solved ErrorCodes []string `json:"error-codes"` // optional }
ResponseV2 is a reCAPTCHA v2 response.
type ResponseV3 ¶
type ResponseV3 struct { Score float64 `json:"score"` Action string `json:"action"` ResponseV2 }
ResponseV3 is a reCAPTCHA v3 response.
Click to show internal directories.
Click to hide internal directories.