Documentation
¶
Overview ¶
Package cloudflareips holds Cloudflare's published proxy ranges: an embedded snapshot that is always usable, refreshed from the official endpoint.
Index ¶
Constants ¶
const ( SourceEmbedded = "embedded" SourceFetched = "fetched" )
Source names where the active list came from.
const Endpoint = "https://api.cloudflare.com/client/v4/ips"
Endpoint is the only URL ever fetched; it is fixed so no setting can turn the refresh into an SSRF.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type List ¶
type List struct {
// contains filtered or unexported fields
}
List is a concurrency-safe set of Cloudflare ranges.
func Default ¶
func Default() *List
Default is the process-wide list shared by the ingress, Shield and the API.
func (*List) Refresh ¶
Refresh fetches the official list once and keeps the previous list on any failure. It reports whether the active ranges changed.
func (*List) Run ¶
func (l *List) Run(ctx context.Context, limits func(context.Context) Limits, next func(context.Context) time.Duration, onChange func())
Run refreshes at once, then on the interval returned by next (read again each round so a stored change applies live) until ctx ends. A failed attempt retries after a quarter of the interval so a boot-time network blip does not cost a whole day. onChange runs when the active ranges changed.