common

ip locating agent tool

Лицензия

Лицензия

Группа

Группа

com.github.blankhang
Идентификатор

Идентификатор

common
Последняя версия

Последняя версия

1.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

common
ip locating agent tool
Ссылка на сайт

Ссылка на сайт

https://github.com/blankhang/iptool

Скачать common

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.blankhang/common/ -->
<dependency>
    <groupId>com.github.blankhang</groupId>
    <artifactId>common</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.blankhang/common/
implementation 'com.github.blankhang:common:1.1.0'
// https://jarcasting.com/artifacts/com.github.blankhang/common/
implementation ("com.github.blankhang:common:1.1.0")
'com.github.blankhang:common:jar:1.1.0'
<dependency org="com.github.blankhang" name="common" rev="1.1.0">
  <artifact name="common" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.blankhang', module='common', version='1.1.0')
)
libraryDependencies += "com.github.blankhang" % "common" % "1.1.0"
[com.github.blankhang/common "1.1.0"]

Зависимости

compile (7)

Идентификатор библиотеки Тип Версия
com.maxmind.geoip2 : geoip2 jar 2.15.0
org.projectlombok : lombok Необязательный jar 1.18.12
cn.hutool : hutool-all jar 5.5.7
com.squareup.okhttp3 : okhttp jar 4.9.1
org.apache.commons : commons-lang3 jar 3.9
org.apache.tomcat.embed : tomcat-embed-core jar 9.0.35
org.slf4j : slf4j-api jar 1.7.30

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.13.1
org.slf4j : slf4j-nop jar 1.7.30

Модули Проекта

Данный проект не имеет модулей.

iptool

ip locating agent tool ip 定位辅助工具

This work is licensed under

  1. Creative Commons Attribution-ShareAlike 4.0 International License
  2. GeoLite2 End User License Agreement
  3. This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com

how to use 用法

add 添加 maven 依赖

  <dependency>
    <groupId>com.github.blankhang</groupId>
    <artifactId>common</artifactId>
    <version>1.1.0</version>
  </dependency>

this dependency to your pom.xml
then just like this 然后就像这样
support both English and Chinese 支持返回中英文国家/省/州/市名

    // the 1st param support both HttpServletRequest or ip String , the 2nd param support zh-CN(equals to null) or en
    // 第一参数支持 HttpServletRequest 或 字符串的ip ,第二参数为 支持语言 目前支持中文或英文 给null 的话默认返回中文
    String countryName = IpUtil.getCountryName("183.22.183.2", null);
    // or  String countryName = IpUtil.getCountryName("183.22.183.2", "zh-CN");
    //中国
    System.out.println(countryName);
    countryName = IpUtil.getCountryName("183.22.183.2", "en");
    //China
    System.out.println(countryName);

    String stateName = IpUtil.getStateName("183.22.183.2", null);
    // or String stateName = IpUtil.getStateName("183.22.183.2", "zh-CN");
    //广东
    System.out.println(stateName);
    stateName = IpUtil.getStateName("183.22.183.2", "en");
    //Guangdong
    System.out.println(stateName);

    //Guangdong
    String cityName = IpUtil.getCityName("183.22.183.2", null);
    // or String cityName = IpUtil.getCityName("183.22.183.2", "zh-CN");
    //东莞市
    System.out.println(cityName);
    cityName = IpUtil.getCityName("183.22.183.2", "en");
    //Dongguan
    System.out.println(cityName);

Версии библиотеки

Версия
1.1.0
1.0.9
1.0.5
1.0.1
1.0.0