cloudflarebp

package module
v0.0.0-...-17ff528 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: MIT Imports: 3 Imported by: 0

README

Go CloudFlare ByPass

tests Coverage Status GitHub Go Report Card

small round tripper to avoid triggering the "attention required" status of CloudFlare for HTTP requests. It'll add required/validated headers on requests and update the client TLS configuration to pass the CloudFlare validation.

This is (at least so far) NOT intended to solve challenges provided by CloudFlare, only to prevent CloudFlare from directly displaying you a challenge on the first request.

The bypass is tested on a schedule everyday at 3 AM in case CloudFlare updated their detection, so the badge is always displaying if the bypass still works.

Dependencies

  • eddycjy/fake-useragent - for setting a believable request user agent. CloudFlare is relatively forgiving with the user agents anyways but it'll add some variety for the long term.

Usage

You can add the round tripper as any other round tripper:

client := &http.Client{}
client.Transport = cloudflarebp.AddCloudFlareByPass(client.Transport)

small notice:
Using the http.DefaultTransport will currently still fail, nil or empty &http.Transport works. Didn't have the time to check what exactly is different causing the CloudFlare validation to fail though.

Development

Want to contribute? Great!
I'm always glad hearing about bugs or pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details

Documentation

Overview

Package cloudflarebp provides a round tripper to not get detected by CloudFlare directly on the first HTTP request The round tripper will add required/validated request headers and updates the client TLS configuration It'll NOT solve challenges provided by CloudFlare, just prevent from being detected on the first request

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCloudFlareByPass

func AddCloudFlareByPass(inner http.RoundTripper, options ...Options) http.RoundTripper

AddCloudFlareByPass returns a round tripper adding the required headers for the CloudFlare checks and updates the TLS configuration of the passed inner transport.

Types

type Options

type Options struct {
	AddMissingHeaders bool
	Headers           map[string]string
}

Options the option to set custom headers

func GetDefaultOptions

func GetDefaultOptions() Options

GetDefaultOptions returns the options set by default

Jump to

Keyboard shortcuts

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