Skip to content

Commit 8f4f01c

Browse files
Added support for address type and IAB category. Added exception handling for wrong BIN file.
1 parent 45f034b commit 8f4f01c

5 files changed

Lines changed: 110 additions & 132 deletions

File tree

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) 2020 ip2location
3+
Copyright (c) 2021 ip2location
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: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
IP2Location Lua Package
22
======================
33

4-
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, and usage type 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, and usage type as values. It supports both IP address in IPv4 and IPv6.
4+
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 and IAB category 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 and IAB category as values. It supports both IP address in IPv4 and IPv6.
55

66
This package can be used in many types of projects such as:
77

@@ -31,7 +31,7 @@ Example
3131
```lua
3232
ip2location = require('ip2location')
3333

34-
local ip2loc = ip2location:new('IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE-ISP-DOMAIN-NETSPEED-AREACODE-WEATHER-MOBILE-ELEVATION-USAGETYPE.BIN')
34+
local ip2loc = ip2location:new('IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE-ISP-DOMAIN-NETSPEED-AREACODE-WEATHER-MOBILE-ELEVATION-USAGETYPE-ADDRESSTYPE-CATEGORY.BIN')
3535

3636
local result = ip2loc:get_all('8.8.8.8')
3737

@@ -55,6 +55,8 @@ print("mnc: " .. result.mnc)
5555
print("mobilebrand: " .. result.mobilebrand)
5656
print("elevation: " .. result.elevation)
5757
print("usagetype: " .. result.usagetype)
58+
print("addresstype: " .. result.addresstype)
59+
print("category: " .. result.category)
5860

5961
ip2loc:close()
6062

@@ -76,4 +78,4 @@ Use the IPv6 BIN file if you need to query BOTH IPv4 and IPv6 addresses.
7678
Copyright
7779
=========
7880

79-
Copyright (C) 2020 by IP2Location.com, support@ip2location.com
81+
Copyright (C) 2021 by IP2Location.com, support@ip2location.com
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package = "ip2location"
2-
version = "8.3.1-1"
2+
version = "8.4.0-1"
33
source = {
44
url = "git://github.com/ip2location/ip2location-lua.git"
55
}
@@ -8,11 +8,12 @@ description = {
88
detailed = [[
99
This Lua package provides a fast lookup of country, region, city, latitude, longitude, ZIP code,
1010
time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name,
11-
mcc, mnc, mobile brand, elevation, and usage type from IP address by using IP2Location database.
12-
This package uses a file based database available at IP2Location.com. This database simply contains
13-
IP blocks as keys, and other information such as country, region, city, latitude, longitude, ZIP code,
14-
time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name,
15-
mcc, mnc, mobile brand, elevation, and usage type as values. It supports both IP address in IPv4 and IPv6.
11+
mcc, mnc, mobile brand, elevation, usage type, address type and IAB category from IP address by using
12+
IP2Location database. This package uses a file based database available at IP2Location.com. This database
13+
simply contains IP blocks as keys, and other information such as country, region, city, latitude, longitude,
14+
ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code, station name,
15+
mcc, mnc, mobile brand, elevation, usage type, address type and IAB category as values. It supports both
16+
IP address in IPv4 and IPv6.
1617
]],
1718
homepage = "https://www.ip2location.com/development-libraries/ip2location/lua",
1819
license = "MIT",

0 commit comments

Comments
 (0)