mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-25 10:37:51 +01:00
Detect local private network addresses in geolocations
Detects IPs from the local network that were previously set as 'Not Found' https://en.wikipedia.org/wiki/Private_network Affects issues: - Close #2658
This commit is contained in:
parent
d2eae82ca8
commit
2cc6a1eb60
@ -131,6 +131,7 @@ public class GeoLite2Geolocator implements Geolocator {
|
|||||||
public Optional<String> getCountry(InetAddress inetAddress) {
|
public Optional<String> getCountry(InetAddress inetAddress) {
|
||||||
if (inetAddress == null) return Optional.empty();
|
if (inetAddress == null) return Optional.empty();
|
||||||
if (inetAddress.getHostAddress().contains("127.0.0.1")) return Optional.of("Local Machine");
|
if (inetAddress.getHostAddress().contains("127.0.0.1")) return Optional.of("Local Machine");
|
||||||
|
if (inetAddress.isSiteLocalAddress()) return Optional.of("Local Private Network");
|
||||||
|
|
||||||
try (
|
try (
|
||||||
// See https://github.com/maxmind/MaxMind-DB-Reader-java#file-lock-on-windows
|
// See https://github.com/maxmind/MaxMind-DB-Reader-java#file-lock-on-windows
|
||||||
|
Loading…
Reference in New Issue
Block a user