Switch GeoIP database from MaxMind to IP2Location.

The IP2Location data is licensed under CC BY-SA, which
allows us to distribute the database with releases.
This commit is contained in:
Paul Chote
2020-04-12 14:36:35 +01:00
committed by abcdefg30
parent 6828c4c1e9
commit 9c4faddc0f
15 changed files with 137 additions and 74 deletions

21
fetch-geoip.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
# Download the IP2Location country database for use by the game server
####
# This file must stay /bin/sh and POSIX compliant for macOS and BSD portability.
# Copy-paste the entire script into http://shellcheck.net to check.
####
# Set the working directory to the location of this script
cd "$(dirname "$0")" || exit 1
# Database does not exist or is older than 30 days.
if [ -z "$(find . -path ./IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP -mtime -30 -print)" ]; then
rm -f IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP
echo "Downloading IP2Location GeoIP database."
if command -v curl >/dev/null 2>&1; then
curl -s -L -O https://download.ip2location.com/lite/IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP || echo "Warning: Download failed"
else
wget -cq https://download.ip2location.com/lite/IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP || echo "Warning: Download failed"
fi
fi