|
2 | 2 |
|
3 | 3 | Simple cli to get CIDR list from well known providers
|
4 | 4 |
|
5 |
| -## List IPs from following providers: |
| 5 | +## Available Providers |
6 | 6 |
|
7 |
| -- akamai (origin IP acl) |
8 |
| -- aws |
9 |
| -- cloudflare |
10 |
| -- gcp |
11 |
| -- google |
| 7 | +| Provider name | Constant name | Source of IP addresses | |
| 8 | +| :- | :- | :- | |
| 9 | +| `akamai` | `cidrlist.ProviderAkamai` | [Akamai Origin IP ACL](https://techdocs.akamai.com/origin-ip-acl/docs/welcome) | |
| 10 | +| `aws` | `cidrlist.ProviderAWS` | [AWS IP Address Ranges](https://docs.aws.amazon.com/vpc/latest/userguide/aws-ip-ranges.html) | |
| 11 | +| `cloudflare` | `cidrlist.ProviderCloudflare` | [Cloudflare IP Ranges](https://www.cloudflare.com/ips/) | |
| 12 | +| `gcp` | `cidrlist.ProviderGCP` | [Google Cloud Global & Regional IP Address Ranges](https://support.google.com/a/answer/10026322?hl=en) | |
| 13 | +| `google` | `cidrlist.ProviderGoogle` | [Google IP Address Ranges](https://support.google.com/a/answer/10026322?hl=en) | |
12 | 14 |
|
13 | 15 | ## Usage
|
14 | 16 |
|
15 |
| -```bash |
16 |
| -usage: cidrlist <command> [<args> ...] |
| 17 | +Install the library using the following command: |
17 | 18 |
|
18 |
| -A command-line tool to fetch IP address ranges from well known providers. |
| 19 | +```go |
| 20 | +go get -u github.com/franzramadhan/cidrlist |
| 21 | +``` |
| 22 | + |
| 23 | +Implementation example: |
| 24 | + |
| 25 | +```go |
| 26 | +package main |
| 27 | + |
| 28 | +import ( |
| 29 | + "fmt" |
| 30 | + |
| 31 | + "github.com/franzramadhan/cidrlist" |
| 32 | +) |
19 | 33 |
|
| 34 | +func main() { |
| 35 | + ips, err := cidrlist.Get(cidrlist.ProviderAWS) |
| 36 | + if err != nil { |
| 37 | + fmt.Println(err) |
| 38 | + return |
| 39 | + } |
20 | 40 |
|
21 |
| -Flags: |
22 |
| - --[no-]help Show context-sensitive help (also try --help-long and --help-man). |
| 41 | + fmt.Printf("IP of provider %s:\n", cidrlist.ProviderAWS) |
| 42 | + for _, ip := range ips { |
| 43 | + fmt.Println(ip) |
| 44 | + } |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +## CLI Usage |
| 49 | + |
| 50 | +Install cidrlist CLI using the following command: |
| 51 | + |
| 52 | +```go |
| 53 | +go install github.com/franzramadhan/cidrlist/cmd/cidrlist@latest |
| 54 | +``` |
23 | 55 |
|
24 |
| -Commands: |
25 |
| -help [<command>...] |
26 |
| - Show help. |
| 56 | +Usage: |
27 | 57 |
|
28 |
| -get <provider> |
29 |
| - Get IP from provider (cloudflare, akamai, aws, gcp, and google). |
| 58 | +```go |
| 59 | +cidrlist get <provider-name> |
| 60 | +cidrlist get cloudflare |
| 61 | +cidrlist get gcp |
30 | 62 | ```
|
0 commit comments