Skip to content

Commit

Permalink
Feat: get CIDR data by using json input format instead of jq
Browse files Browse the repository at this point in the history
  • Loading branch information
Loyalsoldier committed Aug 10, 2024
1 parent 55d12b3 commit ffa1a31
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ jobs:
echo "RELEASE_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
shell: bash

- name: Append more CIDRs
run: |
mkdir -p data
curl -sSL https://www.gstatic.com/ipranges/goog.json | jq --raw-output '.prefixes[].ipv4Prefix,.prefixes[].ipv6Prefix | select(. != null)' >> data/google
curl -sSL https://www.gstatic.com/ipranges/cloud.json | jq --raw-output '.prefixes[].ipv4Prefix,.prefixes[].ipv6Prefix | select(. != null)' >> data/google
curl -sSL https://api.fastly.com/public-ip-list | jq --raw-output '.addresses[],.ipv6_addresses[]' >> data/fastly
curl -sSL https://ip-ranges.amazonaws.com/ip-ranges.json | jq --raw-output '.prefixes[],.ipv6_prefixes[] | select(.service == "CLOUDFRONT") | .ip_prefix,.ipv6_prefix' | grep "/" >> data/cloudfront
- name: Get GeoLite2
env:
LICENSE_KEY: ${{ secrets.MAXMIND_GEOLITE2_LICENSE }}
Expand Down
36 changes: 34 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,42 @@
}
},
{
"type": "text",
"type": "json",
"action": "add",
"args": {
"inputDir": "./data"
"name": "google",
"uri": "https://www.gstatic.com/ipranges/goog.json",
"jsonPath": ["prefixes.#.ipv4Prefix", "prefixes.#.ipv6Prefix"]
}
},
{
"type": "json",
"action": "add",
"args": {
"name": "google",
"uri": "https://www.gstatic.com/ipranges/cloud.json",
"jsonPath": ["prefixes.#.ipv4Prefix", "prefixes.#.ipv6Prefix"]
}
},
{
"type": "json",
"action": "add",
"args": {
"name": "fastly",
"uri": "https://api.fastly.com/public-ip-list",
"jsonPath": ["addresses", "ipv6_addresses"]
}
},
{
"type": "json",
"action": "add",
"args": {
"name": "cloudfront",
"uri": "https://ip-ranges.amazonaws.com/ip-ranges.json",
"jsonPath": [
"prefixes.#(service==\"CLOUDFRONT\")#.ip_prefix",
"ipv6_prefixes.#(service==\"CLOUDFRONT\")#.ipv6_prefix"
]
}
},
{
Expand Down

0 comments on commit ffa1a31

Please sign in to comment.