Skip to content

Commit f41bf98

Browse files
Fixed boundary IP cases. Fixed error with IPv6 IP when using IPv4 BIN. Fixed number overflow.
1 parent fde3e92 commit f41bf98

File tree

5 files changed

+351
-298
lines changed

5 files changed

+351
-298
lines changed

LICENSE

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
MIT License
2-
3-
Copyright (c) 2023 - 2024 IP2Location
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
1+
MIT License
2+
3+
Copyright (c) 2023 - 2024 IP2Location
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# IP2Location Lua Package
2-
3-
This Lua package 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 package 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.
4-
5-
This package can be used in many types of projects such as:
6-
7-
- select the geographically closest mirror
8-
- analyze your web server logs to determine the countries of your visitors
9-
- credit card fraud detection
10-
- software export controls
11-
- display native language and currency
12-
- prevent password sharing and abuse of service
13-
- geotargeting in advertisement
14-
15-
The database will be updated in monthly basis for the greater accuracy. Free LITE databases are available at https://lite.ip2location.com/ upon registration.
16-
17-
The paid databases are available at https://www.ip2location.com under Premium subscription package.
18-
19-
As an alternative, this library 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:
20-
21-
https://www.ip2location.com/web-service/ip2location
22-
23-
## Developer Documentation
1+
# IP2Location Lua Package
2+
3+
This Lua package 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 package 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.
4+
5+
This package can be used in many types of projects such as:
6+
7+
- select the geographically closest mirror
8+
- analyze your web server logs to determine the countries of your visitors
9+
- credit card fraud detection
10+
- software export controls
11+
- display native language and currency
12+
- prevent password sharing and abuse of service
13+
- geotargeting in advertisement
14+
15+
The database will be updated in monthly basis for the greater accuracy. Free LITE databases are available at https://lite.ip2location.com/ upon registration.
16+
17+
The paid databases are available at https://www.ip2location.com under Premium subscription package.
18+
19+
As an alternative, this library 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:
20+
21+
https://www.ip2location.com/web-service/ip2location
22+
23+
## Developer Documentation
2424
To learn more about installation, usage, and code examples, please visit the developer documentation at [https://ip2location-lua.readthedocs.io/en/latest/index.html.](https://ip2location-lua.readthedocs.io/en/latest/index.html)
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
package = "ip2location"
2-
version = "8.7.0-1"
3-
source = {
4-
url = "git://github.com/ip2location/ip2location-lua.git"
5-
}
6-
description = {
7-
summary = "IP2Location Lua Package",
8-
detailed = [[
9-
This Lua package provides a fast lookup of country, region, city, latitude, longitude, ZIP code,
10-
time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name,
11-
mcc, mnc, mobile brand, elevation, usage type, address type, IAB category, district,
12-
autonomous system number (ASN) and autonomous system (AS) from IP address by using IP2Location database.
13-
This package uses a file based database available at IP2Location.com. This database simply contains IP
14-
blocks as keys, and other information such as country, region, city, latitude, longitude, ZIP code,
15-
time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name,
16-
mcc, mnc, mobile brand, elevation, usage type, address type, IAB category, district,
17-
autonomous system number (ASN) and autonomous system (AS) as values. It supports both IP address
18-
in IPv4 and IPv6.
19-
]],
20-
homepage = "https://www.ip2location.com/development-libraries/ip2location/lua",
21-
license = "MIT",
22-
maintainer = "support@ip2location.com"
23-
}
24-
dependencies = {
25-
"lua >= 5.3",
26-
"lua-nums",
27-
"json-lua",
28-
"luasocket",
29-
"urlencode"
30-
}
31-
build = {
32-
type = "builtin",
33-
modules = {
34-
["ip2location"] = "ip2location.lua",
35-
["ip2locationwebservice"] = "ip2locationwebservice.lua"
36-
}
1+
package = "ip2location"
2+
version = "8.7.1-1"
3+
source = {
4+
url = "git://github.com/ip2location/ip2location-lua.git"
5+
}
6+
description = {
7+
summary = "IP2Location Lua Package",
8+
detailed = [[
9+
This Lua package provides a fast lookup of country, region, city, latitude, longitude, ZIP code,
10+
time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name,
11+
mcc, mnc, mobile brand, elevation, usage type, address type, IAB category, district,
12+
autonomous system number (ASN) and autonomous system (AS) from IP address by using IP2Location database.
13+
This package uses a file based database available at IP2Location.com. This database simply contains IP
14+
blocks as keys, and other information such as country, region, city, latitude, longitude, ZIP code,
15+
time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name,
16+
mcc, mnc, mobile brand, elevation, usage type, address type, IAB category, district,
17+
autonomous system number (ASN) and autonomous system (AS) as values. It supports both IP address
18+
in IPv4 and IPv6.
19+
]],
20+
homepage = "https://www.ip2location.com/development-libraries/ip2location/lua",
21+
license = "MIT",
22+
maintainer = "support@ip2location.com"
23+
}
24+
dependencies = {
25+
"lua >= 5.3",
26+
"lua-nums",
27+
"json-lua",
28+
"luasocket",
29+
"urlencode"
30+
}
31+
build = {
32+
type = "builtin",
33+
modules = {
34+
["ip2location"] = "ip2location.lua",
35+
["ip2locationwebservice"] = "ip2locationwebservice.lua"
36+
}
3737
}

0 commit comments

Comments
 (0)