Skip to content

Commit

Permalink
Added PackageVersion and DatabaseVersion functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ip2location committed Jan 11, 2024
1 parent b9b49ae commit c0c4617
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ip2location.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c0c4617

Please sign in to comment.