代码拉取完成,页面将自动刷新
同步操作将从 如梦技术/mica 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
mica-ip2region
是 ip2region
的封装,方便 spring boot
用户使用。
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-ip2region</artifactId>
<version>${version}</version>
</dependency>
compile("net.dreamlu:mica-ip2region:${version}")
配置项 | 默认值 | 说明 |
---|---|---|
mica.ip2region.db-file-location | classpath:ip2region/ip2region.db | ip2region.db 文件的地址,默认内置的文件 |
maven 自定义 ip2region.db 注意事项:
maven resources
拷贝文件是默认会做 filter
,会导致我们的文件发生变化,导致不能读,pom
中你需要添加下面的配置。
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>db</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
Gitee:https://gitee.com/lionsoul/ip2region
一般我们都会同步更新 ip2region.db
文件,不需要手动配置。
@Autowired
private Ip2regionSearcher regionSearcher;
/**
* ip 位置 搜索
*
* @param ip ip
* @return 位置
*/
@Nullable
IpInfo memorySearch(long ip);
/**
* ip 位置 搜索
*
* @param ip ip
* @return 位置
*/
@Nullable
IpInfo memorySearch(String ip);
/**
* ip 位置 搜索
*
* @param ptr ptr
* @return 位置
*/
@Nullable
IpInfo getByIndexPtr(long ptr);
/**
* ip 位置 搜索
*
* @param ip ip
* @return 位置
*/
@Nullable
IpInfo btreeSearch(long ip);
/**
* ip 位置 搜索
*
* @param ip ip
* @return 位置
*/
@Nullable
IpInfo btreeSearch(String ip);
/**
* ip 位置 搜索
*
* @param ip ip
* @return 位置
*/
@Nullable
IpInfo binarySearch(long ip);
/**
* ip 位置 搜索
*
* @param ip ip
* @return 位置
*/
@Nullable
IpInfo binarySearch(String ip);
/**
* 城市id
*/
private Integer cityId;
/**
* 国家
*/
private String country;
/**
* 区域
*/
private String region;
/**
* 省
*/
private String province;
/**
* 城市
*/
private String city;
/**
* 运营商
*/
private String isp;
/**
* region ptr in the db file
*/
private int dataPtr;
/**
* 拼接完整的地址
*
* @return address
*/
public String getAddress();
/**
* 拼接完整的地址
*
* @return address
*/
public String getAddressAndIsp();
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。