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: 11 months 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 (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-10-21T23:06:17.000Z (over 1 year ago)
- Last Synced: 2025-03-29T15:12:41.971Z (11 months 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
[](https://github.com/sch8ill/cloudflare-ips/releases)
[](https://pkg.go.dev/github.com/sch8ill/cloudflare-ips)
[](https://goreportcard.com/report/github.com/sch8ill/cloudflare-ips)

---
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 main
import (
"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).