Skip to content

Commit fcc23f4

Browse files
committed
Added support for AS domain, AS usage type and AS CIDR
1 parent 2fb0e1a commit fcc23f4

File tree

9 files changed

+326
-140
lines changed

9 files changed

+326
-140
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 - 2024 IP2Location.com
3+
Copyright (c) 2023 - 2025 IP2Location.com
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
1-
[![npm](https://img.shields.io/npm/v/ip2location-nodejs.svg)](http://npm.im/ip2location-nodejs)
2-
[![npm](https://img.shields.io/npm/dm/ip2location-nodejs.svg)](http://npm.im/ip2location-nodejs)
3-
4-
# IP2Location Node.js Module
5-
6-
This Node.js module provides a fast lookup of country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name, mcc, mnc, mobile brand, elevation, usage type, address type, IAB category, district, autonomous system number (ASN) and autonomous system (AS) from IP address by using IP2Location database. This module uses a file based database available at IP2Location.com. This database simply contains IP blocks as keys, and other information such as country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name, mcc, mnc, mobile brand, elevation, usage type, address type, IAB category, district, autonomous system number (ASN) and autonomous system (AS) as values. It supports both IP address in IPv4 and IPv6.
7-
8-
This module can be used in many types of projects such as:
9-
10-
- select the geographically closest mirror
11-
- analyze your web server logs to determine the countries of your visitors
12-
- credit card fraud detection
13-
- software export controls
14-
- display native language and currency
15-
- prevent password sharing and abuse of service
16-
- geotargeting in advertisement
17-
18-
The database will be updated on a monthly basis for greater accuracy.
19-
20-
The complete database is available at https://www.ip2location.com under Premium subscription package.
21-
The free LITE database is available at https://lite.ip2location.com.
22-
23-
As an alternative, this module can also call the IP2Location Web Service. This requires an API key. If you don't have an existing API key, you can subscribe for one at the below:
24-
25-
https://www.ip2location.com/web-service/ip2location
26-
27-
## Developer Documentation
28-
To learn more about installation, usage, and code examples, please visit the developer documentation at [https://ip2location-nodejs.readthedocs.io/en/latest/index.html.](https://ip2location-nodejs.readthedocs.io/en/latest/index.html)
1+
[![npm](https://img.shields.io/npm/v/ip2location-nodejs.svg)](http://npm.im/ip2location-nodejs)
2+
[![npm](https://img.shields.io/npm/dm/ip2location-nodejs.svg)](http://npm.im/ip2location-nodejs)
3+
4+
# IP2Location Node.js Module
5+
6+
This Node.js module provides a fast lookup of country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name, mcc, mnc, mobile brand, elevation, usage type, address type, IAB category, district, autonomous system number (ASN) and autonomous system (AS) from IP address by using IP2Location database. This module uses a file based database available at IP2Location.com. This database simply contains IP blocks as keys, and other information such as country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name, mcc, mnc, mobile brand, elevation, usage type, address type, IAB category, district, autonomous system number (ASN), autonomous system (AS), AS domain, AS usage type and AS CIDR as values. It supports both IP address in IPv4 and IPv6.
7+
8+
This module can be used in many types of projects such as:
9+
10+
- select the geographically closest mirror
11+
- analyze your web server logs to determine the countries of your visitors
12+
- credit card fraud detection
13+
- software export controls
14+
- display native language and currency
15+
- prevent password sharing and abuse of service
16+
- geotargeting in advertisement
17+
18+
The database will be updated on a monthly basis for greater accuracy.
19+
20+
The complete database is available at https://www.ip2location.com under Premium subscription package.
21+
The free LITE database is available at https://lite.ip2location.com.
22+
23+
## Developer Documentation
24+
To learn more about installation, usage, and code examples, please visit the developer documentation at [https://ip2location-nodejs.readthedocs.io/en/latest/index.html.](https://ip2location-nodejs.readthedocs.io/en/latest/index.html)

docs/source/code.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ Retrieve geolocation information for an IP address.
5454
| district | District or county name. |
5555
| asn | Autonomous system number (ASN). BIN databases. |
5656
| as | Autonomous system (AS) name. |
57+
| asDomain | Domain name of the AS registrant. |
58+
| asUsageType | Usage type of the AS registrant. |
59+
| asCidr | CIDR range for the whole AS. |
5760
```
5861

5962
```{py:function} getAllAsync(ipAddress)
@@ -92,6 +95,9 @@ Retrieve geolocation information for an IP address asynchronously.
9295
| district | District or county name. |
9396
| asn | Autonomous system number (ASN). BIN databases. |
9497
| as | Autonomous system (AS) name. |
98+
| asDomain | Domain name of the AS registrant. |
99+
| asUsageType | Usage type of the AS registrant. |
100+
| asCidr | CIDR range for the whole AS. |
95101
```
96102

97103
## IPTools Class

docs/source/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
# -- Project information
77

88
project = 'IP2Location Node.js'
9-
copyright = '2023, IP2Location'
9+
copyright = '2025, IP2Location'
1010
author = 'IP2Location'
1111

12-
release = '1.0.0'
13-
version = '1.0.0'
12+
release = '9.7.0'
13+
version = '9.7.0'
1414

1515
# -- General configuration
1616

docs/source/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![npm](https://img.shields.io/npm/dm/ip2location-nodejs.svg)](http://npm.im/ip2location-nodejs)
33
# IP2Location Node.js Library
44

5-
This Node.js module provides a fast lookup of country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name, mcc, mnc, mobile brand, elevation, usage type, address type, IAB category, district, autonomous system number (ASN) and autonomous system (AS) from IP address by using IP2Location database. This module uses a file based database available at IP2Location.com. This database simply contains IP blocks as keys, and other information such as country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name, mcc, mnc, mobile brand, elevation, usage type, address type, IAB category, district, autonomous system number (ASN) and autonomous system (AS) as values. It supports both IP address in IPv4 and IPv6.
5+
This Node.js module provides a fast lookup of country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name, mcc, mnc, mobile brand, elevation, usage type, address type, IAB category, district, autonomous system number (ASN) and autonomous system (AS) from IP address by using IP2Location database. This module uses a file based database available at IP2Location.com. This database simply contains IP blocks as keys, and other information such as country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name, mcc, mnc, mobile brand, elevation, usage type, address type, IAB category, district, autonomous system number (ASN), autonomous system (AS), AS domain, AS usage type and AS CIDR as values. It supports both IP address in IPv4 and IPv6.
66

77
This module can be used in many types of projects such as:
88

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ip2location-nodejs",
3-
"version": "9.6.3",
3+
"version": "9.7.0",
44
"description": "IP2Location geolocation component",
55
"keywords": [
66
"ip2location",

src/ip2location.d.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ export class IP2Location {
199199
district: string;
200200
asn: string;
201201
as: string;
202+
asDomain: string;
203+
asUsageType: string;
204+
asCidr: string;
202205
};
203206
/**
204207
* Performs validations and returns geolocation data asynchronously.
@@ -235,6 +238,9 @@ export class IP2Location {
235238
district: string;
236239
asn: string;
237240
as: string;
241+
asDomain: string;
242+
asUsageType: string;
243+
asCidr: string;
238244
}>;
239245
/**
240246
* Returns the API version.
@@ -604,6 +610,48 @@ export class IP2Location {
604610
* @returns The promise of the AS.
605611
*/
606612
getASAsync(myIP: string): Promise<string>;
613+
/**
614+
* Returns the AS domain.
615+
*
616+
* @param myIP The IP address to query.
617+
* @returns The AS domain.
618+
*/
619+
getASDomain(myIP: string): string;
620+
/**
621+
* Returns the AS domain asynchronously.
622+
*
623+
* @param myIP The IP address to query.
624+
* @returns The promise of the AS domain.
625+
*/
626+
getASDomainAsync(myIP: string): Promise<string>;
627+
/**
628+
* Returns the AS usage type.
629+
*
630+
* @param myIP The IP address to query.
631+
* @returns The AS usage type.
632+
*/
633+
getASUsageType(myIP: string): string;
634+
/**
635+
* Returns the AS usage type asynchronously.
636+
*
637+
* @param myIP The IP address to query.
638+
* @returns The promise of the AS usage type.
639+
*/
640+
getASUsageTypeAsync(myIP: string): Promise<string>;
641+
/**
642+
* Returns the AS CIDR.
643+
*
644+
* @param myIP The IP address to query.
645+
* @returns The AS CIDR.
646+
*/
647+
getASCidr(myIP: string): string;
648+
/**
649+
* Returns the AS CIDR asynchronously.
650+
*
651+
* @param myIP The IP address to query.
652+
* @returns The promise of the AS CIDR.
653+
*/
654+
getASCidrAsync(myIP: string): Promise<string>;
607655
/**
608656
* Returns all fields.
609657
*
@@ -638,6 +686,9 @@ export class IP2Location {
638686
district: string;
639687
asn: string;
640688
as: string;
689+
asDomain: string;
690+
asUsageType: string;
691+
asCidr: string;
641692
};
642693
/**
643694
* Returns all fields asynchronously.
@@ -673,6 +724,9 @@ export class IP2Location {
673724
district: string;
674725
asn: string;
675726
as: string;
727+
asDomain: string;
728+
asUsageType: string;
729+
asCidr: string;
676730
}>;
677731
#private;
678732
}

0 commit comments

Comments
 (0)