Documentation
¶
Overview ¶
Package cloud fetches the IP ranges that cloud providers publish (AWS, Google Cloud, Cloudflare) and answers "which provider/region owns this address?". Standard library only. Nothing is fetched at import time; callers decide when to refresh and should cache the result.
Index ¶
Constants ¶
View Source
const ( DefaultAWSURL = "https://ip-ranges.amazonaws.com/ip-ranges.json" DefaultGCPURL = "https://www.gstatic.com/ipranges/cloud.json" DefaultCloudflareV4URL = "https://www.cloudflare.com/ips-v4" DefaultCloudflareV6URL = "https://www.cloudflare.com/ips-v6" )
Official feed locations.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Prefix netip.Prefix
Provider Provider
Region string // empty when the feed has none
Service string
}
Entry is one published prefix.
type Fetcher ¶
type Fetcher struct {
Client *http.Client
AWSURL, GCPURL string
CloudflareV4URL, CloudflareV6URL string
// MaxBytes caps each response body (default 32 MiB).
MaxBytes int64
}
Fetcher downloads feeds. The zero value uses http.DefaultClient and the official URLs; override fields for proxies, mirrors or tests.
func (*Fetcher) Cloudflare ¶
Cloudflare fetches the plain-text ips-v4 and ips-v6 lists.
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index answers ownership queries. Immutable after NewIndex; safe for concurrent use.
Click to show internal directories.
Click to hide internal directories.