ip-fetcher is a go library and cli used to retrieve public ip prefixes from popular cloud and hosting providers. Please raise an issue if you have any issues or suggestions for new providers.
- AbuseIPDB
- AWS (Amazon Web Services)
- Bingbot
- Cloudflare
- DigitalOcean
- Fastly
- GCP (Google Cloud Platform)
- Googlebot
- MaxMind GeoIP
- Microsoft Azure
Download the latest release here and then install:
install <ip-fetcher binary> /usr/local/bin/ip-fetcher
use: sudo install
if on linux
ip-fetcher <provider> <options>
for example:
- output aws prefixes to the console:
ip-fetcher aws --stdout
- save gcp prefixes to a file:
ip-fetcher gcp --file prefixes.json
The following example uses the GCP (Google Cloud Platform) provider.
go get github.com/jonhadfield/ip-fetcher/providers/gcp
package main
import (
"fmt"
"github.com/jonhadfield/ip-fetcher/providers/gcp"
)
func main() {
g := gcp.New() // initialise client
doc, err := g.Fetch() // fetch prefixes document
if err != nil {
panic(err)
}
for _, p := range doc.IPv6Prefixes {
fmt.Printf("%s %s %s\n", p.IPv6Prefix.String(), p.Service, p.Scope)
}
}