https://github.com/darealfreak/cloudflare-bp-go
round tripper for Go's http library to avoid getting a CloudFlare challenge on the first request
https://github.com/darealfreak/cloudflare-bp-go
cloudflare http-client
Last synced: 11 months ago
JSON representation
round tripper for Go's http library to avoid getting a CloudFlare challenge on the first request
- Host: GitHub
- URL: https://github.com/darealfreak/cloudflare-bp-go
- Owner: DaRealFreak
- License: mit
- Created: 2020-01-01T18:12:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-02-16T14:44:33.000Z (over 4 years ago)
- Last Synced: 2025-05-13T14:23:39.059Z (about 1 year ago)
- Topics: cloudflare, http-client
- Language: Go
- Size: 47.9 KB
- Stars: 59
- Watchers: 4
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go CloudFlare ByPass

[](https://coveralls.io/github/DaRealFreak/cloudflare-bp-go?branch=master)

[](https://goreportcard.com/report/github.com/DaRealFreak/cloudflare-bp-go)
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](https://github.com/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:
```go
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](LICENSE) file for details