diff options
| author | Loyalsoldier <[email protected]> | 2024-08-10 08:51:19 +0800 |
|---|---|---|
| committer | Loyalsoldier <[email protected]> | 2024-08-10 09:03:41 +0800 |
| commit | ffa1a3145e05eb2c02738e5b5f9ce45609edc5fa (patch) | |
| tree | 34ebda32bb1392b1ea1ff7a51f6a4144b10205d2 | |
| parent | 55d12b35087ba35e9bd6411342702da22542ec82 (diff) | |
Feat: get CIDR data by using json input format instead of jq
| -rw-r--r-- | .github/workflows/build.yml | 8 | ||||
| -rw-r--r-- | config.json | 36 |
2 files changed, 34 insertions, 10 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3ff506c..c7511f7b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 }} diff --git a/config.json b/config.json index e75942f0..3a17cf4d 100644 --- a/config.json +++ b/config.json @@ -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" + ] } }, { |
