https://github.com/dhowden/ipranges
ipranges
https://github.com/dhowden/ipranges
Last synced: about 1 year ago
JSON representation
ipranges
- Host: GitHub
- URL: https://github.com/dhowden/ipranges
- Owner: dhowden
- License: mit
- Created: 2022-06-29T13:23:13.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-29T22:31:48.000Z (almost 4 years ago)
- Last Synced: 2025-01-30T03:15:14.121Z (over 1 year ago)
- Language: Go
- Size: 6.84 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ipranges tool
Google Cloud publishes a JSON-formatted list of customer-usable global and regional external IP address ranges here: https://www.gstatic.com/ipranges/cloud.json.
This tool fetches that data and provides filtering by region prefix, and other useful options (IPv6, IPv4 etc).
## Installing the tool
```console
$ go install github.com/dhowden/ipranges/cmd/ipranges@latest
$ ipranges -h
Usage of ipranges:
-fetch-timeout duration
timeout after duration (default 5s)
-ipv4
show IPv4 addresses (default true)
-ipv6
show IPv6 addresses (default true)
-region string
prefix of region to match
-regions
only list regions
```
## List the regions
```console
$ ipranges -regions
asia-east1
asia-east2
asia-northeast1
asia-northeast2
...
```
## List IP ranges for specific region prefixes
For the `us-central2` region:
```console
$ ipranges -region us-central2
107.167.160.0/20
108.59.88.0/21
...
```
For all `us-central` regions:
```console
$ ipranges -region us-central
104.154.113.0/24
104.154.114.0/23
...
```
Exclude IPv6 addresses:
```console
$ ipranges -region us-central2 -ipv6=false
107.167.160.0/20
108.59.88.0/21
...
```
Exclude IPv4 addresses
```console
$ ipranges -region us-central2 -ipv4=false
2600:1900:4070::/44
```