Simple cli to get CIDR list from well known providers
Provider name | Constant name | Source of IP addresses |
---|---|---|
akamai |
cidrlist.ProviderAkamai |
Akamai Origin IP ACL |
aws |
cidrlist.ProviderAWS |
AWS IP Address Ranges |
cloudflare |
cidrlist.ProviderCloudflare |
Cloudflare IP Ranges |
gcp |
cidrlist.ProviderGCP |
Google Cloud Global & Regional IP Address Ranges |
google |
cidrlist.ProviderGoogle |
Google IP Address Ranges |
Install the library using the following command:
go get -u github.com/franzramadhan/cidrlist
Implementation example:
package main
import (
"fmt"
"github.com/franzramadhan/cidrlist"
)
func main() {
ips, err := cidrlist.Get(cidrlist.ProviderAWS)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("IP of provider %s:\n", cidrlist.ProviderAWS)
for _, ip := range ips {
fmt.Println(ip)
}
}
Install cidrlist CLI using the following command:
go install github.com/franzramadhan/cidrlist/cmd/cidrlist@latest
Usage:
cidrlist get <provider-name>
cidrlist get cloudflare
cidrlist get gcp