From 2cc6a1eb600a9efe82846ada47236dc9082bdc96 Mon Sep 17 00:00:00 2001 From: Aurora Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Sat, 3 Dec 2022 10:24:01 +0200 Subject: [PATCH] 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 --- .../plan/gathering/geolocation/GeoLite2Geolocator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/gathering/geolocation/GeoLite2Geolocator.java b/Plan/common/src/main/java/com/djrapitops/plan/gathering/geolocation/GeoLite2Geolocator.java index 07290556f..de5221191 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/gathering/geolocation/GeoLite2Geolocator.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/gathering/geolocation/GeoLite2Geolocator.java @@ -131,6 +131,7 @@ public class GeoLite2Geolocator implements Geolocator { public Optional getCountry(InetAddress inetAddress) { if (inetAddress == null) return Optional.empty(); if (inetAddress.getHostAddress().contains("127.0.0.1")) return Optional.of("Local Machine"); + if (inetAddress.isSiteLocalAddress()) return Optional.of("Local Private Network"); try ( // See https://github.com/maxmind/MaxMind-DB-Reader-java#file-lock-on-windows