2021-05-31 23:02:11 +02:00
|
|
|
|
#!/usr/bin/env bash
|
2024-01-06 01:19:35 +01:00
|
|
|
|
|
|
|
|
|
# SPDX-FileCopyrightText: 2021-2022 Simon Bruder <simon@sbruder.de>
|
|
|
|
|
#
|
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
|
2021-05-31 23:02:11 +02:00
|
|
|
|
# This gets the current wireguard relay list from mullvad’s API and transforms
|
|
|
|
|
# it into a format that takes up less space than the original response.
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
curl -s 'https://api.mullvad.net/www/relays/wireguard/' | jq '. | map({
|
2022-09-30 12:02:46 +02:00
|
|
|
|
key: (if .hostname | endswith("-wireguard") then .hostname | split("-")[0] else .hostname | sub("-wg-"; "-") end),
|
2021-05-31 23:02:11 +02:00
|
|
|
|
value: {
|
|
|
|
|
endpoint4: .ipv4_addr_in,
|
|
|
|
|
endpoint6: .ipv6_addr_in,
|
|
|
|
|
pubkey: .pubkey
|
|
|
|
|
}
|
|
|
|
|
}) | from_entries' > relays.json
|