Documentation
ΒΆ
Index ΒΆ
- type BotIDHeaderInput
- type CompressionType
- type DataDomeInterstitialInput
- type DataDomeSliderInput
- type DataDomeTagsInput
- type DynamicInput
- type Headers
- type KasadaHeaders
- type KasadaPayloadInput
- type KasadaPowInput
- type PixelInput
- type ReeseInput
- type SbsdInput
- type SensorInput
- type Session
- func (s *Session) GenerateBotIDHeader(ctx context.Context, input *BotIDHeaderInput) (string, error)
- func (s *Session) GenerateDataDomeInterstitial(ctx context.Context, input *DataDomeInterstitialInput) (string, *Headers, error)
- func (s *Session) GenerateDataDomeSlider(ctx context.Context, input *DataDomeSliderInput) (string, *Headers, error)
- func (s *Session) GenerateDataDomeTags(ctx context.Context, input *DataDomeTagsInput) (string, error)
- func (s *Session) GenerateKasadaPayload(ctx context.Context, input *KasadaPayloadInput) ([]byte, *KasadaHeaders, error)
- func (s *Session) GenerateKasadaPow(ctx context.Context, input *KasadaPowInput) (string, error)
- func (s *Session) GeneratePixelData(ctx context.Context, input *PixelInput) (string, error)
- func (s *Session) GenerateReese84Sensor(ctx context.Context, input *ReeseInput) (string, error)
- func (s *Session) GenerateSbsdData(ctx context.Context, input *SbsdInput) (string, string, error)
- func (s *Session) GenerateSensorData(ctx context.Context, input *SensorInput) (string, string, error)
- func (s *Session) GenerateUtmvcCookie(ctx context.Context, input *UtmvcInput) (string, string, error)
- func (s *Session) WithClient(client *http.Client) *Session
- func (s *Session) WithCompression(compression CompressionType) *Session
- func (s *Session) WithJwtKey(jwt string) *Session
- func (s *Session) WithOrganization(key, secret string) *Session
- type UtmvcInput
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type BotIDHeaderInput ΒΆ
type BotIDHeaderInput struct {
Script string `json:"script"`
UserAgent string `json:"userAgent"`
IP string `json:"ip"`
AcceptLanguage string `json:"acceptLanguage"`
}
func (BotIDHeaderInput) MarshalEasyJSON ΒΆ
func (v BotIDHeaderInput) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (BotIDHeaderInput) MarshalJSON ΒΆ
func (v BotIDHeaderInput) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*BotIDHeaderInput) UnmarshalEasyJSON ΒΆ
func (v *BotIDHeaderInput) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*BotIDHeaderInput) UnmarshalJSON ΒΆ
func (v *BotIDHeaderInput) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type CompressionType ΒΆ
type CompressionType string
CompressionType represents the compression algorithm to use
const ( CompressionZstd CompressionType = "zstd" CompressionGzip CompressionType = "gzip" )
type DataDomeInterstitialInput ΒΆ
type DataDomeInterstitialInput struct {
// UserAgent must be a Chrome Windows User-Agent.
UserAgent string `json:"userAgent"`
// DeviceLink is the URL that contains the script and starts like this:
// https://geo.captcha-delivery.com/captcha/?initialCid
DeviceLink string `json:"deviceLink"`
// Html is the response body of the GET request to the DeviceLink
Html string `json:"html"`
// Script is the DataDome challenge bundle. It is only needed when the
// challenge page loads the bundle with a <script defer src="..."> tag
// instead of inlining it, which DataDome does per request. Use
// datadome.ParseChallengeScriptURL on the Html to find out, then GET that
// URL with the same client and pass the response body here.
//
// Leave it empty when the page inlines the bundle.
Script string `json:"script"`
AcceptLanguage string `json:"acceptLanguage"`
IP string `json:"ip"`
}
func (DataDomeInterstitialInput) MarshalEasyJSON ΒΆ
func (v DataDomeInterstitialInput) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (DataDomeInterstitialInput) MarshalJSON ΒΆ
func (v DataDomeInterstitialInput) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*DataDomeInterstitialInput) UnmarshalEasyJSON ΒΆ
func (v *DataDomeInterstitialInput) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*DataDomeInterstitialInput) UnmarshalJSON ΒΆ
func (v *DataDomeInterstitialInput) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type DataDomeSliderInput ΒΆ
type DataDomeSliderInput struct {
// UserAgent must be a Chrome Windows User-Agent.
UserAgent string `json:"userAgent"`
// DeviceLink is the URL that contains the script and starts like this:
// https://geo.captcha-delivery.com/captcha/?initialCid
DeviceLink string `json:"deviceLink"`
// Html is the response body of the GET request to the DeviceLink
Html string `json:"html"`
// Puzzle is the captcha puzzle image bytes, base64 encoded.
// The URL that returns the puzzle looks like this:
// https://dd.prod.captcha-delivery.com/image/2024-xx-xx/hash.jpg
Puzzle string `json:"puzzle"`
// Piece is the captcha puzzle piece image bytes, base64 encoded.
// The URL that returns the puzzle looks like this:
// https://dd.prod.captcha-delivery.com/image/2024-xx-xx/hash.frag.png
Piece string `json:"piece"`
ParentUrl string `json:"parentUrl"`
// Script is the DataDome challenge bundle. It is only needed when the
// challenge page loads the bundle with a <script defer src="..."> tag
// instead of inlining it, which DataDome does per request. Use
// datadome.ParseChallengeScriptURL on the Html to find out, then GET that
// URL with the same client and pass the response body here.
//
// Leave it empty when the page inlines the bundle.
Script string `json:"script"`
AcceptLanguage string `json:"acceptLanguage"`
IP string `json:"ip"`
}
func (DataDomeSliderInput) MarshalEasyJSON ΒΆ
func (v DataDomeSliderInput) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (DataDomeSliderInput) MarshalJSON ΒΆ
func (v DataDomeSliderInput) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*DataDomeSliderInput) UnmarshalEasyJSON ΒΆ
func (v *DataDomeSliderInput) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*DataDomeSliderInput) UnmarshalJSON ΒΆ
func (v *DataDomeSliderInput) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type DataDomeTagsInput ΒΆ
type DataDomeTagsInput struct {
// UserAgent must be a Chrome Windows User-Agent.
UserAgent string `json:"userAgent"`
Cid string `json:"cid"`
Ddk string `json:"ddk"`
Referer string `json:"referer"`
Type string `json:"type"`
Version string `json:"version"`
AcceptLanguage string `json:"acceptLanguage"`
IP string `json:"ip"`
}
func (DataDomeTagsInput) MarshalEasyJSON ΒΆ
func (v DataDomeTagsInput) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (DataDomeTagsInput) MarshalJSON ΒΆ
func (v DataDomeTagsInput) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*DataDomeTagsInput) UnmarshalEasyJSON ΒΆ
func (v *DataDomeTagsInput) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*DataDomeTagsInput) UnmarshalJSON ΒΆ
func (v *DataDomeTagsInput) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type DynamicInput ΒΆ
type DynamicInput struct {
// Script is the akamai script's contents.
Script string `json:"script"`
}
func (DynamicInput) MarshalEasyJSON ΒΆ
func (v DynamicInput) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (DynamicInput) MarshalJSON ΒΆ
func (v DynamicInput) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*DynamicInput) UnmarshalEasyJSON ΒΆ
func (v *DynamicInput) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*DynamicInput) UnmarshalJSON ΒΆ
func (v *DynamicInput) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Headers ΒΆ
type Headers struct {
DeviceMemory string `json:"sec-ch-device-memory"`
Mobile string `json:"sec-ch-ua-mobile"`
Arch string `json:"sec-ch-ua-arch"`
Platform string `json:"sec-ch-ua-platform"`
Model string `json:"sec-ch-ua-model"`
FullVersionList string `json:"sec-ch-ua-full-version-list"`
Bitness string `json:"sec-ch-ua-bitness"`
PlatformVersion string `json:"sec-ch-ua-platform-version"`
FullVersion string `json:"sec-ch-ua-full-version"`
Wow64 string `json:"sec-ch-ua-wow64"`
FormFactors string `json:"sec-ch-ua-form-factors"`
DPR string `json:"sec-ch-dpr"`
ViewportWidth string `json:"sec-ch-viewport-width"`
ViewportHeight string `json:"sec-ch-viewport-height"`
PrefersColorScheme string `json:"sec-ch-prefers-color-scheme"`
PrefersReducedMotion string `json:"sec-ch-prefers-reduced-motion"`
}
func (Headers) MarshalEasyJSON ΒΆ
MarshalEasyJSON supports easyjson.Marshaler interface
func (Headers) MarshalJSON ΒΆ
MarshalJSON supports json.Marshaler interface
func (*Headers) UnmarshalEasyJSON ΒΆ
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Headers) UnmarshalJSON ΒΆ
UnmarshalJSON supports json.Unmarshaler interface
type KasadaHeaders ΒΆ
type KasadaHeaders struct {
XKpsdkCt string `json:"x-kpsdk-ct"`
XKpsdkDt string `json:"x-kpsdk-dt"`
XKpsdkV string `json:"x-kpsdk-v"`
XKpsdkR string `json:"x-kpsdk-r"`
XKpsdkDv string `json:"x-kpsdk-dv"`
XKpsdkH string `json:"x-kpsdk-h"`
XKpsdkFc string `json:"x-kpsdk-fc"`
XKpsdkIm string `json:"x-kpsdk-im"`
}
func (KasadaHeaders) MarshalEasyJSON ΒΆ
func (v KasadaHeaders) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (KasadaHeaders) MarshalJSON ΒΆ
func (v KasadaHeaders) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*KasadaHeaders) UnmarshalEasyJSON ΒΆ
func (v *KasadaHeaders) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*KasadaHeaders) UnmarshalJSON ΒΆ
func (v *KasadaHeaders) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type KasadaPayloadInput ΒΆ
type KasadaPayloadInput struct {
// UserAgent must be a Chrome Windows User-Agent.
UserAgent string `json:"userAgent"`
// IpsLink is the ips.js script link, parsed from the block page (429 status code)
IpsLink string `json:"ipsLink"`
// Script is the ips.js script retrieved using the IpsLink url
Script string `json:"script"`
AcceptLanguage string `json:"acceptLanguage"`
IP string `json:"ip,omitempty"`
}
func (KasadaPayloadInput) MarshalEasyJSON ΒΆ
func (v KasadaPayloadInput) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (KasadaPayloadInput) MarshalJSON ΒΆ
func (v KasadaPayloadInput) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*KasadaPayloadInput) UnmarshalEasyJSON ΒΆ
func (v *KasadaPayloadInput) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*KasadaPayloadInput) UnmarshalJSON ΒΆ
func (v *KasadaPayloadInput) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type KasadaPowInput ΒΆ
type KasadaPowInput struct {
// St is the x-kpsdk-st value returned by the /tl POST request
St int `json:"st"`
Ct string `json:"ct"`
Fc string `json:"fc"`
Domain string `json:"domain"`
Script string `json:"script"`
// WorkTime can be used to pre-generate POW strings
WorkTime *int `json:"workTime,omitempty"`
}
func (KasadaPowInput) MarshalEasyJSON ΒΆ
func (v KasadaPowInput) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (KasadaPowInput) MarshalJSON ΒΆ
func (v KasadaPowInput) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*KasadaPowInput) UnmarshalEasyJSON ΒΆ
func (v *KasadaPowInput) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*KasadaPowInput) UnmarshalJSON ΒΆ
func (v *KasadaPowInput) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type PixelInput ΒΆ
type PixelInput struct {
// UserAgent must be a Chrome Windows User-Agent.
UserAgent string `json:"userAgent"`
HTMLVar string `json:"htmlVar"`
ScriptVar string `json:"scriptVar"`
AcceptLanguage string `json:"acceptLanguage"`
IP string `json:"ip"`
}
func (PixelInput) MarshalEasyJSON ΒΆ
func (v PixelInput) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (PixelInput) MarshalJSON ΒΆ
func (v PixelInput) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*PixelInput) UnmarshalEasyJSON ΒΆ
func (v *PixelInput) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*PixelInput) UnmarshalJSON ΒΆ
func (v *PixelInput) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type ReeseInput ΒΆ
type ReeseInput struct {
UserAgent string `json:"userAgent"`
AcceptLanguage string `json:"acceptLanguage"`
IP string `json:"ip"`
ScriptUrl string `json:"scriptUrl"`
PageUrl string `json:"pageUrl"`
Pow string `json:"pow"`
Script string `json:"script"`
}
func (ReeseInput) MarshalEasyJSON ΒΆ
func (v ReeseInput) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ReeseInput) MarshalJSON ΒΆ
func (v ReeseInput) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ReeseInput) UnmarshalEasyJSON ΒΆ
func (v *ReeseInput) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ReeseInput) UnmarshalJSON ΒΆ
func (v *ReeseInput) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SbsdInput ΒΆ
type SbsdInput struct {
Index int `json:"index"`
// UserAgent must be a Chrome Windows User-Agent.
UserAgent string `json:"userAgent"`
Uuid string `json:"uuid"`
PageUrl string `json:"pageUrl"`
OCookie string `json:"o"`
// Script is mutually exclusive with [SbsdInput.Context], the first sbsd request should include the script field.
// Subsequent requests should only include the Context.
Script string `json:"script"`
AcceptLanguage string `json:"acceptLanguage"`
IP string `json:"ip"`
Context string `json:"context"`
}
func (SbsdInput) MarshalEasyJSON ΒΆ
MarshalEasyJSON supports easyjson.Marshaler interface
func (SbsdInput) MarshalJSON ΒΆ
MarshalJSON supports json.Marshaler interface
func (*SbsdInput) UnmarshalEasyJSON ΒΆ
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SbsdInput) UnmarshalJSON ΒΆ
UnmarshalJSON supports json.Unmarshaler interface
type SensorInput ΒΆ
type SensorInput struct {
// Abck is the _abck cookie retrieved from your cookiejar.
// Make sure you always retrieve it fresh from the cookiejar as it gets updated while making requests.
Abck string `json:"abck"`
// Bmsz is the bm_sz cookie retrieved from your cookiejar, make sure you always retrieve it fresh from the cookiejar.
Bmsz string `json:"bmsz"`
// Version is the akamai version, this will usually be "2"
Version string `json:"version"`
// PageUrl is the page url that loaded the akamai script, it is the same URL as the referer header on the sensor posts
PageUrl string `json:"pageUrl"`
// UserAgent must be a Chrome Windows User-Agent.
UserAgent string `json:"userAgent"`
// Script is mutually exclusive with [SensorInput.Context], the first sensor request should include the script field.
// Subsequent request should only include the Context.
Script string `json:"script"`
// ScriptUrl is the full URL where you are posting sensor data to
ScriptUrl string `json:"scriptUrl"`
AcceptLanguage string `json:"acceptLanguage"`
IP string `json:"ip"`
Context string `json:"context"`
}
func (SensorInput) MarshalEasyJSON ΒΆ
func (v SensorInput) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SensorInput) MarshalJSON ΒΆ
func (v SensorInput) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SensorInput) UnmarshalEasyJSON ΒΆ
func (v *SensorInput) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SensorInput) UnmarshalJSON ΒΆ
func (v *SensorInput) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Session ΒΆ
type Session struct {
ApiKey string
JwtKey []byte
AppKey string
AppSecret []byte
Client *http.Client
Compression CompressionType
}
func NewSession ΒΆ
NewSession creates a new Session that can be used to make requests to the Hyper Solutions API.
func (*Session) GenerateBotIDHeader ΒΆ
GenerateBotIDHeader returns the x-is-human header value
func (*Session) GenerateDataDomeInterstitial ΒΆ
func (s *Session) GenerateDataDomeInterstitial(ctx context.Context, input *DataDomeInterstitialInput) (string, *Headers, error)
GenerateDataDomeInterstitial returns the form data string that is used in the POST request to receive a solved datadome cookie, and the extra sec-ch-* headers used on consequent requests.
func (*Session) GenerateDataDomeSlider ΒΆ
func (s *Session) GenerateDataDomeSlider(ctx context.Context, input *DataDomeSliderInput) (string, *Headers, error)
GenerateDataDomeSlider returns the URL that will return a solved datadome cookie when blocked by captcha, and the extra sec-ch-* headers used on consequent requests.
func (*Session) GenerateDataDomeTags ΒΆ
func (s *Session) GenerateDataDomeTags(ctx context.Context, input *DataDomeTagsInput) (string, error)
GenerateDataDomeTags returns the tags data string that is used in the POST request to receive a solved datadome cookie.
func (*Session) GenerateKasadaPayload ΒΆ
func (s *Session) GenerateKasadaPayload(ctx context.Context, input *KasadaPayloadInput) ([]byte, *KasadaHeaders, error)
GenerateKasadaPayload returns the payload to POST to /tl in bytes, and the generated headers
func (*Session) GenerateKasadaPow ΒΆ
GenerateKasadaPow returns the x-kpsdk-cd value
func (*Session) GeneratePixelData ΒΆ
GeneratePixelData returns the pixel data using the Hyper Solutions API.
func (*Session) GenerateReese84Sensor ΒΆ
GenerateReese84Sensor returns the sensor data required to generate valid reese84 cookies using the Hyper Solutions API.
func (*Session) GenerateSbsdData ΒΆ
GenerateSbsdData returns the sbsd payload and context using the Hyper Solutions API.
func (*Session) GenerateSensorData ΒΆ
func (s *Session) GenerateSensorData(ctx context.Context, input *SensorInput) (string, string, error)
GenerateSensorData returns the sensor data required to generate valid akamai cookies using the Hyper Solutions API.
func (*Session) GenerateUtmvcCookie ΒΆ
func (s *Session) GenerateUtmvcCookie(ctx context.Context, input *UtmvcInput) (string, string, error)
GenerateUtmvcCookie returns the utmvc cookie using the Hyper Solutions API.
func (*Session) WithClient ΒΆ
WithClient sets a new client that will be used to make requests to the Hyper Solutions API.
func (*Session) WithCompression ΒΆ
func (s *Session) WithCompression(compression CompressionType) *Session
WithCompression sets the compression type for requests.
func (*Session) WithJwtKey ΒΆ
WithJwtKey adds the JWT Key to the session. If not empty, a signature will be added to each request.
func (*Session) WithOrganization ΒΆ
WithOrganization adds the organization to the session.
type UtmvcInput ΒΆ
type UtmvcInput struct {
UserAgent string `json:"userAgent"`
// SessionIds The value of each cookie that has a name that starts with incap_ses_
SessionIds []string `json:"sessionIds"`
// Script is the UTMVC script contents
Script string `json:"script"`
}
func (UtmvcInput) MarshalEasyJSON ΒΆ
func (v UtmvcInput) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (UtmvcInput) MarshalJSON ΒΆ
func (v UtmvcInput) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*UtmvcInput) UnmarshalEasyJSON ΒΆ
func (v *UtmvcInput) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*UtmvcInput) UnmarshalJSON ΒΆ
func (v *UtmvcInput) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface