mirror of
https://github.com/mpolden/echoip.git
synced 2024-11-10 07:27:22 +01:00
parent
b3e0079aa4
commit
a7ff603ab1
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1 @@
|
||||
/GeoLite2-Country.mmdb
|
||||
/GeoLite2-City.mmdb
|
||||
/data/
|
||||
|
17
Makefile
17
Makefile
@ -1,3 +1,8 @@
|
||||
OS := $(shell uname)
|
||||
ifeq ($(OS),Linux)
|
||||
TAR_OPTS := --wildcards
|
||||
endif
|
||||
|
||||
all: deps test vet install
|
||||
|
||||
fmt:
|
||||
@ -15,6 +20,12 @@ deps:
|
||||
install:
|
||||
go install
|
||||
|
||||
get-geoip-dbs:
|
||||
curl -s http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz | gunzip > GeoLite2-Country.mmdb
|
||||
curl -s http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz | gunzip > GeoLite2-City.mmdb
|
||||
databases := GeoLite2-City GeoLite2-Country
|
||||
|
||||
$(databases):
|
||||
mkdir -p data
|
||||
curl -fsSL -m 30 http://geolite.maxmind.com/download/geoip/database/$@.tar.gz | tar $(TAR_OPTS) --strip-components=1 -C $(PWD)/data -xzf - '*.mmdb'
|
||||
test ! -f data/GeoLite2-City.mmdb || mv data/GeoLite2-City.mmdb data/city.mmdb
|
||||
test ! -f data/GeoLite2-Country.mmdb || mv data/GeoLite2-Country.mmdb data/country.mmdb
|
||||
|
||||
geoip-download: $(databases)
|
||||
|
Loading…
Reference in New Issue
Block a user