From c0c4617de2de7b7b4b096e7d43eb6beb68c3bdd2 Mon Sep 17 00:00:00 2001 From: "IP2Location.com" Date: Thu, 11 Jan 2024 09:50:21 +0800 Subject: [PATCH] Added PackageVersion and DatabaseVersion functions --- ip2location.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ip2location.go b/ip2location.go index 62db7ec..417536a 100644 --- a/ip2location.go +++ b/ip2location.go @@ -159,7 +159,7 @@ var district_position = [27]uint8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 var asn_position = [27]uint8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24} var as_position = [27]uint8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25} -const api_version string = "9.6.1" +const api_version string = "9.7.0" var max_ipv4_range = uint128.From64(4294967295) var max_ipv6_range = uint128.From64(0) @@ -580,6 +580,16 @@ func Api_version() string { return api_version } +// PackageVersion returns the database type. +func (d *DB) PackageVersion() string { + return strconv.Itoa(int(d.meta.databasetype)) +} + +// DatabaseVersion returns the database version. +func (d *DB) DatabaseVersion() string { + return "20" + strconv.Itoa(int(d.meta.databaseyear)) + "." + strconv.Itoa(int(d.meta.databasemonth)) + "." + strconv.Itoa(int(d.meta.databaseday)) +} + // populate record with message func loadmessage(mesg string) IP2Locationrecord { var x IP2Locationrecord