GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Mywayking/ipdatabase: 二叉树查询IP地址数据库

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

4 Commits
4 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

Repository files navigation

ipdatabase

一个ip地址数据库

数据

该IP库采用2015年广告协会制定的标准库,是中国互联网广告行业统一采用的IP库。

原理

实现IP查询,首先将10进制IPV4地址转化为二进制构建二叉树,利用二叉树搜索进行搜索,查询速度log2n复杂度,比传统IP库n的复杂度速度高出一个量级。

接口

根据IP查询城市或地区的接口是IpHelper类中的findRegionByIp接口,说明如下:

    /**
     * 静态方法,传入ip地址,返回ip地址所在城市或地区
     * @param ip    IP地址,例:58.30.15.255
     * @return  返回IP地址所在城市或地区,例:北京市
     */
    public static String findRegionByIp(String ip)

example

     public void example() throws Exception {
        String ip = "58.30.15.255";
        String region = IpHelper.findRegionByIp(ip);
        System.out.println(region);
     }

About

二叉树查询IP地址数据库

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.