hyper

package module
v4.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README ΒΆ

Hyper Solutions SDK - Go Library for Bot Protection Bypass (Akamai, Incapsula, Kasada, DataDome)

Go Version License GitHub Release GitHub Stars

A powerful Go SDK for bypassing modern bot protection systems including Akamai Bot Manager, Incapsula, Kasada, and DataDome. Generate valid cookies, solve anti-bot challenges, and automate protected endpoints with ease.

Perfect for web scraping, automation, and data collection from protected websites.

πŸ”‘ Getting API Access

Before using this SDK, you'll need an API key from Hyper Solutions:

  1. Visit hypersolutions.co to create your account
  2. Choose your plan:
    • πŸ’³ Pay-as-you-go: Perfect for testing and small-scale usage
    • πŸ“Š Subscription plans: Cost-effective for high-volume applications
  3. Get your API key from the dashboard
  4. Start bypassing bot protection with this SDK!

πŸš€ Quick Start

package main

import (
	"context"
	"fmt"

	"github.com/Hyper-Solutions/hyper-sdk-go/v4"
)

func main() {
	session := hyper.NewSession("your-api-key")

	// Generate Akamai sensor data
	res, err := session.GenerateSensorData(context.Background(), &hyper.SensorInput{
		// Configure your sensor input
	})
	if err != nil {
		panic(err)
	}

	fmt.Printf("Generated sensor data: %s", res.Payload)
	fmt.Printf("Sensor context: %s", res.Context)
}

Every Generate* method returns a result struct (*hyper.SensorResult, *hyper.SbsdResult, ...), so fields the API adds later arrive without breaking your code.

Client hints (Accept-CH)

Sensor, SBSD, Reese84, Kasada payload and DataDome results carry ClientHints: the sec-ch-*, device-memory, dpr, viewport-width, ect, rtt and downlink headers for the device the payload was generated for, keyed by lowercase header name and ready to send verbatim. Send only the ones the site asked for in its Accept-CH response header:

for _, name := range strings.Split(resp.Header.Get("Accept-CH"), ",") {
	name = strings.ToLower(strings.TrimSpace(name))
	if value, ok := res.ClientHints[name]; ok {
		req.Header.Set(name, value)
	}
}

ClientHints is nil when the API returns none (Safari user agents, and payloads built by a remote browser).

✨ Features

  • πŸ›‘οΈ Akamai Bot Manager: Generate sensor data, handle pixel challenges, validate cookies
  • πŸ”’ Incapsula Protection: Generate Reese84 sensors and UTMVC cookies
  • ⚑ Kasada Bypass: Generate payload data (CT) and POW tokens (CD)
  • 🎯 DataDome Solutions: Solve tags, slider captchas and interstitial challenges
  • πŸ”§ Easy Integration: Simple Go API with comprehensive documentation
  • βš™οΈ Flexible Configuration: Custom HTTP clients and JWT key support

πŸ“¦ Installation

Install the Hyper Solutions SDK for Go using:

go get github.com/Hyper-Solutions/hyper-sdk-go/v4

πŸ“‹ Table of Contents

πŸ”§ Basic Usage

Creating a Session

Initialize the SDK with your API key to start bypassing bot protection:

// Basic session
session := hyper.NewSession("your-api-key")

// Advanced session with custom configuration
session := hyper.NewSession("your-api-key").
    WithJwtKey("your-jwt-key").
    WithClient(customHTTPClient)
Checking Usage

GetUsage returns the key's pay-as-you-go balance and the remaining requests of each plan. It is not counted as usage.

usage, err := session.GetUsage(ctx)
if err != nil {
    // Handle error
}

fmt.Printf("balance: €%.2f\n", usage.BalanceEuro)
for _, plan := range usage.Plans {
    fmt.Printf("%s: %d of %d left, expires %s\n",
        plan.Product, plan.RequestsRemaining, plan.RequestsQuota, plan.ExpiresAt.Format(time.DateOnly))
}

πŸ›‘οΈ Akamai Bot Manager

Bypass Akamai Bot Manager protection with sensor data generation, cookie validation, and challenge solving.

Generating Sensor Data

Generate sensor data for valid Akamai cookies and bot detection bypass:

res, err := session.GenerateSensorData(ctx, &hyper.SensorInput{
    // Configure sensor parameters
})
if err != nil {
    // Handle error
}
// res.Payload is the sensor data, res.Context goes into the next SensorInput
SBSD

Generate SBSD payloads. The first request of a session sends the script, later ones send the returned context. A hard block (an SBSD POST with a t parameter) always sends the script with an empty context, never one from an earlier request:

res, err := session.GenerateSbsdData(ctx, &hyper.SbsdInput{
    // ... other parameters
    Script:    script,
    ScriptUrl: scriptUrl, // optional: absolute src of the SBSD script tag, query included
})
if err != nil {
    // Handle error
}
// POST res.Payload; pass res.Context in the next SbsdInput instead of Script
Parsing Script Path

Extract Akamai Bot Manager script paths from HTML for reverse engineering:

scriptPath, err := akamai.ParseScriptPath(reader)
if err != nil {
    // Handle error
}
Handling Sec-Cpt Challenges

Solve sec-cpt challenges with built-in parsing and payload generation:

  • ParseSecCptChallenge: Parse sec-cpt challenges from HTML
  • ParseSecCptChallengeFromJson: Parse from JSON responses
  • GenerateSecCptPayload: Generate challenge response payloads
  • Sleep: Handle challenge timing requirements
  • SleepWithContext: Context-aware challenge delays

Validate Akamai _abck cookies and session states:

  • IsCookieValid: Check cookie validity for request counts
  • IsCookieInvalidated: Determine if more sensors are needed
Pixel Challenge Solving

Handle Akamai pixel challenges for advanced bot detection bypass:

res, err := session.GeneratePixelData(ctx, &hyper.PixelInput{
    // Pixel challenge parameters
})
// res.Payload is the pixel data
if err != nil {
    // Handle error
}

Pixel parsing functions:

  • ParsePixelHtmlVar: Extract pixel variables from HTML
  • ParsePixelScriptURL: Get pixel script and POST URLs
  • ParsePixelScriptVar: Parse dynamic pixel values

πŸ”’ Incapsula Protection

Bypass Incapsula bot detection with Reese84 sensors and UTMVC cookie generation.

Generating Reese84 Sensors

Create Reese84 sensor data for Incapsula bypass:

res, err := session.GenerateReese84Sensor(ctx, &hyper.ReeseInput{
    // Reese84 parameters
})
// res.Payload is the sensor, res.ClientHints the Accept-CH headers
if err != nil {
    // Handle error
}

Generate UTMVC cookies for Incapsula protection bypass:

res, err := session.GenerateUtmvcCookie(ctx, &hyper.UtmvcInput{
    Script: "incapsula-script-content",
    SessionIds: []string{"session-id-1", "session-id-2"},
    UserAgent: "Mozilla/5.0 (compatible bot)",
})
// res.Payload is the ___utmvc cookie, res.Swhanedl the swhanedl value
if err != nil {
    // Handle error
}
Script Path Parsing

Parse UTMVC script paths for Incapsula integration:

scriptPath, err := incapsula.ParseUtmvcScriptPath(scriptReader)
if err != nil {
    // Handle error
}

// Generate submit path
submitPath := incapsula.GetUtmvcSubmitPath()

⚑ Kasada Bypass

Defeat Kasada Bot Manager with payload generation and POW solving.

Generating Payload Data (CT)

Create x-kpsdk-ct tokens for Kasada bypass:

res, err := session.GenerateKasadaPayload(ctx, &hyper.KasadaPayloadInput{
    // Kasada payload configuration

    // Strict refuses a payload built on a signal the API cannot identify yet,
    // instead of returning one built on a guess. Optional, off by default.
    Strict: false,
})
// POST res.Payload to /tl with the x-kpsdk-* values in res.Headers.
// res.ClientHints are the Accept-CH headers: send only the ones the site asked for.
if err != nil {
    // Handle error
}
Generating POW Data (CD)

Solve Kasada Proof-of-Work challenges for x-kpsdk-cd tokens:

res, err := session.GenerateKasadaPow(ctx, &hyper.KasadaPowInput{
    // POW challenge parameters
})
// res.Payload is the x-kpsdk-cd value
if err != nil {
    // Handle error
}
Script Path Extraction

Extract Kasada script paths from blocked pages (HTTP 429):

scriptPath, err := kasada.ParseScriptPath(reader)
if err != nil {
    // Handle error
}
// Returns: /ips.js?timestamp=...
Mobile User-Agent Generation

Generate the Kasada mobile user-agent value sent on the native app flow. The mobile SDK derives it as the lowercase hex MD5 of "<osVersion> / <bundleID> <appVersion>":

userAgent := kasada.GenerateUserAgent("18.0.1", "com.example.app", "9.15.0")
// iOS:     osVersion = UIDevice.systemVersion, bundleID = CFBundleIdentifier
// Android: osVersion = Build.VERSION.SDK_INT,  bundleID = package name
// Returns: 7016adc4ba8d433533954ebad33be424

Available in hyper-sdk-go v3.1.0 and later.

🎯 DataDome Solutions

Solve DataDome captchas including slider challenges and interstitial pages.

Interstitial Challenge Solving

Bypass DataDome interstitial pages:

res, err := session.GenerateDataDomeInterstitial(ctx, &hyper.DataDomeInterstitialInput{
    // Interstitial parameters
})
if err != nil {
    // Handle error
}
// POST res.Payload to https://geo.captcha-delivery.com/interstitial/
Slider Captcha Solving

Solve DataDome slider captchas automatically:

res, err := session.GenerateDataDomeSlider(ctx, &hyper.DataDomeSliderInput{
    // Slider challenge parameters
})
if err != nil {
    // Handle error
}
// GET request to res.Payload (the check URL)

Extract DataDome device check URLs:

// Interstitial device links
deviceLink, err := datadome.ParseInterstitialDeviceCheckLink(reader, datadomeCookie, referer)
if err != nil {
    // Handle error
}

// Slider device links  
deviceLink, err := datadome.ParseSliderDeviceCheckLink(reader, datadomeCookie, referer)
if err != nil {
    // Handle error
}
Challenge Script Parsing

DataDome serves some challenge pages with the bundle inlined in the HTML and others with it in its own file, switching between the two per request. When a page uses its own file, fetch it and pass it as Script:

// After GET-ing the deviceLink and reading the body into html
var script string
if scriptURL, ok := datadome.ParseChallengeScriptURL(html); ok {
    // GET scriptURL with the same client, proxy and headers, then read the body
    script = scriptBody
}

res, err := session.GenerateDataDomeInterstitial(ctx, &hyper.DataDomeInterstitialInput{
    // ... other parameters
    Html:   html,
    Script: script, // empty when the page inlines the bundle
})

The same applies to DataDomeSliderInput. Script is optional and leaving it empty keeps working, but the payload is then built against a pinned script version instead of the one the page actually served.

Getting Help

πŸ“„ License

This SDK is licensed under the MIT License.


Keywords: Go SDK, Golang, bot protection bypass, web scraping, Akamai bypass, Incapsula bypass, Kasada bypass, DataDome bypass, anti-bot, captcha solver, automation, reverse engineering, bot detection, web automation

Documentation ΒΆ

Index ΒΆ

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 BotIDHeaderResult ΒΆ

type BotIDHeaderResult struct {
	// Payload is the x-is-human header value.
	Payload string
}

BotIDHeaderResult is returned by Session.GenerateBotIDHeader.

type ClientHints ΒΆ

type ClientHints map[string]string

ClientHints are the Accept-CH client hint headers for the device a payload was generated for, keyed by lowercase header name, with values ready to send verbatim (already serialized the way Chrome sends them; do not re-quote).

The API returns every hint Chrome sends once a site opts in via Accept-CH: sec-ch-ua, sec-ch-ua-mobile, sec-ch-ua-platform, sec-ch-ua-arch, sec-ch-ua-bitness, sec-ch-ua-model, sec-ch-ua-platform-version, sec-ch-ua-full-version, sec-ch-ua-full-version-list, sec-ch-ua-wow64, sec-ch-ua-form-factors, sec-ch-device-memory, sec-ch-dpr, sec-ch-viewport-width, sec-ch-viewport-height, device-memory, dpr, viewport-width, ect, rtt, downlink, sec-ch-prefers-color-scheme, sec-ch-prefers-reduced-motion and sec-ch-prefers-reduced-transparency. Send only the ones the target site asked for in its Accept-CH response header; sending hints a site never requested is not what a browser does.

Nil when the API returned none: Safari user agents, and payloads built by a remote browser.

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 the page loads with a
	// <script defer src="..."> tag. Use datadome.ParseChallengeScriptURL on the
	// Html to find its URL, then GET that URL with the same client and pass the
	// response body here.
	//
	// It is required. The session sends only the bundle's sha256, and sends
	// the bundle itself when the API answers that it has not seen it yet.
	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 DataDomeInterstitialResult ΒΆ

type DataDomeInterstitialResult struct {
	// Payload is the form body to POST for a solved datadome cookie.
	Payload string
	// ClientHints are the Accept-CH headers for the device the payload describes.
	ClientHints ClientHints
}

DataDomeInterstitialResult is returned by Session.GenerateDataDomeInterstitial.

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 the page loads with a
	// <script defer src="..."> tag. Use datadome.ParseChallengeScriptURL on the
	// Html to find its URL, then GET that URL with the same client and pass the
	// response body here.
	//
	// It is required. The session sends only the bundle's sha256, and sends
	// the bundle itself when the API answers that it has not seen it yet.
	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 DataDomeSliderResult ΒΆ

type DataDomeSliderResult struct {
	// Payload is the URL that returns a solved datadome cookie.
	Payload string
	// ClientHints are the Accept-CH headers for the device the payload describes.
	ClientHints ClientHints
}

DataDomeSliderResult is returned by Session.GenerateDataDomeSlider.

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 DataDomeTagsResult ΒΆ

type DataDomeTagsResult struct {
	// Payload is the tags body to POST.
	Payload string
	// ClientHints are the Accept-CH headers for the device the payload describes.
	ClientHints ClientHints
}

DataDomeTagsResult is returned by Session.GenerateDataDomeTags.

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 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"`

	// Strict refuses the payload instead of returning one built on a guess when
	// the script has a signal the API cannot identify yet. The request then
	// fails with "Unidentified signals in script; refusing payload because
	// strict was set". Off by default: such a payload usually still works.
	Strict bool `json:"strict,omitempty"`

	// Dv is the x-kpsdk-dv header the iOS app flow sends, exactly as sent
	// (see kasada.GenerateDV). Optional, iOS app user agents only: the payload
	// is then generated on a device with the screen of the model it names and
	// the iOS release it names, so the two agree.
	Dv string `json:"dv,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 KasadaPayloadResult ΒΆ

type KasadaPayloadResult struct {
	// Payload is the body to POST to /tl.
	Payload []byte
	// Headers are the x-kpsdk-* headers to send with that POST.
	Headers KasadaHeaders
	// ClientHints are the Accept-CH headers for the device the payload
	// describes. Unlike Headers, send only the ones the site asked for.
	ClientHints ClientHints
}

KasadaPayloadResult is returned by Session.GenerateKasadaPayload.

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 KasadaPowResult ΒΆ

type KasadaPowResult struct {
	// Payload is the x-kpsdk-cd value.
	Payload string
}

KasadaPowResult is returned by Session.GenerateKasadaPow.

type KasadaVersionInput ΒΆ added in v4.1.0

type KasadaVersionInput struct {
	// PageUrl is the URL of the page that loaded p.js.
	PageUrl string `json:"pageUrl"`

	// Script is the p.js script.
	Script string `json:"script"`
}

KasadaVersionInput is the Session.GetKasadaVersion request.

func (KasadaVersionInput) MarshalEasyJSON ΒΆ added in v4.1.0

func (v KasadaVersionInput) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (KasadaVersionInput) MarshalJSON ΒΆ added in v4.1.0

func (v KasadaVersionInput) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*KasadaVersionInput) UnmarshalEasyJSON ΒΆ added in v4.1.0

func (v *KasadaVersionInput) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*KasadaVersionInput) UnmarshalJSON ΒΆ added in v4.1.0

func (v *KasadaVersionInput) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type KasadaVersionResult ΒΆ added in v4.1.0

type KasadaVersionResult struct {
	// Version is the x-kpsdk-v value, such as "j-1.2.797". Send it verbatim
	// on the /fp request and in the x-kpsdk-v header.
	Version string
}

KasadaVersionResult is returned by Session.GetKasadaVersion.

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 PixelResult ΒΆ

type PixelResult struct {
	// Payload is the pixel data to post.
	Payload string
}

PixelResult is returned by Session.GeneratePixelData.

type Reese84Result ΒΆ

type Reese84Result struct {
	// Payload is the reese84 sensor to post.
	Payload string
	// ClientHints are the Accept-CH headers for the device the payload
	// describes. Nil for Safari user agents.
	ClientHints ClientHints
}

Reese84Result is returned by Session.GenerateReese84Sensor.

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 is the reese84 script. The session sends only its sha256, and
	// sends the script itself when the API answers that it has not seen it yet.
	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 {
	// 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.
	// 	A hard block (an SBSD POST with a t parameter) always starts a new chain: send Script and an empty
	// 	Context, never the Context from an earlier request.
	// 	The session sends only the script's sha256, and sends the script itself when the API answers that it has
	// 	not seen it yet.
	Script string `json:"script"`

	// ScriptUrl is the absolute src of the SBSD script tag, query included.
	// Optional: when set, the fingerprint's resource-timing signal carries the
	// script's own entry the way a browser's does.
	ScriptUrl string `json:"scriptUrl,omitempty"`

	AcceptLanguage string `json:"acceptLanguage"`
	IP             string `json:"ip"`
	Context        string `json:"context"`
}

func (SbsdInput) MarshalEasyJSON ΒΆ

func (v SbsdInput) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SbsdInput) MarshalJSON ΒΆ

func (v SbsdInput) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SbsdInput) UnmarshalEasyJSON ΒΆ

func (v *SbsdInput) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SbsdInput) UnmarshalJSON ΒΆ

func (v *SbsdInput) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SbsdResult ΒΆ

type SbsdResult struct {
	// Payload is the sbsd body to post.
	Payload string
	// Context must be sent back on the next sbsd request of the session.
	Context string
	// ClientHints are the Accept-CH headers for the device the payload describes.
	ClientHints ClientHints
}

SbsdResult is returned by Session.GenerateSbsdData.

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.
	// 	The session sends only the script's sha256, and sends the script itself when the API answers that it has
	// 	not seen it yet.
	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 SensorResult ΒΆ

type SensorResult struct {
	// Payload is the sensor data to post.
	Payload string
	// Context must be sent back on the next sensor request of the session.
	Context string
	// ClientHints are the Accept-CH headers for the device the payload describes.
	ClientHints ClientHints
}

SensorResult is returned by Session.GenerateSensorData.

type Session ΒΆ

type Session struct {
	ApiKey      string
	JwtKey      []byte
	AppKey      string
	AppSecret   []byte
	Client      *http.Client
	Compression CompressionType
}

func NewSession ΒΆ

func NewSession(apiKey string) *Session

NewSession creates a new Session that can be used to make requests to the Hyper Solutions API.

func (*Session) GenerateBotIDHeader ΒΆ

func (s *Session) GenerateBotIDHeader(ctx context.Context, input *BotIDHeaderInput) (*BotIDHeaderResult, error)

GenerateBotIDHeader returns the x-is-human header value

func (*Session) GenerateDataDomeInterstitial ΒΆ

func (s *Session) GenerateDataDomeInterstitial(ctx context.Context, input *DataDomeInterstitialInput) (*DataDomeInterstitialResult, error)

GenerateDataDomeInterstitial returns the form data string that is used in the POST request to receive a solved datadome cookie, and the Accept-CH client hints for the device.

func (*Session) GenerateDataDomeSlider ΒΆ

func (s *Session) GenerateDataDomeSlider(ctx context.Context, input *DataDomeSliderInput) (*DataDomeSliderResult, error)

GenerateDataDomeSlider returns the URL that will return a solved datadome cookie when blocked by captcha, and the Accept-CH client hints for the device.

func (*Session) GenerateDataDomeTags ΒΆ

func (s *Session) GenerateDataDomeTags(ctx context.Context, input *DataDomeTagsInput) (*DataDomeTagsResult, error)

GenerateDataDomeTags returns the tags data string that is used in the POST request to receive a solved datadome cookie, and the Accept-CH client hints for the device.

func (*Session) GenerateKasadaPayload ΒΆ

func (s *Session) GenerateKasadaPayload(ctx context.Context, input *KasadaPayloadInput) (*KasadaPayloadResult, error)

GenerateKasadaPayload returns the payload to POST to /tl in bytes, the x-kpsdk-* headers to send with it, and the Accept-CH client hints for the device.

func (*Session) GenerateKasadaPow ΒΆ

func (s *Session) GenerateKasadaPow(ctx context.Context, input *KasadaPowInput) (*KasadaPowResult, error)

GenerateKasadaPow returns the x-kpsdk-cd value

func (*Session) GeneratePixelData ΒΆ

func (s *Session) GeneratePixelData(ctx context.Context, input *PixelInput) (*PixelResult, error)

GeneratePixelData returns the pixel data using the Hyper Solutions API.

func (*Session) GenerateReese84Sensor ΒΆ

func (s *Session) GenerateReese84Sensor(ctx context.Context, input *ReeseInput) (*Reese84Result, error)

GenerateReese84Sensor returns the sensor data required to generate valid reese84 cookies using the Hyper Solutions API, and the Accept-CH client hints for the device.

func (*Session) GenerateSbsdData ΒΆ

func (s *Session) GenerateSbsdData(ctx context.Context, input *SbsdInput) (*SbsdResult, error)

GenerateSbsdData returns the sbsd payload, the context for the next sbsd request, and the Accept-CH client hints for the device, using the Hyper Solutions API.

func (*Session) GenerateSensorData ΒΆ

func (s *Session) GenerateSensorData(ctx context.Context, input *SensorInput) (*SensorResult, error)

GenerateSensorData returns the sensor data required to generate valid akamai cookies using the Hyper Solutions API, the context for the next sensor request, and the Accept-CH client hints for the device.

func (*Session) GenerateTelemetry ΒΆ

func (s *Session) GenerateTelemetry(ctx context.Context, input *TelemetryInput) (*TelemetryResult, error)

GenerateTelemetry returns the value of the Akamai-BM-Telemetry header that the site's protected API calls carry, the context for the next telemetry request, and the Accept-CH client hints for the device, using the Hyper Solutions API. Each protected call takes a fresh header built from the previous call's context.

func (*Session) GenerateUtmvcCookie ΒΆ

func (s *Session) GenerateUtmvcCookie(ctx context.Context, input *UtmvcInput) (*UtmvcResult, error)

GenerateUtmvcCookie returns the utmvc cookie and the swhanedl value using the Hyper Solutions API.

func (*Session) GetKasadaVersion ΒΆ added in v4.1.0

func (s *Session) GetKasadaVersion(ctx context.Context, input *KasadaVersionInput) (*KasadaVersionResult, error)

GetKasadaVersion returns the x-kpsdk-v value of a site's p.js, using the Hyper Solutions API. It is a helper and is not counted as usage.

func (*Session) GetTelemetryParams ΒΆ

func (s *Session) GetTelemetryParams(ctx context.Context, input *TelemetryParamsInput) (*TelemetryParamsResult, error)

GetTelemetryParams returns the path of the site's get_params request, whose response carries the "j" for TelemetryInput.J, and a context that can replace the script on the first telemetry request, using the Hyper Solutions API.

func (*Session) GetUsage ΒΆ added in v4.3.0

func (s *Session) GetUsage(ctx context.Context) (*UsageResult, error)

GetUsage returns the euro balance and the per-plan request quota of the session's API key, using the Hyper Solutions API. It is not counted as usage.

func (*Session) WithClient ΒΆ

func (s *Session) WithClient(client *http.Client) *Session

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 ΒΆ

func (s *Session) WithJwtKey(jwt string) *Session

WithJwtKey adds the JWT Key to the session. If not empty, a signature will be added to each request.

func (*Session) WithOrganization ΒΆ

func (s *Session) WithOrganization(key, secret string) *Session

WithOrganization adds the organization to the session.

type TelemetryInput ΒΆ

type TelemetryInput struct {
	SensorInput

	// J is the "j" from the response of the site's get_params request (see [Session.GetTelemetryParams]), sent
	// as it was returned. Leave it empty when the site makes no get_params request.
	J string `json:"j"`
}

TelemetryInput is the input of Session.GenerateTelemetry: a sensor request for a site that sends an Akamai-BM-Telemetry header on its protected API calls instead of posting sensor data.

Only v3 dynamic scripts send the header, so SensorInput.Version may be left empty. Script and Context chain across headers the same way they do across sensor posts.

func (TelemetryInput) MarshalEasyJSON ΒΆ

func (v TelemetryInput) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TelemetryInput) MarshalJSON ΒΆ

func (v TelemetryInput) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TelemetryInput) UnmarshalEasyJSON ΒΆ

func (v *TelemetryInput) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TelemetryInput) UnmarshalJSON ΒΆ

func (v *TelemetryInput) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type TelemetryParamsInput ΒΆ

type TelemetryParamsInput struct {
	// PageUrl is the page url that loaded the akamai script.
	PageUrl string `json:"pageUrl"`

	// Script is the akamai script, mutually exclusive with [TelemetryParamsInput.Context].
	// 	The session sends only the script's sha256, and sends the script itself when the API answers that it has
	// 	not seen it yet.
	Script string `json:"script"`

	// Context is a context returned by an earlier telemetry or telemetry params request, mutually exclusive with
	// [TelemetryParamsInput.Script].
	Context string `json:"context"`
}

TelemetryParamsInput is the input of Session.GetTelemetryParams.

func (TelemetryParamsInput) MarshalEasyJSON ΒΆ

func (v TelemetryParamsInput) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TelemetryParamsInput) MarshalJSON ΒΆ

func (v TelemetryParamsInput) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TelemetryParamsInput) UnmarshalEasyJSON ΒΆ

func (v *TelemetryParamsInput) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TelemetryParamsInput) UnmarshalJSON ΒΆ

func (v *TelemetryParamsInput) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type TelemetryParamsResult ΒΆ

type TelemetryParamsResult struct {
	// Path is the path of the site's get_params request, exactly as the browser
	// requests it. Send a GET to it on the page's origin; the "j" in its JSON
	// response goes into [TelemetryInput.J].
	Path string
	// Context can replace the script on the first [Session.GenerateTelemetry] request.
	Context string
}

TelemetryParamsResult is returned by Session.GetTelemetryParams.

type TelemetryResult ΒΆ

type TelemetryResult struct {
	// Header is the ready-to-send value of the Akamai-BM-Telemetry header.
	Header string
	// Context must be sent back on the next telemetry request of the session.
	Context string
	// ClientHints are the Accept-CH headers for the device the header describes.
	ClientHints ClientHints
}

TelemetryResult is returned by Session.GenerateTelemetry.

type UsagePlan ΒΆ added in v4.3.0

type UsagePlan struct {
	// Product is the product the plan covers, such as "akamai" or "datadome".
	Product string `json:"product"`
	// RequestsUsed is the number of requests used from the plan.
	RequestsUsed int64 `json:"requestsUsed"`
	// RequestsQuota is the number of requests the plan allows.
	RequestsQuota int64 `json:"requestsQuota"`
	// RequestsRemaining is RequestsQuota minus RequestsUsed.
	RequestsRemaining int64 `json:"requestsRemaining"`
	// ExpiresAt is when the plan expires.
	ExpiresAt time.Time `json:"expiresAt"`
}

UsagePlan is the quota of one plan in a UsageResult.

type UsageResult ΒΆ added in v4.3.0

type UsageResult struct {
	// BalanceEuro is the pay-as-you-go balance in euros.
	BalanceEuro float64 `json:"balanceEuro"`
	// Plans are the plans of the API key, one per product.
	Plans []UsagePlan `json:"plans"`
}

UsageResult is returned by Session.GetUsage.

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

type UtmvcResult ΒΆ

type UtmvcResult struct {
	// Payload is the ___utmvc cookie value.
	Payload string
	// Swhanedl is the swhanedl value for the utmvc request.
	Swhanedl string
}

UtmvcResult is returned by Session.GenerateUtmvcCookie.

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL