All Projects → stulzq → Iptools

stulzq / Iptools

Licence: mit
Querying IP address information, support longitude and latitude. 快速查询IP信息,支持国内和国外IP信息查询,支持查询经纬度。

Labels

Projects that are alternatives of or similar to Iptools

Koa Ip
Ip filter middleware for koa, support whitelist and blacklist.
Stars: ✭ 37 (-68.1%)
Mutual labels:  ip
Flask weather
☀️ ☔️ Flask app to auto-detect local weather based off of user's IP address.
Stars: ✭ 70 (-39.66%)
Mutual labels:  ip
Orangetool
📚 Control Functions For Single-Board Computers
Stars: ✭ 82 (-29.31%)
Mutual labels:  ip
Ipsubnet
Network calculator for subnet mask and other classless (CIDR) network information. ( GO )
Stars: ✭ 44 (-62.07%)
Mutual labels:  ip
Proxypool
Golang实现的IP代理池
Stars: ✭ 1,134 (+877.59%)
Mutual labels:  ip
Trawl
⛵️ A strong fishing net for dragging along the sea bottom to collect IP addresses and similar flotsam & jetsam
Stars: ✭ 76 (-34.48%)
Mutual labels:  ip
Cdn dig
用于在linux 终端快速查询全国 CDN 调度到哪些区域节点的工具
Stars: ✭ 36 (-68.97%)
Mutual labels:  ip
Country Ip Blocks
CIDR country-level IP data, straight from the Regional Internet Registries, updated hourly.
Stars: ✭ 100 (-13.79%)
Mutual labels:  ip
Pytcp
PyTCP is an attempt to create fully functional TCP/IP stack in Python. It supports TCP stream based transport with reliable packet delivery based on sliding window mechanism and basic congestion control. It also supports IPv6/ICMPv6 protocols with SLAAC address configuration. It operates as user space program attached to Linux TAP interface. As of today stack is able to send and receive traffic over Internet using IPv4 and IPv6 default gateways for routing. Since goal of this project is purely educational (at least at this point) the clarity of code is preferred over its efficiency. For the same reason security features are not being implemented just yet unless they are integral part of TCP/IP suite protocols specification.
Stars: ✭ 65 (-43.97%)
Mutual labels:  ip
Cloudfail
Utilize misconfigured DNS and old database records to find hidden IP's behind the CloudFlare network
Stars: ✭ 1,239 (+968.1%)
Mutual labels:  ip
Lenz
Console based MAP 🗺 : with lots of features 🤩
Stars: ✭ 51 (-56.03%)
Mutual labels:  ip
Ipdata
🌐 An IP lookup system utilizing open datasets
Stars: ✭ 58 (-50%)
Mutual labels:  ip
Ship
A simple, handy network addressing multitool with plenty of features
Stars: ✭ 81 (-30.17%)
Mutual labels:  ip
Lua Libcidr Ffi
LuaJIT FFI bindings to libcidr. Provides CIDR calculations for IPv4 and IPv6.
Stars: ✭ 43 (-62.93%)
Mutual labels:  ip
China Operator Ip
中国运营商IPv4/IPv6地址库-每日更新
Stars: ✭ 1,255 (+981.9%)
Mutual labels:  ip
Laravel Ip Gateway
Laravel IP Gateway
Stars: ✭ 37 (-68.1%)
Mutual labels:  ip
Iplocation
Get ip location information.
Stars: ✭ 70 (-39.66%)
Mutual labels:  ip
Whereami
A short shell script that returns you your IPv4 address and its geolocation.
Stars: ✭ 108 (-6.9%)
Mutual labels:  ip
Lsleases
list assigned ip from any device in your network
Stars: ✭ 88 (-24.14%)
Mutual labels:  ip
Is Google
Verify that a request is from Google crawlers using Google's DNS verification steps
Stars: ✭ 82 (-29.31%)
Mutual labels:  ip

IPTools | 中文文档

Quickly query IP information, support domestic and foreign IP information query, support query latitude and longitude, and support geographical location to the city.

IPTools.China: nuget

IPTools.International: nuget

1. IPTools.China

Quickly query China IP information, country, province, city and network operators. Non China IP can only query national information.

(1) Install

Install-Package IPTools.China

(2) Download database file

https://github.com/stulzq/IPTools/raw/master/db/ip2region.db

After the database file is downloaded, put it in your project root directory (same level as the *.csprj file), and set the copy to the output directory.

1534995762038

At the beginning of version 1.2.0, the database file was unembedded into the assembly, which is convenient for updating and reduces the size of the assembly.

(3) Usage

IpTool.Search("your ip address");

eg.

var ipinfo = IpTool.Search("171.210.12.163");
Console.WriteLine(ipinfo.Country); // 中国
Console.WriteLine(ipinfo.Province); // 四川省
Console.WriteLine(ipinfo.City); // 成都市
Console.WriteLine(ipinfo.NetworkOperator);// 电信

(4) I18N

Not support . So you can't use IpTool.SearchWithI18NAsync().

(5) performance testing

Single thread double for loop queries 65025 IP, takes 170 ms.

(6) Custom DB path

IpToolSettings.ChinaDbPath="";

2. IPTools.International

Quickly query global IP information, support i18n, country, province, city, post code, longitude and latitude.

(1) Install

Install-Package IPTools.International

(2) Download database file

https://github.com/stulzq/IPTools/raw/master/db/GeoLite2-City.mmdb

After the database file is downloaded, put it in your project root directory (same level as the *.csprj file), and set the copy to the output directory.

1534995856116

At the beginning of version 1.2.0, the database file was unembedded into the assembly, which is convenient for updating and reduces the size of the assembly.

(3) Usage

IpTool.Search("your ip address");

eg.

var ipinfo = IpTool.SearchWithI18N("171.210.12.163");
Console.WriteLine(ipinfo.Country); // 中国
Console.WriteLine(ipinfo.CountryCode); // CN
Console.WriteLine(ipinfo.Province); // 四川省
Console.WriteLine(ipinfo.ProvinceCode); // SC
Console.WriteLine(ipinfo.City); // 成都
Console.WriteLine(ipinfo.Latitude); // 30.6667
Console.WriteLine(ipinfo.Longitude); // 104.6667
Console.WriteLine(ipinfo.AccuracyRadius);// 50

(4) I18N

IpTool.SearchWithI18N("your ip address");

eg.

var ipinfo = IpTool.SearchWithI18N("171.210.12.163","en");//If language code is not set, Chinese will be used by default.
Console.WriteLine(ipinfo.Country); // China
Console.WriteLine(ipinfo.CountryCode); // CN
Console.WriteLine(ipinfo.Province); // Sichuan
Console.WriteLine(ipinfo.ProvinceCode); // SC
Console.WriteLine(ipinfo.City); // Chengdu
Console.WriteLine(ipinfo.Latitude); // 30.6667
Console.WriteLine(ipinfo.Longitude); // 104.6667
Console.WriteLine(ipinfo.AccuracyRadius);// 50

Default language is chinese(zh-CN), How to change?

IpToolSettings.DefaultLanguage = "en";// set default language is english.

(5) Increase query speed

With the following settings, will double the query speed, the principle is to fully load the database file into the memory, the price is that the memory will increase 60-70M, space for time, this should be noted.

IpToolSettings.LoadInternationalDbToMemory = true;

Version >= 1.2.0

(6) performance testing

Single thread double for loop queries 65025 IP, takes 1500 ms(Memory).

(7) Custom DB path

IpToolSettings.InternationalDbPath="";

3. ASP.NET Core Support

IPTools provides an extension method for HttpContext.

usage:

HttpContext.GetRemoteIpInfo();
HttpContext.GetRemoteIpInfo(headerKey); // Get ip from header if you use nginx, haproxy etc.

4. Use both IPTools.China and IPTools.International

Both IPTools.China and IPTools.International implement IIpSearcher. The IpTool class will detect the package you installed during initialization and initialize it only once. IpTool has three static read-only properties, namely DefaultSearcher, IpChinaSearcher, IpAllSearcher.

  • DefaultSearcher. IpTool.Search() and IpTool.SearchWithI18N() will use the default Ip searcher.
  • IpChinaSearcher. IPTools.China Implemented searcher.
  • IpAllSearcher. IPTools.International Implemented searcher.

If you just installed IPTools.China then DefaultSearcher will be IpChinaSearcher and IpAllSearcher will be null.

If you just installed IPTools.International then DefaultSearcher will be IpAllSearcher and IpChinaSearcher will be null.

If you have both components installed at the same time, by default DefaultSearcher will be IpChinaSearcher, IpChinaSearcher and IpAllSearcher will not be null.

To change the default Searcher used by DefaultSearcher, please use the following code, if you have two components installed at the same time, it will take effect.

IpToolSettings.DefalutSearcherType = IpSearcherType.China;
IpToolSettings.DefalutSearcherType = IpSearcherType.International;

5. Referencing project

ip2region by lionsoul2014.

GeoIP2-dotnet by maxmind.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].