spoof

package module
v0.0.0-...-5fbf8ec Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 19 Imported by: 0

README

spoof

GoDoc

Spoof is a Go package that provides transport that enables HTTP client requests to look similar to Chrome browser. It tries to achieve this by evading TLS fingerprinting, changing HTTP/2 session parameters, and setting common browser headers.

[!IMPORTANT]
This package is not able to bypass JavaScript-based browser checks or more sophisticated bot detectors.

[!NOTE]
The package is alpha quality, breaking changes will be introduced.

Usage

In order to use the transport, one needs to create a custom http.Client with it specified:

    client := http.Client{
        Transport: &spoof.Transport{},
    }

    // Create a request with desired parameters.

    res, err := client.Do(req)
    if err != nil {
        // ...
    }

    // ...

License

Source code is available under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transport

type Transport struct {
	RootCAs            *x509.CertPool
	InsecureSkipVerify bool
	// contains filtered or unexported fields
}

Transport implements http.RoundTripper with the ability to be fingerprinted as a Chrome browser. It tries to evade TLS fingerprinting and sends common browser headers.

The transport does not overwrite user-specified headers, so the user is able to specify, for example, a custom "Accept-Language" header. Use with care, as this might thwart evasion efforts.

When setting the "Accept-Encoding" header, the user is responsible for decoding the request body.

There's no idle connection pool implemented yet, so the connections are closed after serving a request.

func (*Transport) RoundTrip

func (tr *Transport) RoundTrip(req *http.Request) (*http.Response, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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