From 8131903678436ca6e556c98ae3b6688e4d602f56 Mon Sep 17 00:00:00 2001 From: lihongjie0209 Date: Wed, 22 Nov 2023 18:00:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E6=97=A0=E7=94=A8=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 10 +++++----- src/main/java/cn/lihongjie/coal/ip/IpQueryService.java | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 20606771..782e434c 100644 --- a/pom.xml +++ b/pom.xml @@ -310,13 +310,13 @@ commons-io 2.11.0 - + - com.maxmind.geoip2 - geoip2 - 2.15.0 + + + - + diff --git a/src/main/java/cn/lihongjie/coal/ip/IpQueryService.java b/src/main/java/cn/lihongjie/coal/ip/IpQueryService.java index 1beadb85..9b5994a3 100644 --- a/src/main/java/cn/lihongjie/coal/ip/IpQueryService.java +++ b/src/main/java/cn/lihongjie/coal/ip/IpQueryService.java @@ -1,6 +1,5 @@ package cn.lihongjie.coal.ip; -import com.maxmind.geoip2.DatabaseReader; import jakarta.annotation.PostConstruct; @@ -29,7 +28,6 @@ class IpQueryService { @Value("${geolite2.url}") private String geolite2DownloadUrl; - private DatabaseReader reader; @Value("classpath:ip/ip2region.xdb") Resource dbFile; private Searcher searcher; @@ -67,7 +65,7 @@ class IpQueryService { @SneakyThrows public String query(String ipaddr) { - if (reader != null) { + if (searcher != null) { InetAddress ipAddress = InetAddress.getByName(ipaddr); if (ipAddress.isAnyLocalAddress()) { return "服务器本机地址";