Giter VIP home page Giter VIP logo

iplocate's Introduction

iplocate

ip transfer to location.

ipv4 -> 地区码

http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/ 国家统计局 《统计用区划和城乡划分代码》

国家统计局 行政区代码 解释

统计用区划代码和城乡划分代码编制规则

http://www.stats.gov.cn/tjsj/tjbz/200911/t20091125_8667.html

组成格式如: {省}{市}{区/县}{乡}{村} ,共由17位数字表示。

第1~2位,为省级代码
第3~4 位,为地级代码
第5~6位,为县级代码
第7~9位,为乡级代码
第10~12位,为村级代码

以 130107200008 为例:

13 : 河北省
01 : 石家庄市
07 : 井陉矿区
200 : 横涧乡
008 : 青泉居委会

设计思路

总体分为 维护部分、应用部分。 两者间的数据采用文件形式传输

维护部分

通过各种手段,维护IP到地区代码的对应关系,并生成离线数据文件。

应用部分

加载数据文件到程序的内存,通过算法查询IP到地区代码的对应关系。 为了方便计算,将IP字符串转化为数字进行比较。

数据文件格式

  1. 文件采用 csv 格式, 方便查看检查
  2. 支持IP数字地址格式
  3. 支持IPV4字符串格式
开始IP,结束IP,地区代码,地区描述信息
43.255.144.0,43.255.144.220,110100000000,北京市辖区
17629184,17647615,110100000000,北京市辖区

iplocate's People

Contributors

lovestreet avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.