Documentation
¶
Overview ¶
Package captchahttp protects HTTP endpoints with CAPTCHA verification. Package captchahttp 为 HTTP 端点提供 CAPTCHA 验证。
Index ¶
Constants ¶
View Source
const TokenHeader = "X-Captcha-Token"
TokenHeader carries the token returned by the browser widget. TokenHeader 携带浏览器组件返回的 token。
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
// Enabled defaults to false; disabled protection never calls Verify.
// Enabled 默认关闭;关闭时不会调用 Verify。
Enabled bool
// Verify must be non-nil when enabled, safe for concurrent calls, and return
// nil only on success. Use a captcha.Client's Verify method or a custom verifier.
// 启用时 Verify 不能为 nil,必须支持并发调用,且仅在成功时返回 nil。
// 可传入 captcha.Client 的 Verify 方法或自定义验证函数。
Verify func(context.Context, string) error
}
Options enables verification using an application-supplied function. Options 通过应用提供的函数启用验证。
Click to show internal directories.
Click to hide internal directories.