mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 09:35:29 +08:00
update IP地址行政区域助手类重命名以匹配其工具类的功能定位
This commit is contained in:
parent
cbe576ecfa
commit
455ec9a2f1
@ -37,7 +37,7 @@ public class AddressUtils {
|
||||
return LOCAL_ADDRESS;
|
||||
}
|
||||
// Tips:Ip2Region 提供了精简的IPv6地址库,精简的IPv6地址库并不能完全支持IPv6地址的查询,且准确度上可能会存在问题,如需要准确的IPv6地址查询,建议自行实现
|
||||
return Ip2RegionHelper.getRegion(ip);
|
||||
return RegionUtils.getRegion(ip);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -13,14 +13,14 @@ import java.io.File;
|
||||
import java.time.Duration;
|
||||
|
||||
/**
|
||||
* IP地址行政区域助手工具类
|
||||
* IP地址行政区域工具类
|
||||
* 参考地址:<a href="https://gitee.com/lionsoul/ip2region/tree/master/binding/java">ip2region xdb java 查询客户端实现</a>
|
||||
* xdb数据库文件下载:<a href="https://gitee.com/lionsoul/ip2region/tree/master/data">ip2region data</a>
|
||||
*
|
||||
* @author 秋辞未寒
|
||||
*/
|
||||
@Slf4j
|
||||
public class Ip2RegionHelper {
|
||||
public class RegionUtils {
|
||||
|
||||
// 默认IPv4地址库文件路径
|
||||
// 下载地址:https://gitee.com/lionsoul/ip2region/blob/master/data/ip2region_v4.xdb
|
||||
@ -53,11 +53,11 @@ public class Ip2RegionHelper {
|
||||
// Config v6Config = Config.custom()
|
||||
// .setCachePolicy(Config.BufferCache)
|
||||
// .setXdbPath(v6TempXdb.getPath())
|
||||
// .asV6(FileUtil.createRandomAccessFile(v6TempXdb, FileMode.r));
|
||||
// .asV6();
|
||||
|
||||
// 初始化Ip2Region实例
|
||||
Ip2RegionHelper.ip2Region = Ip2Region.create(v4Config, null);
|
||||
// Ip2RegionHelper.ip2Region = Ip2Region.create(v4Config, v6Config);
|
||||
RegionUtils.ip2Region = Ip2Region.create(v4Config, null);
|
||||
// RegionUtils.ip2Region = Ip2Region.create(v4Config, v6Config);
|
||||
|
||||
// 删除临时文件
|
||||
// 注意:因为使用的 CachePolicy 为 BufferCache,BufferCache是加载整个xdb文件到内存中,所以临时文件的删除不会影响到正常的使用。如果使用的是 VIndexCache 或 NoCache(即实时读取文件),删除临时文件会导致xdb数据库读取不到而无法使用。
|
||||
Loading…
Reference in New Issue
Block a user