Migrate to GEO IP 2 (Related #1471) (#1529)

* Migrate to GEO IP 2, because support will drop in April

* Change all links of maxmind to https
* Update maxmind database dependency and add javatar to extract
the database from the tar archive
(now only a small difference in jar file size -> ~80KB smaller)
* Verify downloaded archive using MD5 (There are no other checksums available)
* Migrate to Java NIO instead of old java file I/O (Feedback?)
* Internal Optional usage for nullable values (Feedback?)

Minor:
* Schedule a Bukkit async task instead of creating a thread manually
* Validate ip input string
* Extract validation into single method
* Close all resources safely using try-resources

* More https links

* Add documentation

* Set the same last modification as in the tar archive

* Fix tests

* Comment how the legacy API responded to unknown entries

* Document missing function param

* Document our maxmind dependency modifications

* Include time unit into constant

* More logging for downloading the database

* Add missing return if the database cannot be found

* Delete temporarily file after working with it
This commit is contained in:
games647
2018-03-17 03:00:24 +01:00
committed by Gabriele C
parent 7ff5801cfe
commit f33446ee25
6 changed files with 262 additions and 107 deletions
@@ -22,7 +22,7 @@ public final class ProtectionSettings implements SettingsHolder {
@Comment({
"Countries allowed to join the server and register. For country codes, see",
"http://dev.maxmind.com/geoip/legacy/codes/iso3166/",
"https://dev.maxmind.com/geoip/legacy/codes/iso3166/",
"PLEASE USE QUOTES!"})
public static final Property<List<String>> COUNTRIES_WHITELIST =
newListProperty("Protection.countries", "US", "GB");