File tree Expand file tree Collapse file tree 3 files changed +38
-1
lines changed
Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ func TestIPString(t *testing.T) {
1616 //nolint:gosec // G115
1717 sec := int64 (metadata .BuildEpoch )
1818 build := time .Unix (sec , 0 ).UTC ().Format (time .RFC3339 )
19- So (build , ShouldEqual , "2026-01-13T23:07:03Z " )
19+ So (build , ShouldEqual , "2026-03-24T08:06:33Z " )
2020
2121 info , ok := IPString (ipStr )
2222 So (ok , ShouldBeTrue )
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Download GeoLite2-Country.mmdb from MaxMind and place it at pkg/util/geoip/GeoLite2-Country.mmdb
4+ # Requires a MaxMind license key set via MAXMIND_LICENSE_KEY environment variable.
5+ # Usage: MAXMIND_LICENSE_KEY=<your_key> ./scripts/sh/download-geolite2-country.sh
6+
7+ set -eu
8+
9+ if [ -z " ${MAXMIND_LICENSE_KEY:- } " ]; then
10+ echo " Error: MAXMIND_LICENSE_KEY environment variable is not set." >&2
11+ exit 1
12+ fi
13+
14+ SCRIPT_DIR=" $( cd " $( dirname " $0 " ) " && pwd) "
15+ REPO_ROOT=" $( cd " $SCRIPT_DIR /../.." && pwd) "
16+ DEST=" $REPO_ROOT /pkg/util/geoip/GeoLite2-Country.mmdb"
17+
18+ TMPDIR=" $( mktemp -d) "
19+ trap ' rm -rf "$TMPDIR"' EXIT
20+
21+ DOWNLOAD_URL=" https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${MAXMIND_LICENSE_KEY} &suffix=tar.gz"
22+ ARCHIVE=" $TMPDIR /GeoLite2-Country.tar.gz"
23+
24+ echo " Downloading GeoLite2-Country..."
25+ curl -fsSL " $DOWNLOAD_URL " -o " $ARCHIVE "
26+
27+ echo " Extracting..."
28+ tar -xzf " $ARCHIVE " -C " $TMPDIR "
29+
30+ MMDB=" $( find " $TMPDIR " -name ' GeoLite2-Country.mmdb' | head -n 1) "
31+ if [ -z " $MMDB " ]; then
32+ echo " Error: GeoLite2-Country.mmdb not found in archive." >&2
33+ exit 1
34+ fi
35+
36+ cp " $MMDB " " $DEST "
37+ echo " Done: $DEST "
You can’t perform that action at this time.
0 commit comments