iptool

ip locating agent tool

License

License

GroupId

GroupId

com.github.blankhang
ArtifactId

ArtifactId

iptool
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

pom
Description

Description

iptool
ip locating agent tool
Project URL

Project URL

https://github.com/blankhang/iptool
Source Code Management

Source Code Management

https://github.com/blankhang/iptool

Download iptool

Filename Size
iptool-1.1.0.pom 11 KB
Browse

How to add to project

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

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • common

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);

Versions

Version
1.1.0
1.0.9
1.0.5
1.0.1
1.0.0