Documentation
¶
Index ¶
- Variables
- func AcquireCookieBuffer() *buffer.SliceBuffer
- func NewZeroHasher(h hash.Hash) hash.Hash
- func ReleaseCookieBuffer(b *buffer.SliceBuffer)
- func ReleaseValidatorRequest(v *ValidatorRequest)
- func ReleaseValidatorResponse(v *ValidatorResponse)
- func ValidSupportID(id []byte) bool
- type Berghain
- type LevelConfig
- type RequestIdentifier
- type ValidationType
- type ValidatorRequest
- type ValidatorResponse
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AcquireCookieBuffer ¶
func AcquireCookieBuffer() *buffer.SliceBuffer
func ReleaseCookieBuffer ¶
func ReleaseCookieBuffer(b *buffer.SliceBuffer)
func ReleaseValidatorRequest ¶
func ReleaseValidatorRequest(v *ValidatorRequest)
func ReleaseValidatorResponse ¶
func ReleaseValidatorResponse(v *ValidatorResponse)
func ValidSupportID ¶ added in v0.3.0
Types ¶
type Berghain ¶
type Berghain struct {
Levels []*LevelConfig
TrustedDomains []string
// HTTPClient is used for captcha siteverify requests.
// Defaults to a client with a 5 second timeout.
HTTPClient *http.Client
// contains filtered or unexported fields
}
func NewBerghain ¶
func (*Berghain) IsValidCookie ¶
func (b *Berghain) IsValidCookie(ri RequestIdentifier, cookie []byte) error
func (*Berghain) LevelConfig ¶
func (b *Berghain) LevelConfig(level uint8) *LevelConfig
type LevelConfig ¶
type LevelConfig struct {
Countdown int
Duration time.Duration
Type ValidationType
// Captcha configuration, required for the turnstile, hcaptcha and
// recaptcha validation types.
CaptchaSitekey string
CaptchaSecret string
// CaptchaVerifyURL overrides the provider siteverify endpoint,
// e.g. for regional endpoints or tests.
CaptchaVerifyURL string
// CaptchaSkipHostnameCheck disables binding the provider-reported
// hostname to the request identity. Provider test keys report a
// fixed hostname, so tests need this; production setups do not.
CaptchaSkipHostnameCheck bool
// contains filtered or unexported fields
}
type RequestIdentifier ¶
func (RequestIdentifier) ToCookie ¶
func (ri RequestIdentifier) ToCookie(b *Berghain, enc *buffer.SliceBuffer) error
type ValidationType ¶
type ValidationType int
const ( ValidationTypeNone ValidationType ValidationTypePOW ValidationTypeTurnstile ValidationTypeHCaptcha ValidationTypeReCaptcha )
func (ValidationType) RunValidator ¶
func (v ValidationType) RunValidator(b *Berghain, req *ValidatorRequest, resp *ValidatorResponse) error
type ValidatorRequest ¶
type ValidatorRequest struct {
Method string
Body []byte
Identifier *RequestIdentifier
SupportID []byte
}
func AcquireValidatorRequest ¶
func AcquireValidatorRequest() *ValidatorRequest
type ValidatorResponse ¶
type ValidatorResponse struct {
Body *buffer.SliceBuffer
Token *buffer.SliceBuffer
}
func AcquireValidatorResponse ¶
func AcquireValidatorResponse() *ValidatorResponse
Source Files
¶
Click to show internal directories.
Click to hide internal directories.