Skip to content

Commit c0c4617

Browse files
committed
Added PackageVersion and DatabaseVersion functions
1 parent b9b49ae commit c0c4617

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ip2location.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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
159159
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}
160160
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}
161161

162-
const api_version string = "9.6.1"
162+
const api_version string = "9.7.0"
163163

164164
var max_ipv4_range = uint128.From64(4294967295)
165165
var max_ipv6_range = uint128.From64(0)
@@ -580,6 +580,16 @@ func Api_version() string {
580580
return api_version
581581
}
582582

583+
// PackageVersion returns the database type.
584+
func (d *DB) PackageVersion() string {
585+
return strconv.Itoa(int(d.meta.databasetype))
586+
}
587+
588+
// DatabaseVersion returns the database version.
589+
func (d *DB) DatabaseVersion() string {
590+
return "20" + strconv.Itoa(int(d.meta.databaseyear)) + "." + strconv.Itoa(int(d.meta.databasemonth)) + "." + strconv.Itoa(int(d.meta.databaseday))
591+
}
592+
583593
// populate record with message
584594
func loadmessage(mesg string) IP2Locationrecord {
585595
var x IP2Locationrecord

0 commit comments

Comments
 (0)