Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sch8ill/cloudflare-ips
Automatically fetch and update Cloudflare proxy IPs, ensuring your trusted proxies are always up to date.
https://github.com/sch8ill/cloudflare-ips
cloudflare cloudflare-api gin gin-gonic go golang http http-server library
Last synced: 16 days ago
JSON representation
Automatically fetch and update Cloudflare proxy IPs, ensuring your trusted proxies are always up to date.
- Host: GitHub
- URL: https://github.com/sch8ill/cloudflare-ips
- Owner: Sch8ill
- License: mit
- Created: 2024-10-21T00:08:00.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2024-10-21T23:06:17.000Z (2 months ago)
- Last Synced: 2024-11-22T18:03:04.279Z (about 1 month ago)
- Topics: cloudflare, cloudflare-api, gin, gin-gonic, go, golang, http, http-server, library
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cloudflare-ips
[![Release](https://img.shields.io/github/release/sch8ill/cloudflare-ips.svg?style=flat-square)](https://github.com/sch8ill/cloudflare-ips/releases)
[![doc](https://img.shields.io/badge/go.dev-doc-007d9c?style=flat-square&logo=read-the-docs)](https://pkg.go.dev/github.com/sch8ill/cloudflare-ips)
[![Go Report Card](https://goreportcard.com/badge/github.com/sch8ill/cloudflare-ips)](https://goreportcard.com/report/github.com/sch8ill/cloudflare-ips)
![MIT license](https://img.shields.io/badge/license-MIT-green)---
Automatically fetch and update Cloudflare proxy IPs, ensuring your trusted proxies are always up to date.
---
## Installation
```bash
go get github.com/sch8ill/cloudflare-ips
```---
## Usage
```go
package mainimport (
"time""github.com/gin-gonic/gin"
cloudflareips "github.com/sch8ill/cloudflare-ips"
)func main() {
r := gin.Default()// Set the current clouflare reverse proxies as trusted.
r.SetTrustedProxies(cloudflareips.MustFetch())// OR
// Start a go routine that updates the trusted proxies list every 24 hours.
cloudflareips.Updater(time.Hour*24, r.SetTrustedProxies)r.GET("/", func(c *gin.Context) {
c.String(200, "Hello World!")
})r.Run()
}
```## License
This package is licensed under the [MIT License](LICENSE).